cool hit counter The formation process of bitcoin trading_Intefrankly

The formation process of bitcoin trading


Today focuses on how a deal is formed.

When Zhang San wants to transfer bitcoins to Li Si in his bitcoin wallet, the wallet performs the following process.

1. Generating transactions

Find the address of the bitcoin held by Zhang San, and depending on the amount Zhang San wants to transfer to Li Si, find one or more addresses that contain slightly more than the sum of this amount of bitcoins and write them to the blank transaction just created.

2. Signature

Since Zhang San's private key is stored in the wallet, the wallet directly calls Zhang San's private key to sign the semi-formed transaction just now. When the signature is finished, fill in the signed data into this transaction.

3. Broadcast transactions

The wallet will now contain all the information data (generally referred to ashex ) is just sent to the network, the transaction id number is generated based on double SHA256 hash encryption of all information for this transaction. It doesn't have to be included in the hex in the sending network.

At this point a complete transaction message is generated, the miner receives the transaction and verifies it.

We reproduce the process of generating that transaction in the JSON format mentioned above, based on the process described above.

1. Generating transactions

First find the appropriate address for Zhang San with coins and find 1APcBuxCZxDeH1TB6huk9h1jE2YENBTxkF,

1G2Wo8kEjW8vRSdYtHEqqqdMyxvQFi1dj5 These two addresses will add up to more bitcoins than the number of coins to be issued, so this two addresses are used as the coin issue address.

Second, record Li4's address 1CgyFugseQMNQAQEr2cW6UcunQZSWTk4Ms to this transaction as well, put it in the output transaction, and write down the number of coins received.

Finally, the remaining amount needs to be deposited into Zhang San's change address, which is also prepared by the wallet, and the change address is 3PauLgPVQu2r6QnvWvK1GDGXdeB3ouCdqw. The amount of bitcoins to be changed is not the amount in the sending address minus the amount in the receiving address, but, rather, needs to be subtracted by a small miner's fee.

In this example, you need to write 0.1788 in the number of coins received in the change address. The miner's fee is not recorded in the transaction, but is calculated by subtracting the total number of coin sending addresses from the total number of coin receiving addresses.

At this point, the transaction information in JSON format is as follows.

At this point, we can see that the script in inputs is still empty and the value in hash is still not the final value.

2、Private key signature

The wallet is in charge of Zhang San's private key, so the transaction is signed with Zhang San's private key, and without going into the process of signing, the result of the signature is as follows.

- Sign this transaction with the private key corresponding to the 1APcBuxCZxDeH1TB6huk9h1jE2YENBTxkF address.

- Sign this transaction with the private key corresponding to the 1G2Wo8kEjW8vRSdYtHEqqqdMyxvQFi1dj5 address.

To include the results of the signature in the transaction.

3. Broadcast transactions

At this point, the complete transaction is stripped of braces, brackets, commas, English names, double quotes, and the values are all written together in the transaction format that everyone follows, eventually converging into one very long string: the

02000000026ebf6b8ddbb4536d4a2dfeed534b65d902f794a5214e02fe68b1b4123ee3cb03010000006a473044022033653d8ab7ad772c6521c346315a0e69464701a4bd3eba466af52f1bdd5dbb05022071f800db91a49f004a5d61ea5e220e52ba970b3f4c5ec79ac1b5d106d9ab1f9f0121037497fa7d8ed26caef4b313998e79fa60d7e97a78a4b1d25cef3caa5c803bd8bcfeffffffcb11692c5b206eacb63e68ca4b9e5bd82ba4f03399ad109c8eb2376016af5787000000006b483045022100e49bc68ca3d0a84021c5a55c206c61e7db8cf441c12ee36217334bd6a295dea602200a8474cfe5b5804834fd9a76dac8a55f70b48eea16eb91d538c4e709782ba874012102c3c940a918bd2a1654c3dbc790d10944d09f597a63f91a13b73d7d87fd96f972feffffff0272f20e00000000001976a91480389130638c5ac5b4fdb15e65fa821f023bd3c788acc0d310010000000017a914f02ac68a03871c6b7d04d9632ec941ad3de2f62d8723c90700

That's the complete information on this deal, which is the hex mentioned above. Broadcast this data to the network and the miners receive it and can start validating this transaction.

Follow [Blockchain in Plain English] and learn to understand blockchain


Recommended>>
1、Internet School Recruitment 2019 Salary and Job Requirements Revealed
2、Vulnerability Analysis Multiple vulnerabilities in HumaxWiFi routers can gain administrator privileges
3、Why is big data a business tool
4、JPEG algorithm overview and implementation
5、golang knowledge graph NLP handson section 3 Entity triplet relationship extraction

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号