GithubHelp home page GithubHelp logo

congyuwang / py-bitcoin-explorer Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 3.0 158 KB

High Performance Blockchain Deserializer

Home Page: https://pypi.org/project/bitcoin-explorer/

License: MIT License

Python 29.45% Jupyter Notebook 27.05% Shell 0.21% Rust 43.29%
pyo3 bitcoin parser deserializer blockchain

py-bitcoin-explorer's People

Contributors

congyuwang avatar jiangdonglai98 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

py-bitcoin-explorer's Issues

db.get_transaction - value not found for txid

Hi @Congyuwang ,

I have encountered an issue where the get_transaction function fails after around block 622,000 - possibly due to the Bitcoin Core version 0.19.1.

Would you happen to know of any workarounds for this issue? Thank for your help!

stuck at block 787037

I updated the bitcoin_explorer package to the latest version, 1.2.20.
I am trying to read block 787036, 787037, 787038 to the latest block.
But it stuck at block 787037, take hours and hours, but still don't get anything.
What's the problem please?

error message - panicked at 'block hash not found in block index!' - using bitcoin core 25

Hi,

I am using bitcoin core 25 to download the blockchain data.
I get this error message when running

db = bq.BitcoinDB("/home/neri/.bitcoin/", tx_index=True)
[20:13:36] INFO - Start loading block_index
thread '' panicked at 'block hash not found in block index!', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitcoin-explorer-1.2.20/src/parser/block_index.rs:125:18
Traceback (most recent call last):
File "", line 1, in
File "/home/neri/.local/lib/python3.10/site-packages/bitcoin_explorer/init.py", line 82, in init
self.db = _BitcoinDB(str(path), tx_index)
pyo3_runtime.PanicException: block hash not found in block index!

Any idea how to solve the problem?
Thanks, Filippo

Why the results doesn't match?

I'm using the explorer in a regtest mode bitcoin-core and when I use the function "db.get_transaction()" for a specific transaction, it returns the following data:

[23:35:22] INFO - Start loading block_index
[23:35:23] INFO - Successfully opened tx_index DB!
{'txid': '4f820b821643587d0fb89720e0b2e8e32b6db4533e12c94ec1fee16b3539f7ab', 'input': ({'txid': '39a1aca5790d939d75159e43fc02c77a621c3c6119bc18fd32efee66e17b5657', 'vout': 1},), 'output': ({'value': 2000000000, 'addresses': ('bc1qjpjrryrqxykpe7x7uq63a0jfcc0upral3682a7',)}, {'value': 1999999718, 'addresses': ('bc1qxp54zryddh5jlqnd0u3cmrkt6j7eyrsq2769uu',)})}

If I check the same transaction with bitcoin-cli gettransaction I get the following data:

{
  "amount": 20.00000000,
  "confirmations": 10,
  "blockhash": "0d93629f7e02ec6c5f5872e36a339df37503629ce77ddf217aa6d40640bad60a",
  "blockheight": 203,
  "blockindex": 3,
  "blocktime": 1659992136,
  "txid": "4f820b821643587d0fb89720e0b2e8e32b6db4533e12c94ec1fee16b3539f7ab",
  "walletconflicts": [
  ],
  "time": 1659991965,
  "timereceived": 1659991965,
  "bip125-replaceable": "no",
  "details": [
    {
      "address": "bcrt1qjpjrryrqxykpe7x7uq63a0jfcc0uprale4953y",
      "category": "receive",
      "amount": 20.00000000,
      "label": "",
      "vout": 0
    }
  ],
  "hex": "0200000000010157567be166eeef32fd18bc19613c1c627ac702fc439e15759d930d79a5aca1390100000000feffffff0200943577000000001600149064319060312c1cf8dee0351ebe49c61fc08fbfe6923577000000001600143069510c8d6de92f826d7f238d8ecbd4bd920e000247304402204b3999d93bca110be6985b765d6ad990b0517c1531a862cf252030dbf08261c40220484c01ce5656c79890fb3db9b1d727bbea7def0b17f0fe3335fe52653969287801210382d5768096f162475257659c99556999cea6d622a4c583ddc7d5fd40ea536118af000000"
}

Why the data don't match? for example, doesn't appear in the return of the bitcoin explorer, or if I check the transaction that appears in the input of the bitcoin explorer ('39a1aca5790d939d75159e43fc02c77a621c3c6119bc18fd32efee66e17b5657') bitcoin-cli returns that is invalid.

Thanks for reading.

Erron on initialization (pyo3_runtime.PanicException)

I get following error during initialization (Python 3.8.11).

import bitcoin_explorer as bex
db = bex.BitcoinDB(r"D:\BTC\Chain")

[19:02:59] INFO - Start loading block_index
[19:03:00] INFO - Longest chain: 702696
thread '' panicked at 'called Result::unwrap() on an Err value: Utf8Error { valid_up_to: 58, error_len: Some(1) }', C:\Users\runneradmin.cargo\registry\src\github.com-1ecc6299db9ec823\leveldb-0.8.6\src\database\error.rs:29:72
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Traceback (most recent call last):
File "C:/Users/T/PycharmProjects/BTC_explorer/main.py", line 3, in
db = bex.BitcoinDB(r"D:\BTC\Chain")
File "D:\anaconda3\envs\env_btc\lib\site-packages\bitcoin_explorer_init_.py", line 82, in init
self.db = _BitcoinDB(str(path), tx_index)
pyo3_runtime.PanicException: called Result::unwrap() on an Err value: Utf8Error { valid_up_to: 58, error_len: Some(1) }
Process finished with exit code 1

I have data downloaded using Bitcoin Core in D:\BTC\Chain\blocks (.dat files) and D:\BTC\Chain\blocks\index (.ldb files).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.