0

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

ubuntu@btc:~$ 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:

ubuntu@btc:~$ 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:

datadir=/mnt/btc/bitcoin
maxconnections=20
maxuploadtarget=144
disablewallet=1
txindex=1
maxmempool=4000
minrelaytxfee=0.0001

Blockchain info:

ubuntu@btc:~$ 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?

5
  • Are you sure your node is using the bitcoin.conf? Have you tried enabling txindex using the CLI option? Jul 20 at 12:59
  • It does mention Config file: /mnt/btc/bitcoin/bitcoin.conf. I enabled it on command line an it now says error code: -5 error message: No such mempool transaction. Blockchain transactions are still in the process of being indexed. Use gettransaction for wallet transactions.
    – stephen
    Jul 20 at 14:08
  • 1
    Great, now you only need to wait for the indexing to finish and you'll have your txindex. In the meantime you can try to figure out why exactly your bitcoin.conf file isn't being read correctly. Jul 20 at 14:29
  • Where is your bitcoin.conf located? It looks like it is not parsing any of the other arguments in your conf file, otherwise there would be multiple Config file arg lines, but there's only one for the datadir.
    – Andrew Chow
    Jul 22 at 5:10
  • I had 2. One was in ~/.bitcoin/bitcoin.conf that contained just datadir=/mnt/btc/bitcoin. In /mnt/btc/bitcoin/bitcoin.conf was the other one - that was not being read. So I moved the contents of it into ~/.bitcoin/bitcoin.conf. I am still unsure how to use a different conf file location.
    – stephen
    Jul 22 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.