json - is there a way to read .dat files as in the storage format for bitcoin blocks? -
i've generated "raw data" encoded .dat
from bitcoin testnet, accordingly have file /blk00000.dat, data of blocks i've generated? i.e. transaction data etc.?
it looks this:
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00ff ffff ff03 5301 01ff ffff ff01 00f2 052a 0100 0000 2321 02f6 89e4 8543 5d1a 78f9 d08c a612 7e36 2216 20e1 ad70 7576 dbae 41e7 c01d 406a b7ac 0000 0000 fabf b5da b300 0000 0000 0020 abb4 1583 7333 ff2b fcde f019 f2ad 4f4d 5c69 462f 277e 1c52 8564 53c2 ab2d 7674 1c8d de8d e0fa 11eb 9dfe 798d 4839 5a61 b9d3 439c f4e7 79a5 ebe3 dabe f15d 2930 d791 7357 ffff 7f20 0100 0000 0101 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 ffff ffff 0354 0101 ffff ffff 0100 f205 2a01 0000 0023 2102 f689 e485 435d 1a78 f9d0 8ca6 127e 3622 1620 e1ad 7075 76db ae41 e7c0 1d40 6ab7 ac00 0000 00fa bfb5 dab3 0000 0000 0000 2026 a3de 12ea 2f3a deb5 10bf d337 4390 7371 c2d6
is there way render human readable json, can see this:
{ "version" : 90300, "protocolversion" : 70002, "walletversion" : 60000, "balance" : 0.00000000, "blocks" : 0, "timeoffset" : 0, "connections" : 1, "proxy" : "", "difficulty" : 0.00000000, "testnet" : false, "keypoololdest" : 1413617762, "keypoolsize" : 101, "paytxfee" : 0.00000000, "relayfee" : 0.00001000, "errors" : "" }
edit
i have 2 bitcoin.conf
files, have 2 nodes, this:
# testnet-box functionality regtest=1 dnsseed=0 upnp=0 # listen on different ports default testnet port=19000 rpcport=19001 # run server, bitcoin-qt server=1 # enable ssl rpc server #rpcssl=1 rpcallowip=0.0.0.0/0 rpcuser=admin1 rpcpassword=123
it should noted i'm using configuration got here
edit ii
i had problem last step, namely xxx
it resulted in following error:
if had guess went wrong on part
<path-to-datadirectory>
exactlly should be? blk00000.dat
lives? whole directory? or file?
let's start interesting comment thread here:
the data stored in application-specific format optimized compact storage, , wasn't intended parsed other applications. can access data in chainstate through gettxout rpc call, , data in block index through getblock. i'll try find time write-up of exact format. – pieter wuille jul 29 '13 @ 7:17
however, if still interested in getting done, blockchain stored in 2 leveldb databases: 1 blocks , 1 chainstate. there multiple ways open that, recommend libbitcoin, or bitcoin-leveldb:
// define threadpool 1 thread. threadpool pool(1); // create leveldb blockchain. leveldb_blockchain ldb_chain(pool); // initialize our global 'chain' pointer above. chain = &ldb_chain; // start database using implementation specific method. ldb_chain.start("../database", blockchain_started);
the bitcoin fork of leveldb used in bitcoin core contains some documentation on how read , access data.
there an excellent thread on bitcoin stack exchange tells key:value model structure of database, required if try access database manually.
Comments
Post a Comment