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
• 27,620 points
19 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,040 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
105 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
• 27,620 points
50 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
• 27,620 points
34 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,320 points
43 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
64 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,040 points
28 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,040 points
35 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.