Friday 23 October 2015

Blockchain proof of existence, part 2

This is the second part of a series on developing a Bitcoin application able to record document checksums in the Blockchain. The first part covered development of the software needed to take control over some addresses and create valid transactions, which itself was built on top of software handling discovering and connecting to the Bitcoin peer-to-peer network (covered in this post).

The actual additions needed to the Bitcoin wallet in order to write arbitrary data to the Blockchain turned out to be quite trivial; replacing the pay-to-pubkey-hash script with OP_RETURN followed by the data payload and broadcast it as normal:

Transaction: e4a325b4b54ca05bd58655a1c535c86fb7648e5392e83c72b428aee07ed19547

Input: tx aa37ea6c35e6688b52f71908bd3fb7700b83d6e88e32349914a7be964e5d69a8 (output index 1) => 1LivLKSyh9hU9enjptHveRqxp1uJ8NfDYd
Signature: 3046022100c22c7f8b3e49718fa8cb6db530c4d0607feb5cabe649a4070713e922d523058a022100d08292daabf847e6968572a9c6ec0a723b49ee85f11104de24e43510ce1e623f01

Output: 0 satoshis (0.000000 mBTC) to script: OP_RETURN 636861696e206f662074686f75676874
Output: 30000 satoshis (0.300000 mBTC) to script: OP_DUP OP_HASH160 1dhBEoKc1soKqVLfrgs8SPAn3hyVBRoWC OP_EQUALVERIFY OP_CHECKSIG

Where the payload 636861696e206f662074686f75676874 is, narcissistically, the hex encoded "chain of though". How well Blockchain trackers displays the payload data varies, but at least one (coinsecrets.org) does a good job at it.

From here the next step will be to expose this functionality online, giving everyone the power to record checksums, or other data, on the blockchain.



No comments:

Post a Comment