First block of bitcoin block gives empty string

0 votes

I've downloaded a block named blk00000.dat from https://github.com/bitcoin-abe/bitcoin-abe/blob/master/test/btc200/blocks/blk00000.dat

I've written the following code to read first byte of the file but I am getting an empty sting. 

f = open('blk00000.dat')
byte1 = f.read(1)
print byte1
Sep 4, 2018 in Blockchain by digger
• 26,550 points
35 views

1 answer to this question.

0 votes

Most likely the first byte is not a printable character. Since you are reading binary data, you need to open the file in binary mode:

f = open('blk00000.dat', 'rb')
answered Sep 4, 2018 by slayer
• 29,170 points

Related Questions In Blockchain

+1 vote
1 answer
+1 vote
1 answer

How is ordering of transactions done in a block in hyperledger?

Consensus is the key concept for validating ...READ MORE

answered May 3, 2018 in Blockchain by Christine
• 15,790 points
190 views
0 votes
1 answer

How to extract h160 address of bitcoin blockchain?

You can extract the data using the ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,550 points
184 views
0 votes
1 answer

How to get current value of bitcoin?

You can use json_decode to transform it ...READ MORE

answered Aug 20, 2018 in Blockchain by digger
• 26,550 points
58 views
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
93 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
173 views
0 votes
1 answer
0 votes
1 answer

how loop through a JSON Array of bitcoin transaction data

for($i=0; $i<count($result['out']); $i++) { echo ...READ MORE

answered Sep 21, 2018 in Blockchain by slayer
• 29,170 points
47 views
0 votes
1 answer

Passing hash string with smart contracts

eth.sendTransaction is a go etherum function. There more ...READ MORE

answered Jul 5, 2018 in Blockchain by slayer
• 29,170 points
76 views