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,740 points
838 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,370 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
1,338 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,740 points
2,571 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,740 points
843 views
+1 vote
1 answer

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

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,459 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
1,942 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,468 views
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,370 points
747 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,370 points
1,466 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP