How to get the raw transaction on my node with txindexset to 1?


Whenever I try to get a raw transaction I get an error:

[email protected]:~$ bitcoin-cli getrawtransaction 2157b554dcfda405233906e461ee593875ae4b1b97615872db6a25130ecc1dd6
error code: -5
error message:
No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.

Startup text:

[email protected]:~$ bitcoind
2021-07-20T11:26:08Z Bitcoin Core version v0.21.0 (release build)
2021-07-20T11:26:08Z Assuming ancestors of block 0000000000000000000b9d2ec5a352ecba0592946514a92f14319dc2b367fc72 have valid signatures.
2021-07-20T11:26:08Z Setting nMinimumChainWork=00000000000000000000000000000000000000001533efd8d716a517fe2c5008
2021-07-20T11:26:08Z Using the 'standard' SHA256 implementation
2021-07-20T11:26:10Z Default data directory /home/ubuntu/.bitcoin
2021-07-20T11:26:10Z Using data directory /mnt/btc/bitcoin
2021-07-20T11:26:10Z Config file: /mnt/btc/bitcoin/bitcoin.conf
2021-07-20T11:26:10Z Config file arg: datadir="/mnt/btc/bitcoin"
2021-07-20T11:26:10Z Using at most 125 automatic connections (1024 file descriptors available)
2021-07-20T11:26:10Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2021-07-20T11:26:10Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2021-07-20T11:26:10Z Script verification uses 3 additional threads
2021-07-20T11:26:10Z scheduler thread start
2021-07-20T11:26:10Z HTTP: creating work queue of depth 16
2021-07-20T11:26:10Z Using random cookie authentication.
2021-07-20T11:26:10Z Generated RPC authentication cookie /mnt/btc/bitcoin/.cookie
2021-07-20T11:26:10Z HTTP: starting 4 worker threads
2021-07-20T11:26:10Z Using wallet directory /mnt/btc/bitcoin
2021-07-20T11:26:10Z init message: Verifying wallet(s)...
2021-07-20T11:26:10Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2021-07-20T11:26:10Z Using wallet /mnt/btc/bitcoin/wallet.dat
2021-07-20T11:26:10Z BerkeleyEnvironment::Open: LogDir=/mnt/btc/bitcoin/database ErrorFile=/mnt/btc/bitcoin/db.log
2021-07-20T11:26:10Z init message: Loading banlist...
2021-07-20T11:26:10Z SetNetworkActive: true
2021-07-20T11:26:10Z Using /16 prefix for IP bucketing
2021-07-20T11:26:10Z Cache configuration:
2021-07-20T11:26:10Z * Using 2.0 MiB for block index database
2021-07-20T11:26:10Z * Using 8.0 MiB for chain state database
2021-07-20T11:26:10Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2021-07-20T11:26:10Z init message: Loading block index...
2021-07-20T11:26:10Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2021-07-20T11:26:10Z Opening LevelDB in /mnt/btc/bitcoin/blocks/index
2021-07-20T11:26:10Z Opened LevelDB successfully
2021-07-20T11:26:10Z Using obfuscation key for /mnt/btc/bitcoin/blocks/index: 0000000000000000
2021-07-20T11:26:25Z LoadBlockIndexDB: last block file = 2659
2021-07-20T11:26:25Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=13, size=17474216, heights=691844...691858, time=2021-07-20...2021-07-20)
2021-07-20T11:26:25Z Checking all blk files are present...
2021-07-20T11:26:30Z Opening LevelDB in /mnt/btc/bitcoin/chainstate
2021-07-20T11:26:33Z Opened LevelDB successfully
2021-07-20T11:26:34Z Using obfuscation key for /mnt/btc/bitcoin/chainstate: 811ac9000cfb37f2
2021-07-20T11:26:34Z Loaded best chain: hashBestChain=0000000000000000000ed3eb1261750ddecb760d5914bc724963a65be5048d20 height=691858 date=2021-07-20T11:11:59Z progress=0.999995
2021-07-20T11:26:34Z init message: Rewinding blocks...
2021-07-20T11:26:35Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2021-07-20T11:26:35Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2021-07-20T11:26:35Z init message: Verifying blocks...
2021-07-20T11:26:35Z Verifying last 6 blocks at level 3
2021-07-20T11:26:35Z [0%]...[16%]...[33%]...[

Bitcoin conf:


Blockchain info:

[email protected]:~$ bitcoin-cli getblockchaininfo
  "chain": "main",
  "blocks": 691860,
  "headers": 691860,
  "bestblockhash": "00000000000000000009854076e894e617436163762f9e2ec46f616a2183f372",
  "difficulty": 13672594272814.14,
  "mediantime": 1626778212,
  "verificationprogress": 0.9999992519720163,
  "initialblockdownload": false,
  "chainwork": "00000000000000000000000000000000000000001fab3f9dd4dc1be7d6339a98",
  "size_on_disk": 403608388760,
  "pruned": false,

How can I fix this error?

Source link

Leave a reply