LoginSignup
0
0

More than 5 years have passed since last update.

[bitcoin core] getrawtransactionコマンドでの"Use -txindex"エラー

Last updated at Posted at 2018-11-21

環境

bitcoind 0.17

getrawtransaction(bitcoin coreドキュメント)でtransactionの情報をとろうとすると以下のエラー

$ bitcoin-cli getrawtransaction 5d55ed7b2e4e0d8896359ee457ca05ac6265914cfa712c4b695e279a5ceb893d true
error code: -5
error message:
No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions.

getrawtransactionコマンド

ドキュメントによれば、
getrawtransactionはmempoolのtransactionに対するコマンドです。
ブロックに入ったあとのtransactionに対しても使うためには、bitcoindを-txindexオプション付きで動作させる必要があります。

txindexを有効にするには

  • 設定ファイルに書く(方法調べてないし実証もしていないm(__)m)
  • 起動時にオプション付きで、$ bitcoind -txindex

すでに起動している場合は、それまでのtransactionをインデックスし直す必要があるようで
$ bitcoind -reindex -txindex
とします。
reindexには時間がかかります。

参考

bitcoin core 0.17
What are pros and cons of txindex option?
Bitcoin wiki

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0