For something that’s used for such banal transactions like buying drugs and sending the Jamaican bobsled team to the Olympics, cryptocurrencies such as Bitcoin are actually very impressive pieces of software. It’s a very ingenious solution to the Two Generals Problem, and the fact it made a few Bitcoin early adopters very, very rich doesn’t hurt either. [Ken Shirriff] decided to take a look at the Bitcoin protocol by creating a Bitcoin address and transferring a small amount of bitcoin to that address, manually. It’s a great look at how the Bitcoin protocol actually works, and how ingenious this protocol actually is.
[Ken]‘s first task was to create a Bitcoin address. This is a 256-bit private key is the basis for the Bitcoin wallet private key (after being encoded as ASCII characters), and as the 512-bit public key (after being sent through an elliptic curve algorithm). The 512-bit public key is then hashed with SHA-256 and RIPEM 160 to generate the 160-bit public key hash and the Bitcoin address.
After creating a bitcoin address and wallet, [Ken] set out on manually creating a transaction. The idea was to buy a few cents (USD) from Coinbase and send them to his manually created address. This involved creating a transaction according to the Bitcoin spec and signing the transaction. Signing each Bitcoin transaction is the key to Bitcoin’s security, and is done with a small bit of code written in the Bitcoin scripting language.
With everything written in Python, [Ken] was ready to send his transaction off into the Bitcoin network. This was done by finding a few peers on the Bitcoin network and sending off a few packets. After a little bit of mining on the network, [Ken]‘s transaction went through, confirmed by a deposit into his Bitcoin wallet.
It’s an awesome writeup and impressive achievement to manually send a few Bitcoins from one wallet to another. More impressively, [Ken] provided some amazing insight into how the Bitcoin protocol works, and how much work went into its creation.