Congyuwang / Py-Bitcoin-Explorer

High Performance Blockchain Deserializer
https://pypi.org/project/bitcoin-explorer/
MIT License
6 stars 3 forks source link

Why the results doesn't match? #6

Open JavierPorron opened 2 years ago

JavierPorron commented 2 years ago

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.

Congyuwang commented 1 year ago

Why the bitcoin-cli get-transaction does not return input information? I figured that the txid and output address does match. Perhaps some of the addresses are statically (hard-coded) banned by bitcoin?