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


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

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字,当前共 发送