priestc / moneywagon

Universal bitcoin/altcoin blockchain client library for Python and the command line
http://multiexplorer.com
MIT License
149 stars 48 forks source link

Genesis transaction #24

Closed shkschneider closed 7 years ago

shkschneider commented 7 years ago

I tried a bit of calls and while quering the genesis block and this related to it, I found out that its transaction fails. Yet most explorers display that transaction id for the genesis block (https://blockchain.info/fr/block-index/14849). Anyway, I would expect that tool to return a valid output for that txid, even if genesis.

$ moneywagon single-transaction --txid=4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b btc
Traceback (most recent call last):
  File "/usr/local/bin/moneywagon", line 193, in <module>
    get_single_transaction, argz.crypto, **modes
  File "/usr/local/bin/moneywagon", line 145, in prepare_json
    result = high_level_func(*args, **kwargs)
  File "/home/.../.local/lib/python2.7/site-packages/moneywagon/__init__.py", line 202, in get_single_transaction
    services, SingleTransaction, {'crypto': crypto, 'txid': txid}, modes=modes
  File "/home/.../.local/lib/python2.7/site-packages/moneywagon/core.py", line 490, in enforce_service_mode
    consensus_results = fetcher.action(**kwargs)
  File "/home/.../.local/lib/python2.7/site-packages/moneywagon/__init__.py", line 446, in action
    return self._try_services("get_single_transaction", crypto, txid)
  File "/home/.../.local/lib/python2.7/site-packages/moneywagon/core.py", line 437, in _try_services
    raise NoService(self.no_service_msg(*args, **kwargs) + "! Tried: " + failed_msg)

moneywagon.core.NoService: Could not get transaction info for: btc:4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b! Tried: Bitpay Insight -> Skipped: 404 - Not Found, Blockr.io -> Skipped: 404 - Not Found, BlockCypher -> Skipped: 404 - Not Found, BlockExplorer.com -> Skipped: 404 - Not Found, Chain.So -> Skipped: 404 - Not Found, CoinPrism -> TypeError 'NoneType' object has no attribute '__getitem__', SmartBit -> KeyError 'transaction', LocalBitcoinsChain (Insight) -> Skipped: 404 - Not Found
priestc commented 7 years ago

If you re-run that command with --verbose then you'll see that many of the block explorers simply don't have the genesis coinbase in their transaction database. I believe this is a known issue in bitcoin, so it's not surprising many block explorers don't handle it. All though the coinprism service seems to return something... I have personally have never mined so I rarely run coinbase transactions through moneywagon. Many services probably have errors when returning coinbase transactions, as coinbase transactions are largely untested. Thank you for reporting this error.