Title: Getmemorypool data proper response? Post by: ThePiachu on February 26, 2012, 03:13:19 AM As there are a couple endiannesses used by Bitcoin, what is the proper way to encode the "data" response for a getmemorypool JSON API call?
Title: Re: Getmemorypool data proper response? Post by: Luke-Jr on February 29, 2012, 02:04:54 AM https://en.bitcoin.it/wiki/BIP_DRAFT:_getmemorypool isn't quite done yet, and needs double-checking.
Title: Re: Getmemorypool data proper response? Post by: ThePiachu on February 29, 2012, 03:26:56 AM It's a nice draft, but it doesn't really specify how to encode a block. Even the endianness of "previousblockhash" in getmemorypool is different to the one we can see encoded in getwork "data", so it can be quite confusing.
Title: Re: Getmemorypool data proper response? Post by: Luke-Jr on February 29, 2012, 03:48:04 AM It's a nice draft, but it doesn't really specify how to encode a block. That's already part of the main Bitcoin protocol specification.Even the endianness of "previousblockhash" in getmemorypool is different to the one we can see encoded in getwork "data", so it can be quite confusing. That's because the getwork "data" is part of a SHA256 midstate, which interprets the little-endian data as big-endian... so effectively inverts every 32 bits.Title: Re: Getmemorypool data proper response? Post by: ThePiachu on March 06, 2012, 01:53:54 AM So lets see, if I get this calling getmemorypool:
Code: {'previousblockhash': '0000000016375af4a21b4ce2b2ce64b5a5b27b5eab4c15e97db66208c7938ef8', 'transactions': [], 'version': 1, 'coinbasevalue': 5000000000, 'time': 1330998016, 'bits': '1c2336a4'} Code: "00000001c7938ef87db66208ab4c15e9a5b27b5eb2ce64b5a21b4ce216375af400000000e23686456c488b08b45a4d813a8aba9add29e9e36c8008a9051927300c6b39f24f556b001c2336a4c6c3fe55000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000" And a proper call to bitcoind through getmemorypool would be this: Code: "010000000000000016375AF4A21B4CE2B2CE64B5A5B27B5EAB4C15E97DB66208C7938EF80C6B39F2051927306C8008A9DD29E9E33A8ABA9AB45A4D816C488B08E2368645006B554FA436231C55FEC3C60101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF0A5468655069616368750BFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000" Or to brake it up: Code: 01000000 - version I still get "False" as a response to this. Where am I making an error? Title: Re: Getmemorypool data proper response? Post by: Luke-Jr on March 06, 2012, 02:19:09 AM Code: 01000000 - version I still get "False" as a response to this. Where am I making an error? Code: 01000000 - version Title: Re: Getmemorypool data proper response? Post by: ThePiachu on March 17, 2012, 10:28:02 PM Hmm, tried sending the fixed version to Bitcoin application in server mode, and got a false result. Tried the same with some other variation of the messages, and also got false-s.
This is the Getmemorypool data I received (ignoring all the transactions): Code: {'previousblockhash': '0000000020bcc87b08b88b6ccf1f79022bb2404b26e8fcec398fe323e93f2bc1', 'transactions': [], 'version': 1, 'coinbasevalue': 5005350000, 'time': 1332022461, 'bits': '1c2336a4'} So, got this Getwork response: Code: 00000001e93f2bc1398fe32326e8fcec2bb2404bcf1f790208b88b6c20bcc87b00000000b0bdf352aa835722693225753422bea517f9143755c2c705fad08617be75d1de4f65086e1c2336a462295f9f000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000 And tried calling the Bitcoin getmemorypool with the following parameters: Code: 010000000000000020BCC87B08B88B6CCF1F79022BB2404B26E8FCEC398FE323E93F2BC1BE75D1DEFAD0861755C2C70517F914373422BEA569322575AA835722B0BDF3526E08654FA436231C9F5F29620101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1D546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7EFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000 Code: 01000000C12B3FE923E38F39ECFCE8264B40B22B02791FCF6C8BB8087BC8BC2000000000BE75D1DEFAD0861755C2C70517F914373422BEA569322575AA835722B0BDF3526E08654FA436231C9F5F29620101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1D546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7EFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000 Code: 010000000000000020BCC87B08B88B6CCF1F79022BB2404B26E8FCEC398FE323E93F2BC152F3BDB0225783AA75253269A5BE22343714F91705C7C2551786D0FADED175BE6E08654FA436231C9F5F29620101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1D546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7EFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000 Code: 01000000C12B3FE923E38F39ECFCE8264B40B22B02791FCF6C8BB8087BC8BC200000000052F3BDB0225783AA75253269A5BE22343714F91705C7C2551786D0FADED175BE6E08654FA436231C9F5F29620101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1D546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7EFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000 And all of them returned false. From what I understand, the proper brakedown should be this: Code: 01000000 So I've tried every variant of previous hash and merkle root endianness. What I'm guessing the problem can be is: -The Bitcoin client does not like handling getmemorypool -I've made some error calculating the merkle root -The nonce setting is wrong -There is something wrong with the coinbase transaction |