pooler1122 (OP)
Member
Offline
Activity: 91
Merit: 10
|
|
July 10, 2014, 12:19:24 AM |
|
How to run getblock command in wallet console ? I input help , show -- getblock <hash> [txinfo] but i input below code return error , can you tell me how can correct run getblock command? many thanks!! 08:11:18  getblock <000000034d349d9b66387a9449d48d1a731933a96dc067cc34a6ccdf402617d1> ["8d412d7b141ead1a89ad8d3f2a4f1d9c359978ebc9426e40fc6789511a18e4f5"]
08:11:18  Error: Error parsing JSON:[8d412d7b141ead1a89ad8d3f2a4f1d9c359978ebc9426e40fc6789511a18e4f5]
08:11:50  getblock <000000034d349d9b66387a9449d48d1a731933a96dc067cc34a6ccdf402617d1> [8d412d7b141ead1a89ad8d3f2a4f1d9c359978ebc9426e40fc6789511a18e4f5]
08:11:50  Error: Error parsing JSON:[8d412d7b141ead1a89ad8d3f2a4f1d9c359978ebc9426e40fc6789511a18e4f5]
|
|
|
|
DeathAndTaxes
Donator
Legendary
Offline
Activity: 1218
Merit: 1079
Gerald Davis
|
|
July 10, 2014, 01:13:32 AM Last edit: July 10, 2014, 04:09:43 AM by DeathAndTaxes |
|
Well first the <> in the syntax simply means a required parameter and the [] means an optional one. You don't enter the <> or []. Also there is built in help for all RPC commands, just enter Example: help getblock
getblock "hash" ( verbose )
If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'. If verbose is true, returns an Object with information about block <hash>.
Arguments: 1. "hash" (string, required) The block hash 2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data
Result (for verbose = true): { "hash" : "hash", (string) the block hash (same as provided) "confirmations" : n, (numeric) The number of confirmations "size" : n, (numeric) The block size "height" : n, (numeric) The block height or index "version" : n, (numeric) The block version "merkleroot" : "xxxx", (string) The merkle root "tx" : [ (array of string) The transaction ids "transactionid" (string) The transaction id ,... ], "time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) "nonce" : n, (numeric) The nonce "bits" : "1d00ffff", (string) The bits "difficulty" : x.xxx, (numeric) The difficulty "previousblockhash" : "hash", (string) The hash of the previous block "nextblockhash" : "hash" (string) The hash of the next block }
Result (for verbose=false): "data" (string) A string that is serialized, hex-encoded data for block 'hash'.
Examples: > bitcoin-cli getblock "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
On my bitcoind (and on blockr.io the hash you are using is not a valid blockhash however 00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de is the most recent blockhash as of this post. getblock 00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de true
{ "hash" : "00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de", "confirmations" : 1, "size" : 19274, "height" : 310010, "version" : 2, "merkleroot" : "9d32282c5b4831e56d9b50287e9601e17f03b74820b9d1a353a294645b42af86", "tx" : [ "a654b2fce469dfe51e621616cf310fed69f8c1ece82ffb953ba767303ee6c88c", "5bc0f574b4e85d5dbe6fe4bb1809e3e0f00f0ad239ccc524eb9404e9a88c484c", "93936276b3eff8ab22031a40c3c810c5aaf5a2fcc4cf886e239ca5f1a0edfa15", "5b348cc1c5348a1714ea9ed3c34462ac9d569979a9673d7bab82c8eda5822d5a", "c0709331182cac1872094f4a6615f49649ad91738b0a3a137ef54a71ac673060", "b7a03c760e5a507d1e08c3ff16c05004da0a5597b86fbef589b7fab81ffcf332", "1a59b98abf8452a1688f0ec97ba2394d657e15c2c22893d11d1e78cfdaae17ae", "eb0fee0250e1c3aa6d76987faa9bc3fa23e0a98daad06129ec034f34e9fda798", "a3ebe698281b67a2d7192cb8d22b516a4685215ff3794502157b128c53f7181f", "765e835a242c5e4b3567640237a93e2495e87e72bc4352c7be10bf1190cec524", "4fd3c1b59c01e28d77e9389d9d24b875acff22bae95ba333a6280ee4f9bad68f", "d887e5b3e6c5171144c12ba4a1ff4fcd6d1aad2b45d8eb8bccbbd8e0f993b9b5", "091f4fe025b5cd9e79e22aa49fe5fed6b0ab30375924a7ad40b472c32b768823", "92c35cd6acae1179c09f44a81da567d27cc844934f1636c49564ba3c15893313", "ccba2b7572e3868fb7be0546ffb24bbc57d47965f1078940d6f80fabc8d64eb3", "828b3882ff2f732e08e2648ad6aa2f476fa6ad62af8e48fb1026c03b25ca2beb", "c6b99284c3d2fb0bee6d5ec71b6ed58fac7c6ea55ff5ca67be65a2b4d74d8b38", "c8511ad1f01cd22d53aa4d522e3bd1b340dcbdc791d66ce81431835f622b5608", "f098c0530fd017c99615ac8fa38b61d6371fcc64a72c05b0209d8b293672e005", "344403d2c6cd636d3db2e9d5dbd8af2e920e1e6285102a9de7eebf0a2e20b910", "d9602dfc88fa668ca18cc7aad2cfe140b16861ef9b08fbeff055ee0a2fd235ee", "09bafe2034ec3ab0ed7640895210e50192e8f12bedf72d9ff0f274cda17547d2", "fcb92270dc0acb1a5594d089fba1a99d8f16b65139489e9007e683fb5d06f098", "41bc1c2c88971c15f259e3a9cedd9e34ad15a75357961cb067d1eeb1e185c2a6", "3f53b9ef417a68ed01a93bf3162a185ce6ffa20c8e63891fc6476643fab77d44", "20cf6a19d7dd9f3c5964a0fcb2a36476a0eb1676197068109796b351604f093d", "32fa9af9965360057e97acec68901cddfa4f710f01bfc6c6d9adba912aa20630", "995d736da257c4bb8fb0a932d3850efd7f9cd667cfd67f89c4a2c912ebc1e815", "5b443e5e7b13b72bb249696abd94190f2efdf2535f1941672a51e8d20f579d22", "fb73ee4442a5f4662335346faf48d9dbd84e9d52f79841bb0e38dc40b249b52d", "f2887046f2441e6072bf04f010e23db22875af47ca2ad9f2d3eaa03473545201", "530a44e6634b62fdb56f085f4652211dd8a706fc76f10407db650468274ae17e", "26e79b2c856660af1c25ac61504aff985ab1f5703c83b01c69bdfd27716985f5", "337a15084b24f98907a05caa19e3509cbb9eadd59946d42d0eae62e80c00416a", "b972e440d6eea10511f7cff5f21baf11141c2e132775daf256f8805a042f4d31", "8b52732f8b921d7fa52997e756d558cd46a025287d076d1a2b91407c127c6f68", "52515608d30abd2fb2d8502e62bff0ec527579cdceb6db9a55c24167bad37620", "30a51e65850f3d412e6b51a9661e6f2e92f02b01f9eacb0a69234d0e4d051467", "2350c164db244e00d43806c3d36139414a4158ec3b250818b072d5ffd59ce976", "48410f81e16ca60211d1a2e6a00b46148608979121d2593b0139137c8db16bf1", "68b003a10651516e65d6c2c3d924f8080e86079b0a402a78d1595e87707a8387" ], "time" : 1404954522, "nonce" : 584447658, "bits" : "18415fd1", "difficulty" : 16818461371.16111200, "chainwork" : "00000000000000000000000000000000000000000000c6d2945d24fae4e567da", "previousblockhash" : "0000000000000000017d4e729a41e2232bf1246a2bca4795074dc15c36504002" }
true is the default option so if you leave it off (getblock 00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de) you get the same output. Setting the verbose (probably better named "decode") parameter to false gives you the raw block instead.  getblock 00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de false
|
|
|
|
pooler1122 (OP)
Member
Offline
Activity: 91
Merit: 10
|
|
July 10, 2014, 01:57:13 AM |
|
Well first the <> in the syntax simply means a required parameter and the [] means an optional one. You don't enter the <> or []. Also there is built in help for all RPC commands, just use the command help <command>. Example: help getblock
getblock "hash" ( verbose )
If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'. If verbose is true, returns an Object with information about block <hash>.
Arguments: 1. "hash" (string, required) The block hash 2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data
Result (for verbose = true): { "hash" : "hash", (string) the block hash (same as provided) "confirmations" : n, (numeric) The number of confirmations "size" : n, (numeric) The block size "height" : n, (numeric) The block height or index "version" : n, (numeric) The block version "merkleroot" : "xxxx", (string) The merkle root "tx" : [ (array of string) The transaction ids "transactionid" (string) The transaction id ,... ], "time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) "nonce" : n, (numeric) The nonce "bits" : "1d00ffff", (string) The bits "difficulty" : x.xxx, (numeric) The difficulty "previousblockhash" : "hash", (string) The hash of the previous block "nextblockhash" : "hash" (string) The hash of the next block }
Result (for verbose=false): "data" (string) A string that is serialized, hex-encoded data for block 'hash'.
Examples: > bitcoin-cli getblock "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
On my bitcoind (and on blockr.io the hash you are using is not a valid blockhash however 00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de is the most recent blockhash as of this post. getblock 00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de true
{ "hash" : "00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de", "confirmations" : 1, "size" : 19274, "height" : 310010, "version" : 2, "merkleroot" : "9d32282c5b4831e56d9b50287e9601e17f03b74820b9d1a353a294645b42af86", "tx" : [ "a654b2fce469dfe51e621616cf310fed69f8c1ece82ffb953ba767303ee6c88c", "5bc0f574b4e85d5dbe6fe4bb1809e3e0f00f0ad239ccc524eb9404e9a88c484c", "93936276b3eff8ab22031a40c3c810c5aaf5a2fcc4cf886e239ca5f1a0edfa15", "5b348cc1c5348a1714ea9ed3c34462ac9d569979a9673d7bab82c8eda5822d5a", "c0709331182cac1872094f4a6615f49649ad91738b0a3a137ef54a71ac673060", "b7a03c760e5a507d1e08c3ff16c05004da0a5597b86fbef589b7fab81ffcf332", "1a59b98abf8452a1688f0ec97ba2394d657e15c2c22893d11d1e78cfdaae17ae", "eb0fee0250e1c3aa6d76987faa9bc3fa23e0a98daad06129ec034f34e9fda798", "a3ebe698281b67a2d7192cb8d22b516a4685215ff3794502157b128c53f7181f", "765e835a242c5e4b3567640237a93e2495e87e72bc4352c7be10bf1190cec524", "4fd3c1b59c01e28d77e9389d9d24b875acff22bae95ba333a6280ee4f9bad68f", "d887e5b3e6c5171144c12ba4a1ff4fcd6d1aad2b45d8eb8bccbbd8e0f993b9b5", "091f4fe025b5cd9e79e22aa49fe5fed6b0ab30375924a7ad40b472c32b768823", "92c35cd6acae1179c09f44a81da567d27cc844934f1636c49564ba3c15893313", "ccba2b7572e3868fb7be0546ffb24bbc57d47965f1078940d6f80fabc8d64eb3", "828b3882ff2f732e08e2648ad6aa2f476fa6ad62af8e48fb1026c03b25ca2beb", "c6b99284c3d2fb0bee6d5ec71b6ed58fac7c6ea55ff5ca67be65a2b4d74d8b38", "c8511ad1f01cd22d53aa4d522e3bd1b340dcbdc791d66ce81431835f622b5608", "f098c0530fd017c99615ac8fa38b61d6371fcc64a72c05b0209d8b293672e005", "344403d2c6cd636d3db2e9d5dbd8af2e920e1e6285102a9de7eebf0a2e20b910", "d9602dfc88fa668ca18cc7aad2cfe140b16861ef9b08fbeff055ee0a2fd235ee", "09bafe2034ec3ab0ed7640895210e50192e8f12bedf72d9ff0f274cda17547d2", "fcb92270dc0acb1a5594d089fba1a99d8f16b65139489e9007e683fb5d06f098", "41bc1c2c88971c15f259e3a9cedd9e34ad15a75357961cb067d1eeb1e185c2a6", "3f53b9ef417a68ed01a93bf3162a185ce6ffa20c8e63891fc6476643fab77d44", "20cf6a19d7dd9f3c5964a0fcb2a36476a0eb1676197068109796b351604f093d", "32fa9af9965360057e97acec68901cddfa4f710f01bfc6c6d9adba912aa20630", "995d736da257c4bb8fb0a932d3850efd7f9cd667cfd67f89c4a2c912ebc1e815", "5b443e5e7b13b72bb249696abd94190f2efdf2535f1941672a51e8d20f579d22", "fb73ee4442a5f4662335346faf48d9dbd84e9d52f79841bb0e38dc40b249b52d", "f2887046f2441e6072bf04f010e23db22875af47ca2ad9f2d3eaa03473545201", "530a44e6634b62fdb56f085f4652211dd8a706fc76f10407db650468274ae17e", "26e79b2c856660af1c25ac61504aff985ab1f5703c83b01c69bdfd27716985f5", "337a15084b24f98907a05caa19e3509cbb9eadd59946d42d0eae62e80c00416a", "b972e440d6eea10511f7cff5f21baf11141c2e132775daf256f8805a042f4d31", "8b52732f8b921d7fa52997e756d558cd46a025287d076d1a2b91407c127c6f68", "52515608d30abd2fb2d8502e62bff0ec527579cdceb6db9a55c24167bad37620", "30a51e65850f3d412e6b51a9661e6f2e92f02b01f9eacb0a69234d0e4d051467", "2350c164db244e00d43806c3d36139414a4158ec3b250818b072d5ffd59ce976", "48410f81e16ca60211d1a2e6a00b46148608979121d2593b0139137c8db16bf1", "68b003a10651516e65d6c2c3d924f8080e86079b0a402a78d1595e87707a8387" ], "time" : 1404954522, "nonce" : 584447658, "bits" : "18415fd1", "difficulty" : 16818461371.16111200, "chainwork" : "00000000000000000000000000000000000000000000c6d2945d24fae4e567da", "previousblockhash" : "0000000000000000017d4e729a41e2232bf1246a2bca4795074dc15c36504002" }
true is the default option so if you leave it off (getblock 00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de) you get the same output. Setting the verbose (probably better named "decode") parameter to false gives you the raw block instead.  getblock 00000000000000000d2347b601158f40c741dbd9353918903f057cedd82f49de false
Thank you very much!!
|
|
|
|
|