By default Bitcoin Core builds a database containing only the transactions for the user’s wallet.
Wallet transactions can be retireved using JSON RPC API gettransaction command.
But if you want to retrieve any transaction within the node use command getrawtransaction. This command will search transactions in the index.
bitcoin.conf file set txindex–
Bitcoin daemon or GUI uses conf file to load settings. On the first bitcoind run it will ask to create a config file.
Set txindex=1 in the config file before running the daemon. If the indexing is enabled the bitcoin daemon then should start synching the blocks and index.
bitcond -reindex option
If the txindex is not set in config before the first run and if later you want to index the database use -reindex option.
Re-index should take a while. To improve perfromance disable -printtoconsole option
bitcoind -reindex -rpcuser=xxxx -rpcpassword=xxxxx
bitcond -txindex option
If the txindex is not set in config before the first run and if later you want to index the database use -txindex option.
bitcoind -txindex -rpcuser=xxxx -rpcpassword=xxxxx