In "Using Bitcoins the Hard Way" he writes (emphasis added):
It turns out that actually using the Bitcoin protocol is harder than I expected. As you will see, the protocol is a bit of a jumble: it uses big-endian numbers, little-endian numbers, fixed-length numbers, variable-length numbers, custom encodings, DER encoding, and a variety of cryptographic algorithms, seemingly arbitrarily. As a result, there's a lot of annoying manipulation to get data into the right format.
The second complication with using the protocol directly is that being cryptographic, it is very unforgiving. If you get one byte wrong, the transaction is rejected with no clue as to where the problem is.
The final difficulty I encountered is that the process of signing a transaction is much more difficult than necessary, with a lot of details that need to be correct. In particular, the version of a transaction that gets signed is very different from the version that actually gets used.
Obviously working through Ken's Python files helps to understand the varying instances of appending bytes, changing endianness and the various other complicated procedures used for sending a transaction in raw hex. Likewise, the following are useful:
- Protocol Specification @ Bitcoin Wiki
- Graphical Address Generator @ RoyalFork
- Ken Sheriff's Python code used in association with this post
My question: how does one go about learning the Bitcoin protocol by practising with the Testnet? (What resources are recommended to help formulate a raw transaction to send over the Bitcoin (Testnet) network?)