Skip to content

Instantly share code, notes, and snippets.

@wshino
Created November 22, 2017 10:57
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 wshino/55300f259d1ccaf60e22d5ff84fc48e2 to your computer and use it in GitHub Desktop.
Save wshino/55300f259d1ccaf60e22d5ff84fc48e2 to your computer and use it in GitHub Desktop.
bitcoindを動かす
https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md
D/t/bitcoin ╍ cp ./src/bitcoind /usr/local/bin/.
D/t/bitcoin ╍ cp ./src/bitcoin-cli /usr/local/bin/.
D/t/bitcoin ╍ cp ./src/bitcoin-tx /usr/local/bin/.
D/t/bitcoin ╍ cat ~/Library/Application\ Support/Bitcoin/bitcoin.conf
testnet=3
txindex=1
server=1
rest=1
rpcuser=hoge
rpcpassword=hoge
rpcport=18332
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge -getinfo
D/t/bitcoin ╍ curl localhost:18332/rest/chaininfo.json
{"chain":"test","blocks":579387,"headers":1231290,"bestblockhash":"0000000000001262910da859645f71e20c29d5a184027628ace078ee085a6f4d","difficulty":376030.5321669207,"mediantime":1445520755,"verificationprogress":0.3878115845692899,"initialblockdownload":true,"chainwork":"000000000000000000000000000000000000000000000005ee90439daf0d250e","size_on_disk":3001918689,"pruned":false,"softforks":[{"id":"bip34","version":2,"reject":{"status":true}},{"id":"bip66","version":3,"reject":{"status":true}},{"id":"bip65","version":4,"reject":{"status":false}}],"bip9_softforks":{"csv":{"status":"defined","startTime":1456790400,"timeout":1493596800,"since":0},"segwit":{"status":"defined","startTime":1462060800,"timeout":1493596800,"since":0}},"warnings":"This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"}
D/t/bitcoin ╍
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge getconnectioncount
6
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge getpeerinfo
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge getnewaddress
mxpVDRV1DtPEXBgYpZKzFLd7Cb8J42brkH
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge setaccount mxpVDRV1DtPEXBgYpZKzFLd7Cb8J42brkH hogechan
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge listaccounts (732ms)
{
"": 0.00000000,
"hogechan": 0.00000000
}
testnet同期終わった
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge listaccounts
{
"": 0.00000000,
"hogechan": 0.00002000
}
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge listunspent
[
{
"txid": "1a1e5dfd4beb9a465b2a5a08649d8a05f9decf2c0802442a2a33e32ad4ec9a7c",
"vout": 1,
"address": "mxpVDRV1DtPEXBgYpZKzFLd7Cb8J42brkH",
"account": "hogechan",
"scriptPubKey": "76a914bdcb0540bd688340cdc774756c13072fd1deddf388ac",
"amount": 0.00002000,
"confirmations": 2,
"spendable": true,
"solvable": true,
"safe": true
}
]
D/t/bitcoin ╍
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge getbalance
0.00002000
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge listunspent
[
{
"txid": "1a1e5dfd4beb9a465b2a5a08649d8a05f9decf2c0802442a2a33e32ad4ec9a7c",
"vout": 1,
"address": "mxpVDRV1DtPEXBgYpZKzFLd7Cb8J42brkH",
"account": "hogechan",
"scriptPubKey": "76a914bdcb0540bd688340cdc774756c13072fd1deddf388ac",
"amount": 0.00002000,
"confirmations": 2,
"spendable": true,
"solvable": true,
"safe": true
}
]
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge settxfee 0.000001
true
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge getnewaddress
mfuZge5TddyDogndxEaECyCKJJbowQeX4h
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge setaccount mxpVDRV1DtPEXBgYpZKzFLd7Cb8J42brkH fugachan
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge listaccounts
{
"": 0.00000000,
"fugachan": 0.00002000,
"hogechan": 0.00000000
}
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge setaccount mxpVDRV1DtPEXBgYpZKzFLd7Cb8J42brkH hogechan
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge setaccount mfuZge5TddyDogndxEaECyCKJJbowQeX4h fugachan
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge listaccounts
{
"": 0.00000000,
"fugachan": 0.00000000,
"hogechan": 0.00002000
}
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge sendfrom hogechan mfuZge5TddyDogndxEaECyCKJJbowQeX4h 0.00001
5a71823f86b167c342f34c8c122a8e75ecf69e01b6e6aedecb9f2176b202622a
D/t/bitcoin ╍ bitcoin-cli -testnet -rpcuser=hoge -rpcpassword=hoge gettransaction 5a71823f86b167c342f34c8c122a8e75ecf69e01b6e6aedecb9f2176b202622a
{
"amount": 0.00000000,
"fee": -0.00001000,
"confirmations": 0,
"trusted": true,
"txid": "5a71823f86b167c342f34c8c122a8e75ecf69e01b6e6aedecb9f2176b202622a",
"walletconflicts": [
],
"time": 1511346082,
"timereceived": 1511346082,
"bip125-replaceable": "no",
"details": [
{
"account": "hogechan",
"address": "mfuZge5TddyDogndxEaECyCKJJbowQeX4h",
"category": "send",
"amount": -0.00001000,
"label": "fugachan",
"vout": 0,
"fee": -0.00001000,
"abandoned": false
},
{
"account": "fugachan",
"address": "mfuZge5TddyDogndxEaECyCKJJbowQeX4h",
"category": "receive",
"amount": 0.00001000,
"label": "fugachan",
"vout": 0
}
],
"hex": "02000000017c9aecd42ae3332a2a4402082ccfdef9058a9d64085a2a5b469aeb4bfd5d1e1a010000006b483045022100de0a47aef04da55f22015acf2108ab8c5c4a61708ba2a0b9dddaa0a94e039aac022001b68ea27db04a3e1c49e6ee2510638de78acf2ffae2cdae24f0bd335a78d9e2012102f71af1d1e81ff25e89c95ff5bdb2ceaeaef9933b6ca394ef51aaa4a1ebe4777cfeffffff01e8030000000000001976a9140446b1586509713ab539e8f39f6d61c3b4d0810c88acbcc91200"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment