22. amountの金額を指定した金額で送金
– その2でのamountが変わるのが気になったので、sendtoaddress のargumentsを変更
– aruments 5. subtractfeefromamount true -> false
$ bitcoin-core.cli -regtest -datadir=. -rpcport=10001 sendtoaddress "bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p" 0.2 "drinks-2" "room79" false true null "unset" null 1.1 9ab701d8742c963f5e98d0f0e1a1a9512adf4a5b455a5ca1e02c067c6a070229
23. trnsaction result
– amount -0.20000000 で期待通り
– feeは若干上昇 0.00001910 >> 0.00002422
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -datadir=. -rpcport=10001 gettransaction "9ab701d8742c963f5e98d0f0e1a1a9512adf4a5b455a5ca1e02c067c6a070229" { "amount": -0.20000000, "fee": -0.00002422, "confirmations": 0, "trusted": true, "txid": "9ab701d8742c963f5e98d0f0e1a1a9512adf4a5b455a5ca1e02c067c6a070229", "walletconflicts": [ ], "time": 1660111252, "timereceived": 1660111252, "bip125-replaceable": "yes", "comment": "drinks-2", "to": "room79", "details": [ { "address": "bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p", "category": "send", "amount": -0.20000000, "vout": 0, "fee": -0.00002422, "abandoned": false } ], "hex": "0200000000011fc9a1bd2621fb1e8d4abbb4c7dffa708249c1ff438d9a51d780267fe042ad17320000000000fdffffff55e414173ed1b37710dd02cf77046df7937254e4517df02f3c7d9fd620f476810000000000fdffffff6e27a078d2da5304c65ab98556117c3bd89f8945b70dca8b1e7647d278d4b14b0000000000fdffffff808c6d0a9f812cad5b54149bf767321a5c068d89b710a217b52b6135bb6ad9e30000000000fdffffff55fe3de03add2d7291784efd81dd52f3b1112e449d7c74762d79917b579a14770000000000fdffffff5a1822e44bf3b898f7ebe1a03747ddb8397ece748ad371c9f11c6e67fcf7d4a10000000000fdffffff85581978b1d8dd36d3131de4c39b6064bb8cc43153c466b4ebf1b6b49b6a87c30000000000fdffffff59f78ab10ee05b1088001381ab292b121b240e0c11d077c6aa09bbaf722f6afa0000000000fdffffff57c9a9203747121c5c2068c5a44c26b47a80474cda204f2fc9a079ac16b748960000000000fdffffff66f0a0a6a85df7fdb227437ff40e3585362b35b1da269d48f28f01e6cad2b4430000000000fdffffff6f1ed3751a13676a57ffda7b6ce25cb74b380ed59084c9bed7b183f0704da1cd0000000000fdffffff64884d7f8ede9a9431da1099340c7ebd0d8af0de9303ee4438a7706fcdc6b13e0000000000fdffffff72ed10d4f58666239f591c39b9c3cd4b4830b65827429624cf7b969c6efc81720000000000fdffffff5f1443d0541dee0c6859bf7eac1e1ec588cd50b6b90b36e92b71f462bdb393710000000000fdffffff55b7d971be310c551a97267487fc387665abb2b0e4eebf77cde3c360e55c77630000000000fdffffff4cd20d972352ee1131d9f5c0d91258d804918a8460aad48b2eebb75f0ff5518c0000000000fdffffff6d3af3a0941ce09089e7ebbc9485789c69e314a1c1bc9d7d89707bd7542f85e50000000000fdffffff7b8f7cfe602956c7a60e4f3fe5701806d127ea43707129cc87c21b6d69b4cc870000000000fdffffff5487396f0bebe8715d69e335ffacf0f4b9f2ed04d04b00c74e21e8810f2f61560000000000fdffffff4f881b365bac1ca6788a030bae57a339f780b4b90df5d171d45f2d0e6f0467830000000000fdffffff625a00456ec8b6def2b1c2014801a6599fd3016a382917ec34e47ca58130eb6a0000000000fdffffff753873e703e5090cd2fa827ef98e8465ffcc5ca3f48185f751fc2d771a80a2e50000000000fdffffff55f0b5ab1923b93ddfbd051ba9ca9b3394476207d144dc2c6140dfe09f06ebf40000000000fdffffff418a88855cfee123599a82720d0e526afe1925fd291ba005047f69dd3eddb2220000000000fdffffff87259c582ce0e8bd045a9c0eed379ed73ae432a05daa475b065514042ab738510000000000fdffffff645ff0f2bb79e146a71f8250223873fd2aa781d434599400a84248f5f953fe190000000000fdffffff45e4ae1f20c9c890cd4ff37bd45cb2598eb1eead3828eab74273482342465f340000000000fdffffff80d566c0bdb9dc17c1fd20ce15f3728ebf516ce69bddfd31aaf7b1c430e5da9b0000000000fdffffff6e09958c0c2cb1543d1ebacfb3e63ff5929b09cab5928298d6e74e3683eee4cd0000000000fdffffff7b0c810293be87e75b90e2f0518f2defc9b99518f4d7f1c32c71b96c543f13f70000000000fdffffff1cd0ed6cd12b9629bcfa02e02b632191e440b38ec638b81fccf5509a3459aef30000000000fdffffff01002d3101000000001600149105f2ac25d5640ed983da37e9aa89db5d59168f0247304402200204bfa14d897b20b67f19771767557be6966fb644c118b1826d68b2a1162460022069bb0cd73fbbfc3f58bc176d4cf516e9361ec48b8ea04fcb9dbd0fcbe1722c60012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402203156d79d8360268c4e026c927a913f36658af2669c9b0271b0f2126458b05548022062cba7fed9cd9494c20ace9a0f54d94ada725567c3741ffddefef290fe5aafbb012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402203710ec333a8ac648e9681e2c1a782c47e88e56ae8c5fa777cc216101ef9b2c59022004c21cc8d6906cfe8ecaf88607f8906f8513452b16d44034f7d2b0c324117f89012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402201a4c63e24249d6001bbc218178a3a1e320871d6b69a0494dc19e92e632fbaac0022050666f1a5220686efc1a4ed51d86ff254b8bbd24923fe3f0aa17aaebaa90b148012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402202d913b97ea9fe1d7d71b82bb259687caed21b9f009bc85f98c9a191a75fed34f022041fdbea9266664f0d0036aa978eab5226c40312e0cda1d819d9ae06aa1411c18012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402206e78211db3bf0620212a34f0f475993d11bf62b03d245144378545e9b778350c02201942164a5d65bfd619ffa54bf79a71bf890616b825ade23f9979944d6fc83f3d012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402200d003fdb488dfe7769143fcc610770437bf91ea3b1bea0c0bd4b71bd9be5ad9602206142786978ba77b547d6ef619d94a858d444a8e3760217fa7b6c8fec4ff82026012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402202bc1a486d58306b7257d6f88789cbf41756a79137bacc1ef9a010898439c17d2022067b68672dae3009b0260930aed02092ba90d461be306b25363ef586fd78064a4012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d7289024730440220072cf2721218916e91f5740f8cf317bb5f94fd87d87f6d67f95f69e02927174f022072a12d1042d6d411533690c213ccd47991241e4efd2320c9581fb186fcc1f805012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402203944890e32952f5fb853eac0601187eddd440c96010afb5a2a458f7dd553dd90022021cff833864f58a05fe87d46d4a6a2fa6a833d2e62c6c2d2efe09b11093bc82e012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402203707f198f05f6818750850b29a327b5220e3266085b666c28ebe28779c36b63502204f25675333e0b36c7338a70142ceb3c26d6311b2e07d289b4c44d0e1d13e190b012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402207b59919aded9c5f3fe1152ad03e69760553bcf5810e946d29cbc86fbc361e361022036330b27b0633f5f4e04b7d28c88faa7ea7fdb936a2a38c029c2bc7b2b801298012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402207d89f3674630cb406d259bce152c92dfdbef8a71ca164a65eac3490a4c9f9e9f022030ca71d99636eb590cbecdea9dac4afa9d2ec36fc58cac937e130c3ded63922f012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402205befb588c0d54f26f526a8fbfc748851e39ea4bda9a41d74c148b8f7bbbbdb070220744440b9988d1bfe65680b0f07495546baebdd931d5b194b330cf30e784eb410012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402206caaeebfa8ac9dca4a06e0169b64f474463ab2d5bcff7c40c1bb3b2d0084497f02204999d61cdf10e42b0f42ea4e59f7ccfaa86010cca92e0c4e31ff0347d2d90873012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402205c18681fd6af443dda30eb88747918c91c4d6383ad8f6cb5a1397b94a8db97e302203c02984a8ca8ffdba09821f23ce9200003cdf7bcdbf01c9df2d03be40a6d86d6012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402202a9f9530c9cf3bd33898ff484cd696ad018bfa025bf02129516bf7f4452c37d8022031746f75379c81681171162fc4e794833a657776126104100d3e3fbfd09be83a012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402201d906099a55fd061ab27d085aa8c66ab1d36bfe5ccce551aa679a170262afbd1022034b818055a725fc2bbbc2fc9b330f8fbc62865473fbbabf9d567b1f1f4c73cda012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402201e043f8dd942555626798d42b5eb1542db0d81bd42531480940735e1d093631802204793493bacc507ba7f27614ed09ab03289d92ba439ec178ceeacb41fc5bd162e012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d728902473044022052388bd72744ac2fabaa9f03c3df6478ae91892598a0cb6a18669dead25dce7802202f0a6e9bbf972dadc23dca38c52362b3170f8b3a41de53abe64b7942a7a64267012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402207a6d6730672d41ce5b2ad103f33f8cd915ad9e76e6217f7670f48c8092585f100220314056f5250fa85e21fd2c40746a62d41a1f718910792d9e102d64e39cf06afc012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d7289024730440220074e656041b87cd23c70b7d9c3485ea2fa4e3ea59b9233a1722d6692aada4b7e02201dfb6fc7eada16b2ab88554c4fdff1430f4889b487ca5d4fc989e23af3473e66012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402204eecf8c555c45639afea97e8a81d371a4a9044057c19c78e7151751d1e4c7093022030d3d877f0f170de9b6d2a61673739e630d87f139ba039a8f0d0991cf6c85265012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d7289024730440220290611516adce56ba2edf805d739d1dd11ad9e593a723b981fb31a674c054ca702202a7a8b06bbc42b889f6f0f49bd82df40ce044ef1044ec5e751f886fb2ca80135012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d7289024730440220796aaf0a4fb066495f12eea7929dc1a12debd01573a9efaa1cd68d662c376a45022056ed910c54e627c11874778082a56d701ab43c55c451adc32d54210a685afa98012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d728902473044022071a1becd1b27b691d3e3bfce2a22cf352c73c7fdc8bce75148ef0048db2dcd3b02200821affd74397076548921653fbde4610a00fc6fe98445f7e1af39c93b26b6cc012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d728902473044022005665814e02ef66bec7dced9a6177574709e13a252c53394238d85c3213fa211022033720c3d5b3dac2d29b96728dcc52e971383010fd07f6d5c05ae0d67cc5a0b01012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d7289024730440220288048bec620c15221e81f185677e9feed516ebf9e6b9770b30cdc213bd2dec202201d755a359c8c701427167eca950348674f080dae330e061a2a446894d03c65a4012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72890247304402200b34de911bbda6e48065cfa77d9385f03a2d552d34f7981304d1820c60c509ff02202e97664abecce999ff3308417e543f30ed0c26a3cccc8b783774221b8f8bcb1f012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d728902473044022001e705d5d3d0c394aad9bca151d00567be14aa70920ac08ff46f8bade0c2621002200c0429fed6ae135b0a0dfafbe23dde84e3ce24353dd36111dbb758650c275c3a012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d728902463043021f74dfc7336880bf2f96bf02fe4b4ab0a7f0f951c48d389cd682c71e05878c8102203adb5461f981b1cd6c2949ba18b682c3f009bdd4f50ccae6d8c3912c670daedd012102a36ec1e6e326f4040ad5e86a4ba114d7d59b369e9fae5925bfb55bd1f53d72894e150000" }
24. Bob’s Balance
– Bob side
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/bob/bitcoin.conf -datadir=. -rpcport=10002 getbalance 0.29996236
25. マイニング実行
– sendtoaddress = false
– Alice side
bitcoin-core.cli -regtest -datadir=. -rpcport=10001 sendtoaddress "bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p" 0.2 "drinks-2" "room79" false true null "unset" null 1.1 9ab701d8742c963f5e98d0f0e1a1a9512adf4a5b455a5ca1e02c067c6a070229
26. Bob’s Balance
– Bob side
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/bob/bitcoin.conf -datadir=. -rpcport=10002 getbalance 0.49996236
27. Remittance result
– 差額 0.2/BTC で Bob に送金出来ている
0.49996236 - 0.29996236 = 0.2
28. Bob’s Balance
– Bob side
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/bob/bitcoin.conf -datadir=. -rpcport=10002 getbalance 1.29996236
29. -named でsendtoaddress を実行
– Alice side
$ bitcoin-core.cli -regtest -datadir=. -rpcport=10001 -named sendtoaddress address="bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p" amount=0.2 comment="drinks-4" comment_to="room82" subtractfeefromamount=false replaceable=true conf_target=null estimate_mode="unset" avoid_reuse=false fee_rate=25 2568a8916173bf624707c0f5622c15f927eb319fad37fe9fe7d871693024512b
30. listtransactions
– Alice side
$ bitcoin-core.cli -regtest -datadir=. -rpcport=10001 listtransactions [ ・・・ { "address": "bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p", "category": "send", "amount": -0.20000000, "vout": 0, "fee": -0.00003525, "confirmations": 0, "trusted": true, "txid": "2568a8916173bf624707c0f5622c15f927eb319fad37fe9fe7d871693024512b", "walletconflicts": [ ], "time": 1660116624, "timereceived": 1660116624, "bip125-replaceable": "yes", "comment": "drinks-4", "to": "room82", "abandoned": false } ]
31.マイニング実行
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -datadir=. -rpcport=10001 generatetoaddress 101 bcrt1qht58vxn8avnek2ya3wfpyv65qml9q7l5a6lpek
32. Bob’s Balance
– Bob side
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/bob/bitcoin.conf -datadir=. -rpcport=10002 getbalance 1.49996236
33. Remittance result
– 差額 0.2/BTC で Bob に送金出来ている
1.49996236 - 1.29996236 = 0.2
34. fallbackfee
・ sendtoaddress に fallbackfeeのargmentは無い
$ bitcoin-core.cli -regtest -datadir=. -rpcport=10001 -named sendtoaddress address="bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p" amount=0.2 comment="drinks-4" comment_to="room82" subtractfeefromamount=false replaceable=true conf_target=null estimate_mode="unset" avoid_reuse=false fee_rate=25 -fallbackfee=0.0002 error code: -8 error message: Unknown named parameter -fallbackfee
– allbackfee はdaemon 起動時のargument
35. transaction hash(txid)からblockhashを取得し、blockを求める
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -datadir=. -rpcport=10001 gettransaction 9ab701d8742c963f5e98d0f0e1a1a9512adf4a5b455a5ca1e02c067c6a070229 { "amount": -0.20000000, "fee": -0.00002422, "confirmations": 303, "blockhash": "1aec59e32608effc8a05296b9d413dac79ce42c4061e69f230da3c2d69dd941d", "blockheight": 5455, "blockindex": 1, "blocktime": 1660112034, "txid": "9ab701d8742c963f5e98d0f0e1a1a9512adf4a5b455a5ca1e02c067c6a070229", "walletconflicts": [ ], "time": 1660111252, "timereceived": 1660111252, "bip125-replaceable": "no", "comment": "drinks-2", "to": "room79", "details": [ { "address": "bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p", "category": "send", "amount": -0.20000000, "vout": 0, "fee": -0.00002422, "abandoned": false } ], "hex": 省略 } $ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -datadir=. -rpcport=10001 getblock 1aec59e32608effc8a05296b9d413dac79ce42c4061e69f230da3c2d69dd941d { "hash": "1aec59e32608effc8a05296b9d413dac79ce42c4061e69f230da3c2d69dd941d", "confirmations": 303, "height": 5455, "version": 536870912, "versionHex": "20000000", "merkleroot": "e5067b683c3f0941799418e638d71486610d028953caff5073b05f85010a27ac", "time": 1660112034, "mediantime": 1660109853, "nonce": 0, "bits": "207fffff", "difficulty": 4.656542373906925e-10, "chainwork": "0000000000000000000000000000000000000000000000000000000000002aa0", "nTx": 2, "previousblockhash": "288df875d0beffbfe8f1b8a1c2f43b6f742dd0719d8b7516133507922eb27b2f", "nextblockhash": "347e58f992669885ead411adba359a69c8b62725ad0349d269dda32755f34177", "strippedsize": 1527, "size": 4881, "weight": 9462, "tx": [ "6457fe31c285590cf6531864e21b5fafc5d7331c335e292349c9039bae9f50d6", "9ab701d8742c963f5e98d0f0e1a1a9512adf4a5b455a5ca1e02c067c6a070229" ] }
36. blockchainの状態を確認
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -datadir=. -rpcport=10001 getblockchaininfo { "chain": "regtest", "blocks": 5757, "headers": 5757, "bestblockhash": "02c98ca71ed6a99f60cee6802b263ffc2316b301686f1d80e1d4a56377ace139", "difficulty": 4.656542373906925e-10, "time": 1660116831, "mediantime": 1660116830, "verificationprogress": 1, "initialblockdownload": false, "chainwork": "0000000000000000000000000000000000000000000000000000000000002cfc", "size_on_disk": 1781445, "pruned": false, "warnings": "" }
37. walletの中身を確認
$ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -datadir=. -rpcport=10001 listaddressgroupings [ [ [ "bcrt1qqlz4ktlkd5askwd7f7fygxggyfv3qqul8cw3wh", 117.51746642 ], [ "bcrt1qht58vxn8avnek2ya3wfpyv65qml9q7l5a6lpek", 14830.98255472, "" ], [ "bcrt1qmppakf0lmwezdutdudma00p5lpadyslntda3l9", 0.00000000 ] ] ]
37. nodeの停止
$ pwd /home/user02/ $ bitcoin-core.cli -regtest -rpcport=10002 stop Bitcoin Core stopping
$ bitcoin-core.cli -regtest -rpcport=10001 stop
Bitcoin Core stopping