3

I'm currently trying to figure out how to properly use Getmemorypool for mining and I'm having some problems with it. Are there any examples provided somewhere on how to properly call that RPC with some data (for example showing a call with a block that ended up in the testnet block chain)?

1

Here's an example.

First we call getmemory pool without arguments to get some data for our block:

{"method":"getmemorypool","params":[],"id":1}

bitcoind answers:

{
    "result": {
        "version":1,
        "previousblockhash":"0000000009a9a1c729d51337bf32ff300eeb59a5b3fbca99fc21c32e939c45f3",
        "transactions":["01000000084e8cf9dc5f88ca1491dbfb39cff0d404ce806d399304f10b33074dc7aa17903e000000008b48304502204a5e08b84c37d2fa0d2f0408dc0c57b3f32053b2cf36dec01ed4c74faa99a3dd022100ba7615866be25f117f27d122e2382e444c2dd008d225a0cfdff01f1a211d908d014104f137a019c7aabd0dd14072e3fb48b8052a2418908ab80bcc1644864d862da8230dee295fc0ffe99f2193a4399376f28a9a7017ac4a3512050685e68e153d06e1ffffffff67e9547d3ab191df75a26c05aa7b6c8728480fe45a6b6f894831fd37b0e58712000000008c4930460221009cf693f9044f567c9d0c79e1a00cf0042fc521cac7cfeb391387d7c192840ad3022100f11f8c6c941110621c486bb536cef52448200785abbc766dc18055ff1e7e56ae01410406b695afbaa14941464271fb3040d36fabcd7aa703b93ccf646563e8770a0125fd4da87da429295caf3169a8ccf65da93ce77c15265d0543d3113aae326637f8ffffffff9551e2f50386d363a4d330c58cb22375f29466a11e96891f243c2af2db13c3ba000000008b483045022100b81fa91fa57dd0e14698284d1c8ad7ec13cdc1c23c4d83f94af89f9e00d1c86502207602b111f6451bbfca2157d78462305080806cd1666973a711b7017b771b6f700141042b6a18abc6115d6a999438ec65c4dd123a11e36da7fa8ba0ff5696a7f7e1dc83dc25d3f0128dd4517f15478ca0dce69544ab432372c263d36348a6f44bd16f3fffffffffa6b94d37196d09375fcb0a71d689dddc1d05fe79d1ce0481017d7ad26c03802d000000008c493046022100efe3d5b1d50e27ec4c6655c01b43a7a7a231844ae619bccb8edd5e7f808aefd8022100997ce38e04ce2563ff7e03ee1088cafc50b80b10d6d37812dc71321af4bbc0a4014104820055b30b38ee0a90a14262b98ea434b422dccab78f27e3ed9612337b4b9fd4f59ac14be5e95b33d76230b1652ba1265c387225c0c254f397ef50655b72a418ffffffffbc0b100b9bbcd3fd55a125da9d16bcadea60349725c8592fac6453346ff93608000000008a47304402207e89ce7e140d65546c9700034c5541815d2bc310530e4938ff9b50ed184822d202202576dc9cf0a6fc42058e78f5164d465868939706ad396d3e5b57d8ea0c508073014104d67138f23a4768d3a204a3a273ee1ca6945853ef8c9a2cd8cfd506e47b3b248f213603aef904473af018ed1ff4ef74e4cdb0ff9c2deacf9823a049078a76fedaffffffffc1f5241c12f37a5c3aa47a21c41f3434be91080c7f41e75c0555a0e36200726e000000008b483045022028de22ecd4914df28e39495ea0b143386d74ae13d4b04dbd5fe3e0ee3713c9aa022100fafeadd20075d325ea600a91decd6da9aac41c8298afa41378a05b2734d2d40f014104c779a30cbac10723e95586317608eea86fca983e3c19c9522aa002a336d834646856bd83c36c10fea338cee142d4018766d518440c34bca4560f4c9e321ab5b5ffffffffda732f6cde3aee7312e4d79c736c5e2371054a622e62761f5fb0656bb2343d59010000008c49304602210081d74a79a96f265a9b02b60deb07c22c2c48e7ab3810933a7d0e58ee8681a163022100cbfc11072669baf26fa9ae8d3ba791f2244afa1f93a5f319d8a424d6f39ea290014104bbc1028f6a3236b2957eaec0db8421218666c89373f7763a60932c546be95da5549e610f878f5f6f33002aafeb2d7d64594abcaa04eef8d58f655116d1e66f67ffffffffe49412db7ac64a044ba85b23c9970993c5745e8675ab98d4b7b7ff11702d9fb3000000008a473044022051d1f52323d24daf64473455500734c0f3c4cdebcbcbc254ddb213d9cf98c71902200bf7886b991c7c402fc93f5218f0fc77423837319da361853e9b522ac3b5b6e8014104e6345517e6ed1484774a7e39639b3bd8754f6dff329851405529cb33e6ba73f7c428da905b3155e1e43593b6e5ff2bbe72d68b85f3215ff074c3f452bf179387ffffffff0200cc5501000000001976a914b6392bdac0e2d257dae6c2158a15483189765cd988ac8094dd3a000000001976a9148d3aa39648b3d1c15f3d254f2085ab213cb4e7bd88ac00000000","0100000002ae529af0f0f566f29797c4bfa36f8d9a058adb8c8925d416a08292b27b630d69000000008c493046022100c88e1af2c4981da9e3092ac0cef618786bf4e0dcc275da73af4391a33dda8924022100f85f46672e6d179615f6066093e2898a8b8a91572eaae945e29c4b9334fd9ec10141045ffdf42a00c23bf08493832db37148bb554429acf381d97718b4b01f274fe8d7be3007816f7e64dc31fc409ec477c3674aabad3a0e7c29ecf746ebdaa47bcb56fffffffff64d9d7326670b1d8d6e7c78a8e604145cf1dd0eb9ec9ea46167670667169486000000008b483045022069f2c8fa082e7cdbf4de64eeb81a6bdf33e0f2d7d66dc96b4541fdbe89c17b69022100cfb9f1f9e12797913e379516d1d666908c2f9f3ebb6caff809ea1fae656da46701410434931cfbcd7c3710ba80d0ff4f1280c7fa1d03424c97718990b4b8ab7cd7530a8a09c744ca9db299017543ad006b088726b5259b6578d9b76046a936ddb51f73ffffffff022a316300000000001976a9146e850eec4dc5c1777ca398d2d54eb3420d19975e88ac90b25b07000000001976a9146f25c165604201878a228a4feae39fa207b77eee88ac00000000"],
        "coinbasevalue":5000000000,
        "coinbaseflags":"062f503253482f",
        "time":1350579878,
        "mintime":1350577150,
        "curtime":1350579878,
        "bits":"1c2f36c0"
    },
    "error":null,
    "id":1
}

Next to create the block. We send:

{"method":"getmemorypool","params":["01000000f3459c932ec321fc99cafbb3a559eb0e30ff32bf3713d529c7a1a909000000009f83f0d0dc047481466529d0d1b2aacaba8ab1347497f5a9c5b65d0fb938cceaac368050c0362f1cb4cceac60301000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5603db5e01094269744d696e746572062f503253482f13657531020000000000000001000000000000002cfabe6d6db057e134bd9a65e5b7fd3e65082debdf4313eaf44feb0e5932db67e10e60e9b60100000000000000ffffffff0100f2052a010000001976a9146f25c165604201878a228a4feae39fa207b77eee88ac0000000001000000084e8cf9dc5f88ca1491dbfb39cff0d404ce806d399304f10b33074dc7aa17903e000000008b48304502204a5e08b84c37d2fa0d2f0408dc0c57b3f32053b2cf36dec01ed4c74faa99a3dd022100ba7615866be25f117f27d122e2382e444c2dd008d225a0cfdff01f1a211d908d014104f137a019c7aabd0dd14072e3fb48b8052a2418908ab80bcc1644864d862da8230dee295fc0ffe99f2193a4399376f28a9a7017ac4a3512050685e68e153d06e1ffffffff67e9547d3ab191df75a26c05aa7b6c8728480fe45a6b6f894831fd37b0e58712000000008c4930460221009cf693f9044f567c9d0c79e1a00cf0042fc521cac7cfeb391387d7c192840ad3022100f11f8c6c941110621c486bb536cef52448200785abbc766dc18055ff1e7e56ae01410406b695afbaa14941464271fb3040d36fabcd7aa703b93ccf646563e8770a0125fd4da87da429295caf3169a8ccf65da93ce77c15265d0543d3113aae326637f8ffffffff9551e2f50386d363a4d330c58cb22375f29466a11e96891f243c2af2db13c3ba000000008b483045022100b81fa91fa57dd0e14698284d1c8ad7ec13cdc1c23c4d83f94af89f9e00d1c86502207602b111f6451bbfca2157d78462305080806cd1666973a711b7017b771b6f700141042b6a18abc6115d6a999438ec65c4dd123a11e36da7fa8ba0ff5696a7f7e1dc83dc25d3f0128dd4517f15478ca0dce69544ab432372c263d36348a6f44bd16f3fffffffffa6b94d37196d09375fcb0a71d689dddc1d05fe79d1ce0481017d7ad26c03802d000000008c493046022100efe3d5b1d50e27ec4c6655c01b43a7a7a231844ae619bccb8edd5e7f808aefd8022100997ce38e04ce2563ff7e03ee1088cafc50b80b10d6d37812dc71321af4bbc0a4014104820055b30b38ee0a90a14262b98ea434b422dccab78f27e3ed9612337b4b9fd4f59ac14be5e95b33d76230b1652ba1265c387225c0c254f397ef50655b72a418ffffffffbc0b100b9bbcd3fd55a125da9d16bcadea60349725c8592fac6453346ff93608000000008a47304402207e89ce7e140d65546c9700034c5541815d2bc310530e4938ff9b50ed184822d202202576dc9cf0a6fc42058e78f5164d465868939706ad396d3e5b57d8ea0c508073014104d67138f23a4768d3a204a3a273ee1ca6945853ef8c9a2cd8cfd506e47b3b248f213603aef904473af018ed1ff4ef74e4cdb0ff9c2deacf9823a049078a76fedaffffffffc1f5241c12f37a5c3aa47a21c41f3434be91080c7f41e75c0555a0e36200726e000000008b483045022028de22ecd4914df28e39495ea0b143386d74ae13d4b04dbd5fe3e0ee3713c9aa022100fafeadd20075d325ea600a91decd6da9aac41c8298afa41378a05b2734d2d40f014104c779a30cbac10723e95586317608eea86fca983e3c19c9522aa002a336d834646856bd83c36c10fea338cee142d4018766d518440c34bca4560f4c9e321ab5b5ffffffffda732f6cde3aee7312e4d79c736c5e2371054a622e62761f5fb0656bb2343d59010000008c49304602210081d74a79a96f265a9b02b60deb07c22c2c48e7ab3810933a7d0e58ee8681a163022100cbfc11072669baf26fa9ae8d3ba791f2244afa1f93a5f319d8a424d6f39ea290014104bbc1028f6a3236b2957eaec0db8421218666c89373f7763a60932c546be95da5549e610f878f5f6f33002aafeb2d7d64594abcaa04eef8d58f655116d1e66f67ffffffffe49412db7ac64a044ba85b23c9970993c5745e8675ab98d4b7b7ff11702d9fb3000000008a473044022051d1f52323d24daf64473455500734c0f3c4cdebcbcbc254ddb213d9cf98c71902200bf7886b991c7c402fc93f5218f0fc77423837319da361853e9b522ac3b5b6e8014104e6345517e6ed1484774a7e39639b3bd8754f6dff329851405529cb33e6ba73f7c428da905b3155e1e43593b6e5ff2bbe72d68b85f3215ff074c3f452bf179387ffffffff0200cc5501000000001976a914b6392bdac0e2d257dae6c2158a15483189765cd988ac8094dd3a000000001976a9148d3aa39648b3d1c15f3d254f2085ab213cb4e7bd88ac000000000100000002ae529af0f0f566f29797c4bfa36f8d9a058adb8c8925d416a08292b27b630d69000000008c493046022100c88e1af2c4981da9e3092ac0cef618786bf4e0dcc275da73af4391a33dda8924022100f85f46672e6d179615f6066093e2898a8b8a91572eaae945e29c4b9334fd9ec10141045ffdf42a00c23bf08493832db37148bb554429acf381d97718b4b01f274fe8d7be3007816f7e64dc31fc409ec477c3674aabad3a0e7c29ecf746ebdaa47bcb56fffffffff64d9d7326670b1d8d6e7c78a8e604145cf1dd0eb9ec9ea46167670667169486000000008b483045022069f2c8fa082e7cdbf4de64eeb81a6bdf33e0f2d7d66dc96b4541fdbe89c17b69022100cfb9f1f9e12797913e379516d1d666908c2f9f3ebb6caff809ea1fae656da46701410434931cfbcd7c3710ba80d0ff4f1280c7fa1d03424c97718990b4b8ab7cd7530a8a09c744ca9db299017543ad006b088726b5259b6578d9b76046a936ddb51f73ffffffff022a316300000000001976a9146e850eec4dc5c1777ca398d2d54eb3420d19975e88ac90b25b07000000001976a9146f25c165604201878a228a4feae39fa207b77eee88ac00000000"],"id":1}

bitcoind answers:

{"result":true,"error":null,"id":1}

What happens is that we use the data we get from the first RPC call to construct a block and then send a hex representation of that block to bitcoind. Going over every byte in the data above is a bit much to do here, but the big chunk of data that represents our block follows the bitcoin protocol binary layout for blocks, which can be found at https://en.bitcoin.it/wiki/Protocol_specification#block.

The block above exists at height 89819 of the testnet used by bitcoind 0.6. You may not be able to see it if you are on a different testnet.

|improve this answer|||||
2

Eloipool (developed by the Eligius mining pool)'s source code contains multiple examples of using getmemorypool. It also includes a proof-of-concept proxy for miners.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.