For testnet solution "000000010b362ab3ec365c55dce00249fb087cb90ebf2208c4e97aa60022678a00000000616eb86
4ec5d0265277b564b916219818bad92cce0d52af9e3e748306af986384e206c1a1c00824f2a78f6
a600000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000"
Download the ruby code from
http://pastebin.com/y0sMZSbi and save it as 'block_header.rb'
make sure ruby and irb (interactive ruby shell) are installed.
irb
irb(main):001:0> load "./block_header.rb"
=> true
irb(main):003:0> b = BlockHeader.new("000000010b362ab3ec365c55dce00249fb087cb90ebf2208c4e97aa60022678a00000000616eb864ec5d0265277b564b916219818bad92cce0d52af9e3e748306af986384e206c1a1c00824f2a78f6a6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
=> #<BlockHeader:0x7f47cd9cba78 @raw="000000010b362ab3ec365c55dce00249fb087cb90ebf2208c4e97aa60022678a00000000616eb864ec5d0265277b564b916219818bad92cce0d52af9e3e748306af986384e206c1a1c00824f2a78f6a6">
irb(main):006:0> b.block_hash
=> "00000000001b2ff1c57142a9d90592ea3be28fe747da10a889c90afc03ab6e7b"
I've found ruby mechanize (
http://mechanize.rubyforge.org/) to be a good way to access web pages (such as block explorer) your block info will be at
http://blockexplorer.com/testnet/block/00000000001b2ff1c57142a9d90592ea3be28fe747da10a889c90afc03ab6e7bscRUBYt! (
http://www.justinspradlin.com/programming/ruby-screen-scraping-with-scrubyt/) makes a good screen scraper for pulling transaction info (txid) from block explorer.
Lastly, you will need a json-rpc library (such as
http://json-rpc.rubyforge.org/ - see the client side section) to pull transaction data from bitcoind.
Now you have all of the pieces!
- generate a solution that gets logged into the pushpool shares table
- have ruby search the shares table to find a solution
- use block_header.rb in your code to convert your solution into a valid block_hash
- go to block explorer (via something like mechanize) to find information about the block (specifically the txid)
- use json-rpc to pull information from bitcoind to find a matching transaction number
- find useful things out about your block such as confirmations, amount generated, invalid
- use this information to transfer bitcoins where needed