a bitcoin blockchain parser in Python
jtauber / blockchain Goto Github PK
View Code? Open in Web Editor NEWa bitcoin blockchain parser in Python
License: MIT License
a bitcoin blockchain parser in Python
License: MIT License
Im expecting problems with block chain from Bitcoin Core v 0.9.3.
First issue in assert in line 156, its not passing.
assert self.get_uint32() == 0xD9B4BEF9 # magic network id
Another issue (if I comment previous assert) is not expected opcode:
BLOCK 43054 b'14508459b221041eab257d2baaa7459775ba748246c8403609eb708f0e57e74b'
unknown opcode 101
Traceback (most recent call last):
File "./blockchain.py", line 227, in <module>
for block_num, block in enumerate(block_chain.blocks()):
File "./blockchain.py", line 74, in blocks
yield self.parse_block()
File "./blockchain.py", line 180, in parse_block
self.parse_transaction() for i in range(transaction_count)
File "./blockchain.py", line 180, in <listcomp>
self.parse_transaction() for i in range(transaction_count)
File "./blockchain.py", line 193, in parse_transaction
"inputs": self.parse_inputs(),
File "./blockchain.py", line 210, in parse_inputs
} for i in range(count)]
File "./blockchain.py", line 210, in <listcomp>
} for i in range(count)]
File "./blockchain.py", line 149, in get_script
raise ValueError
ValueError
Thanks.
Error "unknown opcode 76" in scanning blk00003.dat after Transaction 48 Block 2828
BLOCK 2828 b'0000000000000071a850d3d18dc83851020ae9b0c28bd8bf5ea3ea057e9e7c9d'
Transaction 0 b'7e166d44624d25ee5b3cd149adbf2ce2557835b15b4a90e45a0f4c4483c541'
...
...
Transaction 48 b'd110213aa4c7f897f4f05d5f6780f74406c1454582a150a76b041e295617eefa'
b'9fdafc2d2cd70bb59b253993156220e80645f95f3480b15e80331d24d4826453' 0 ->
0 0.209 -> address-type 1B3fRHwuHnfU6uUV5BCXiG6i4BmXrCZoVB
1 0.05 -> address-type 1fTfE6DrBua28gY5Lb8FZYQznU5VP7rjx
unknown opcode 76
Traceback (most recent call last):
File "blockchain.py", line 229, in <module>
for block_num, block in enumerate(block_chain.blocks()):
File "blockchain.py", line 73, in blocks
yield self.parse_block()
File "blockchain.py", line 178, in parse_block
block_data["transactions"] = [
File "blockchain.py", line 179, in <listcomp>
self.parse_transaction() for i in range(transaction_count)
File "blockchain.py", line 192, in parse_transaction
"inputs": self.parse_inputs(),
File "blockchain.py", line 204, in parse_inputs
return [{
File "blockchain.py", line 207, in <listcomp>
"script": self.get_script(),
File "blockchain.py", line 148, in get_script
raise ValueError
ValueError
P.S.
Similar error in scanning blk00004.dat Block 128 Transaction 124
When I run script balances.py with blk00000.dat everything ok, but blk00001.dat and next is was stopped with error:
user-comp:blockchain user$ python3 balances.py blk00001.dat
Traceback (most recent call last):
File "balances.py", line 22, in <module>
address, value = OUTPUTS[(inp["transaction_hash"], inp["transaction_index"])]
KeyError: (b'ebb7ecd72d290b93a7317f3c61ce97aec812ae24a2c94bdfe52f586914d4790a', 0)
Whats wrong with transaction_cash and how to fix it?
Error "unknown opcode 82" in scanning blk00005.dat in Transaction 134 Block 12
BLOCK 12 b'0000000000000914d7aae074324e401153b23d3979c3ab91c35b073ba1cc219d'
Transaction 0 b'd00f2dd49dd287713bfd309f4797a508ccf9b557bafd4dac5d4bf970e9e19090'
...
...
Transaction 134 b'41e1f5d888b9f528a32e7d0755136b3f37c3a6bd92924e229b855e7ab9606c2e'
b'23d68302961ed161a82f9b91865d318c429e82aa2adb0657c5a32e495f67c48d' 0 ->
0 0.04364733 -> address-type 1DxpYoBdA2Jx5gpaoXhoHmNqJKtNFfq1ma
1 0.02 -> address-type 1KfErWb4vBg2fnN6aaCmFfwRDynzxygduW
unknown opcode 82
Traceback (most recent call last):
File "blockchain.py", line 229, in <module>
for block_num, block in enumerate(block_chain.blocks()):
File "blockchain.py", line 73, in blocks
yield self.parse_block()
File "blockchain.py", line 178, in parse_block
block_data["transactions"] = [
File "blockchain.py", line 179, in <listcomp>
self.parse_transaction() for i in range(transaction_count)
File "blockchain.py", line 192, in parse_transaction
"inputs": self.parse_inputs(),
File "blockchain.py", line 204, in parse_inputs
return [{
File "blockchain.py", line 207, in <listcomp>
"script": self.get_script(),
File "blockchain.py", line 148, in get_script
raise ValueError
ValueError
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.