Small, educational snippets of code to help you to understand and work with Bitcoin.
- hexdec.rb - Convert hexadecimal to decimal
- dechex.rb - Convert decimal to hexadecimal
- swapendian.rb - Reverse the byte order of a string
- hash256.rb - The double-SHA256 hashing that Bitcoin uses
- miningsimulator.rb - Hashes a block header until it gets a hash below the target.
-
transactionbuilder.rb - Build a transaction from scratch, showing the transaction data as you go.
-
keygenerator.rb - Create a set of keys (Private Key, Public Key, Address) for sending and receiving bitcoin.
-
scriptdecoder.rb - Decode and run Script.