Bitcoin Core JSON-RPC
RPC of Bitcoin Core
bitcoin/JSON-RPC-interface.md at master · bitcoin/bitcoin
cookie ファイルは basic認証 で使う user:password なので次のようにすれば ok
code:curl
cat ~/.bitcoin/regtest/.cookie | xargs -I@ curl --user @ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:18000 | jq
https://bitcoin.stackexchange.com/a/80969
固定のクレデンシャルを使いたい場合は rpcauth を使う
bitcoin.conf の設定に rpcuser/rpcpassword が以前はあったが、deprecated。rpcauth を使う。
json rpc - Bitcoind to use static RPC authentication cookie from file? - Bitcoin Stack Exchange
生成方法が少し特殊
Bitcoin Core RPC Auth Config Generator
bitcoin/share/rpcauth/README.md at master · bitcoin/bitcoin
bitcoin-cli での指定方法
$ bitcoin-cli -rpcuser username -rpcpassword
ソースコード
bitcoin/src/rpc at v29.0 · bitcoin/bitcoin
公開されていない RPC も存在する
bitcoin/src/rpc/blockchain.cpp at v29.0 · bitcoin/bitcoin