Skip to content

Instantly share code, notes, and snippets.

@daiki44
Last active June 19, 2018 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daiki44/a0481eedf151b08d59b752701a95b7e0 to your computer and use it in GitHub Desktop.
Save daiki44/a0481eedf151b08d59b752701a95b7e0 to your computer and use it in GitHub Desktop.
【Bitcoin】bitcoin-cli でよく使うコマンドまとめ(ver 0.16.0) ref: https://qiita.com/daiki_44/items/cf6ba7ae9572f34d8b52
$ bitcoin-cli getnewaddress "好きなアカウント名"
2Mz7emapNnRwt4PtFPdBUGdv7sdsvMqbatc
$ bitcoin-cli -getinfo
{
"version": 169900,
"protocolversion": 70015,
"walletversion": 159900,
"balance": 50.00000000,
"blocks": 101,
"timeoffset": 0,
"connections": 0,
"proxy": "",
"difficulty": 4.656542373906925e-10,
"testnet": false,
"keypoololdest": 1523178221,
"keypoolsize": 999,
"paytxfee": 0.00000000,
"relayfee": 0.00001000,
"warnings": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
}
$ bitcoin-cli getrawtransaction "トランザクションID"
020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401650101ffffffff0200f2052a010000002321023a630166566039db88cfe0a33623ba67140ecbe80b03253a636181f06e0c9cb4ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000
$ bitcoin-cli decoderawtransaction "トランザクションのHEX値"
{
"txid": "7afc58ab1d2138e9f92531068f3a769bfbb2d40d9175f5eb4d9ce335beeb4a7c",
"hash": "1410c11943bac40ce7c90c4f16469c7d6a41fe20caab82c72af6b32c0d4bd748",
"version": 2,
"size": 182,
"vsize": 155,
"locktime": 0,
"vin": [
{
"coinbase": "01650101",
"sequence": 4294967295
}
],
"vout": [
{
"value": 50.00000000,
"n": 0,
"scriptPubKey": {
"asm": "023a630166566039db88cfe0a33623ba67140ecbe80b03253a636181f06e0c9cb4 OP_CHECKSIG",
"hex": "21023a630166566039db88cfe0a33623ba67140ecbe80b03253a636181f06e0c9cb4ac",
"reqSigs": 1,
"type": "pubkey",
"addresses": [
"mjwvyxdRycPht9WaoNAiVWQV1F4J1jFzXK"
]
}
},
{
"value": 0.00000000,
"n": 1,
"scriptPubKey": {
"asm": "OP_RETURN aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
"hex": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
"type": "nulldata"
}
}
]
}
$ bitcoin-cli move "送金元アドレス" "送金先アドレス" "送金額"
true
$ bitcoin-cli sendfrom "送金元アカウント名" "送金先アドレス" "送金額"
7c1b5ae96f71890734792629fc5f1bb708174ac5d04952c45b311f5ab2bef758
$ bitcoin-cli sendtoaddress "送金先アドレス" "送金額"
9666d26a2593cb0b026415fb14524ceb21515f2e932e5b25105e4f695407d74d
$ bitcoin-cli dumpprivkey "ビットコインアドレス"
cTvaTRTG3DunxvRHpLPQHfCUDPfwTnJZunSUaPKB6Gez1KfN5pMw
$ bitcoin-cli importprivkey "秘密鍵"
# 返り値なし
$ bitcoin-cli getbalance
50.00000000
$ bitcoin-cli listaccounts
{
"": 50.00000000,
"account1": 0.00000000,
"account2": 0.00000000
}
$ bitcoin-cli getaccount "ビットコインアドレス"
account名
$ bitcoin-cli getaccountaddress "アカウント名"
2N8iBdakZEQ8ddJMwmJV8Gr3LNbRSippBZw
$ bitcoin-cli getaddressesbyaccount "アカウント名"
[
"2Mz7emapNnRwt4PtFPdBUGdv7sdsvMqbatc",
"2N8iBdakZEQ8ddJMwmJV8Gr3LNbRSippBZw"
]
$ bitcoin-cli getblockhash "ブロックのインデックス値"
21783a47b7d1357265cf0c4c5d1dc50d29017bc9849a371f4734049a4875be9e
$ bitcoin-cli getblock "ブロックのハッシュ値"
{
"hash": "21783a47b7d1357265cf0c4c5d1dc50d29017bc9849a371f4734049a4875be9e",
"confirmations": 1,
"strippedsize": 227,
"size": 263,
"weight": 944,
"height": 101,
"version": 536870912,
"versionHex": "20000000",
"merkleroot": "7afc58ab1d2138e9f92531068f3a769bfbb2d40d9175f5eb4d9ce335beeb4a7c",
"tx": [
"7afc58ab1d2138e9f92531068f3a769bfbb2d40d9175f5eb4d9ce335beeb4a7c"
],
"time": 1523178253,
"mediantime": 1523178252,
"nonce": 0,
"bits": "207fffff",
"difficulty": 4.656542373906925e-10,
"chainwork": "00000000000000000000000000000000000000000000000000000000000000cc",
"previousblockhash": "7b13b23a8482ccc5b71b1269a8d88ed1d7642f73cb16bb8694cbd7a3dfc922c1"
}
$ bitcoin-cli gettransaction "トランザクションID"
{
"amount": 0.00000000,
"confirmations": 1,
"generated": true,
"blockhash": "21783a47b7d1357265cf0c4c5d1dc50d29017bc9849a371f4734049a4875be9e",
"blockindex": 0,
"blocktime": 1523178253,
"txid": "7afc58ab1d2138e9f92531068f3a769bfbb2d40d9175f5eb4d9ce335beeb4a7c",
"walletconflicts": [
],
"time": 1523178235,
"timereceived": 1523178235,
"bip125-replaceable": "no",
"details": [
{
"account": "",
"address": "mjwvyxdRycPht9WaoNAiVWQV1F4J1jFzXK",
"category": "immature",
"amount": 50.00000000,
"vout": 0
}
],
"hex": "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401650101ffffffff0200f2052a010000002321023a630166566039db88cfe0a33623ba67140ecbe80b03253a636181f06e0c9cb4ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment