CentOS stream 9: bitcoin-core の regtestで送金を行う その 5

43. user03でlogin
– /home/user03
     |- dev
       |- caril
|- dave

$ pwd
/home/user03 
$ mkdir dev
$ mkdir dev/carol
$ mkdir dev/dave

$ vi dev/carol/bitcoin.conf
regtest=1
txindex=1
server=1
rpcuser=carol
rpcpassword=keyboardcat 
$ vi dev/dave/bitcoin.conf
regtest=1
txindex=1
server=1
rpcuser=dave
rpcpassword=keyboardcat 

44. Start daemon

$ cd dev
$ bitcoin-core.daemon -regtest -conf=/home/user03/dev/carol/bitcoin.conf -datadir=./carol -rpcport=10003 -listen=0 -connect=127.0.0.1:10011 -fallbackfee=0.0002

45. Create CarillWallet

 bitcoin-core.cli -regtest  -datadir=. -rpcport=10003 createwallet "CarolWallet"
{
  "name": "CarolWallet",
  "warning": ""
}

46. carolのWalletのaddressを取得

$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -datadir=. -rpcport=10003 getnewaddress
bcrt1qhya07e4kejp7phxlnk7rckm5v9skh4jdzuesks
$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -datadir=. -rpcport=10003 getbalance
0.00000000

47.Stop daemon
– -conf=/home/user03/dev/carol/bitcoin.confが必要

$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 stop
Bitcoin Core stopping

48. Restart daemon

$ cd dev/carol
$ bitcoin-core.daemon -regtest -conf=/home/user03/dev/carol/bitcoin.conf -datadir=./carol -rpcport=10003 -listen=0 -connect=127.0.0.1:10011 -fallbackfee=0.0002

$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 loadwallet "CarolWallet" { "name": "CarolWallet", "warning": "" }

50. Carol’s balance

$  bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 getbalance
0.00000000

51. Transfer from alice to carol
– alice side

$ bitcoin-core.cli -regtest  -rpcport=10001 -named sendtoaddress address="bcrt1qhya07e4kejp7phxlnk7rckm5v9skh4jdzuesks" amount=0.1 comment="drinks-7" comment_to="room87" subtractfeefromamount=false replaceable=true conf_target=null estimate_mode="unset" avoid_reuse=false fee_rate=1.1
0bc95b6c07a7682529b5125a63818b2da78d39b36660c951a232309ef767743b

52. Mining on Alice’s side
– alice side

$ bitcoin-core.cli -regtest  -rpcport=10001  generatetoaddress 1 bcrt1qht58vxn8avnek2ya3wfpyv65qml9q7l5a6lpek
[
  "60fd79806eec0819bc90e4f76273fe6a6a9ffd07212775b85f536474956d3a7e"
]

53. Balance check and Transaction check
– carol side

$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 getbalance
0.10000000
$  bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 gettransaction 0bc95b6c07a7682529b5125a63818b2da78d39b36660c951a232309ef767743b
{
  "amount": 0.10000000,
  "confirmations": 1,
  "blockhash": "60fd79806eec0819bc90e4f76273fe6a6a9ffd07212775b85f536474956d3a7e",
  "blockheight": 5868,
  "blockindex": 1,
  "blocktime": 1660184525,
  "txid": "0bc95b6c07a7682529b5125a63818b2da78d39b36660c951a232309ef767743b",
  "walletconflicts": [
  ],
  "time": 1660184397,
  "timereceived": 1660184397,
  "bip125-replaceable": "no",
  "details": [
    {
      "address": "bcrt1qhya07e4kejp7phxlnk7rckm5v9skh4jdzuesks",
      "category": "receive",
      "amount": 0.10000000,
      "label": "",
      "vout": 0
    }
  ],
  "hex": 省略
}

54. Transaction check
– alice side

$ bitcoin-core.cli -regtest -rpcport=10001 gettransaction 0bc95b6c07a7682529b5125a63818b2da78d39b36660c951a232309ef767743b
{
  "amount": -0.10000000,
  "fee": -0.00002550,
  "confirmations": 1,
  "blockhash": "60fd79806eec0819bc90e4f76273fe6a6a9ffd07212775b85f536474956d3a7e",
  "blockheight": 5868,
  "blockindex": 1,
  "blocktime": 1660184525,
  "txid": "0bc95b6c07a7682529b5125a63818b2da78d39b36660c951a232309ef767743b",
  "walletconflicts": [
  ],
  "time": 1660184397,
  "timereceived": 1660184397,
  "bip125-replaceable": "no",
  "comment": "drinks-7",
  "to": "room87",
  "details": [
    {
      "address": "bcrt1qhya07e4kejp7phxlnk7rckm5v9skh4jdzuesks",
      "category": "send",
      "amount": -0.10000000,
      "vout": 0,
      "fee": -0.00002550,
      "abandoned": false
    }
  ],
  "hex": 省略
}

55. Transfer from bob to carol
– bob side
– Transfer 0.2/BTC from Bob to Carol

$ bitcoin-core.cli -regtest  -rpcport=10002 -named sendtoaddress address="bcrt1qhya07e4kejp7phxlnk7rckm5v9skh4jdzuesks" amount=0.2 comment="drinks-8" comment_to="room88" subtractfeefromamount=false replaceable=true conf_target=null estimate_mode="unset" avoid_reuse=false fee_rate=1.1
0f40a5ec89035150ffa2b9e841a1f464b252735ca0b265e417cd8d00d22032e3
$ bitcoin-core.cli -regtest -rpcport=10002 getbalance
2.59996007
$ bitcoin-core.cli -regtest -rpcport=10002 gettransaction 0f40a5ec89035150ffa2b9e841a1f464b252735ca0b265e417cd8d00d22032e3
{
  "amount": -0.20000000,
  "fee": -0.00000229,
  "confirmations": 0,
  "trusted": true,
  "txid": "0f40a5ec89035150ffa2b9e841a1f464b252735ca0b265e417cd8d00d22032e3",
  "walletconflicts": [
  ],
  "time": 1660186888,
  "timereceived": 1660186888,
  "bip125-replaceable": "yes",
  "comment": "drinks-8",
  "to": "room88",
  "details": [
    {
      "address": "bcrt1qhya07e4kejp7phxlnk7rckm5v9skh4jdzuesks",
      "category": "send",
      "amount": -0.20000000,
      "vout": 1,
      "fee": -0.00000229,
      "abandoned": false
    }
  ],
  "hex": "02000000000102eb3c02ef1b8ee9a1b5504c4da0c4d2938303c885187a16bbf5094c863062b5500000000000fdffffff5eea38933b2ce6aa3fd180f647d971bb962a678cdd0c5695b3a4f1401ede408d0000000000fdffffff02e786980000000000160014053d62c7429dce9646fe67ae38d503c1b4f97e61002d310100000000160014b93aff66b6cc83e0dcdf9dbc3c5b7461616bd64d0247304402206251c62abe56de4f87d01e68a2c8da8b878bbb2597191113c1303099c6aba83b0220021c99ea7f4dc423861402d0c368922689c209051af330032941e1d62b4c6d880121021553b22f990cf28a4c002f709d8498482163f3d2303ad4b1b3d08bc320c83c230247304402206f76da333ef98266df1af3505824c0389d93b32a71a1d28945f79d03c007c520022053bd6d46ef70d6e004e385a15c86d213d5afd3c7d36531d6fb904eacf397c85f0121021553b22f990cf28a4c002f709d8498482163f3d2303ad4b1b3d08bc320c83c23ec160000"
}

56. balance check

- carol side
$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 getbalance
0.10000000 

57. Mining on Bob’s side
– bob side

$ bitcoin-core.cli -regtest  -rpcport=10002  generatetoaddress 1 bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p
[
  "253adab491bc53fb45273dc725192650c44b22a32e109d9cd33d2f959c7ad670"
]

58. balance check

- carol side
$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 getbalance
0.30000000

59. Transfer from bob to carol
– bob side
– Transfer 0.2/BTC from Bob to Caro

$ bitcoin-core.cli -regtest  -rpcport=10002 -named sendtoaddress address="bcrt1qhya07e4kejp7phxlnk7rckm5v9skh4jdzuesks" amount=0.2 comment="drinks-9" comment_to="room89" subtractfeefromamount=false replaceable=true conf_target=null estimate_mode="unset" avoid_reuse=false fee_rate=1.1
ad45bf4d0f1fef2a33349a6ee5d09c45524fe4aa819d8f804548e2cdf62fbf3d

60. Mining on Alice’s side
– alice side

$ bitcoin-core.cli -regtest  -rpcport=10001  generatetoaddress 1 bcrt1qht58vxn8avnek2ya3wfpyv65qml9q7l5a6lpek
[
  "648c15f48bef5c4577264bf1ab8c1417c5b84f4b14a867c86faa05fd017f9d8a"
]

61. balance check
– carol side

$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 getbalance
0.50000000
$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 gettransaction ad45bf4d0f1fef2a33349a6ee5d09c45524fe4aa819d8f804548e2cdf62fbf3d
{
  "amount": 0.20000000,
  "confirmations": 1,
  "blockhash": "648c15f48bef5c4577264bf1ab8c1417c5b84f4b14a867c86faa05fd017f9d8a",
  "blockheight": 5870,
  "blockindex": 1,
  "blocktime": 1660188796,
  "txid": "ad45bf4d0f1fef2a33349a6ee5d09c45524fe4aa819d8f804548e2cdf62fbf3d",
  "walletconflicts": [
  ],
  "time": 1660188796,
  "timereceived": 1660188796,
  "bip125-replaceable": "no",
  "details": [
    {
      "address": "bcrt1qhya07e4kejp7phxlnk7rckm5v9skh4jdzuesks",
      "category": "receive",
      "amount": 0.20000000,
      "label": "",
      "vout": 1
    }
  ],
  "hex": "02000000000102dbc4f0973244b142380efb682ac634c6f9149a7b3a41148e95615faf49a596be0000000000fdffffffe33220d2008dcd17e465b2a05c7352b264f4a141e8b9a2ff50510389eca5400f0000000000fdffffff020286980000000000160014e1140e26cd777bbf0bc68643a488d7a01c4a3879002d310100000000160014b93aff66b6cc83e0dcdf9dbc3c5b7461616bd64d0247304402207b60067f00cd0eb41bfcde91e0d7f4723717e9f98366ad9a971c3869e51a109d02207ceb8f1d3ef7c2ae7b67dc9be9120bd0e7729096abdad1b34a5458cd85eca9830121021553b22f990cf28a4c002f709d8498482163f3d2303ad4b1b3d08bc320c83c230247304402207edd5956bea92b301f9fa45f405551b69832d21591f219d48d4aabad1ed4a44f02200d5a8e733275cdfc0b672e519f9a783111ab28651df9ad9b21c4627cf7cb6eda0121038189a50fc97a29db4c8dc48077f823f9281889421eda6f6d9a4c2565ebd61347ed160000"
}

62. Transfer from carol to bob
– carol side

$  bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 getbalance
0.49999844

63.Transfer from carol to bob

$ bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 -named sendtoaddress address="bcrt1qjyzl9tp964jqakvrmgm7n25fmdw4j950mvxr9p" amount=0.1 comment="drinks-8" comment_to="room88" subtractf
eefromamount=false replaceable=true conf_target=null estimate_mode="unset" avoid
_reuse=false fee_rate=1.1
7222ba1bcf902d98ad5fe41b4952ca453a1f527d70474c9cfd91d1321a21da3a
$  bitcoin-core.cli -regtest -conf=/home/user03/dev/carol/bitcoin.conf -rpcport=10003 getbalance
0.39999386

64. balance check
– bob side

$ bitcoin-core.cli -regtest -rpcport=10002 getbalance
2.39995778

65. Mining on Alice’s side
– alice side

$  bitcoin-core.cli -regtest  -rpcport=10001  generatetoaddress 1 bcrt1qht58vxn8avnek2ya3wfpyv65qml9q7l5a6lpek
[
  "301e134255d1ed09e3647e44e754df10a0432415140e88f516757acb83dc675f"
]

66. balance check
– bob side

$ bitcoin-core.cli -regtest -rpcport=10002 getbalance
2.49995778

-以上-