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

81. Genarate rpcpassword
Bitcoin Core RPC Auth Config Generator
– username=eve
– password=keybordcat

rpcpassword=066cd0b2d3e0b355b1cad790be2b9b0c$f87e338d94e838afcdfbf8e09a0db34c9f12e11bea055b7d616ae14b70f5aee9

82. new login
– user04

$ pwd
/home/user04/

83. Make dir
– /home/user04
     |- dev
       |- eve

$ mkdir dev
$ mkdir dev/eve

84. Edit bitcoin.conf
– rpcuser=eve
– rpcpassword=066cd0b2d3e0b355b1cad790be2b9b0c$f87e338d94e838afcdfbf8e09a0db34c9f12e11bea055b7d616ae14b70f5aee9
– fallbackfee=0.002
– rpcport=10008

$ vi dev/eve/bitcoin.conf
regtest=1
txindex=1
server=1
rpcuser=eve
rpcpassword=066cd0b2d3e0b355b1cad790be2b9b0c$f87e338d94e838afcdfbf8e09a0db34c9f12e11bea055b7d616ae14b70f5aee9
fallbackfee=0.002

[regtest]
rpcport=10008

85. Start daemon
– eve side
– conf=/home/user04/dev/eve/bitcoin.conf
– datadir=./dev/eve/
– listen=0
– connect=127.0.0.1:10011

$ bitcoin-core.daemon -conf=/home/user04/dev/eve/bitcoin.conf -datadir=./dev/eve/  -listen=0 -connect=127.0.0.1:10011 

86. Restart daemon
– eve side
– Stop daemon
– start daemon

$  bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf -datadir=./eve/  stop
Bitcoin Core stopping
$
$ bitcoin-core.daemon -conf=/home/user04/dev/eve/bitcoin.conf -datadir=./dev/eve/ -listen=0 -connect=127.0.0.1:10011 

87. new login
– user04

$ pwd
/home/user02/

88. Create wallet

$ bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf  createwallet "EveWallet"
{
  "name": "EveWallet",
  "warning": ""
}

89. Get new address
– eve side

$ bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf  getnewaddress
bcrt1qhnt96hwgaknldamh4dq3sm5ehqr7nq4capdfg5

90. Balance ckeck
– eve side

$  bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf  getbalance
0.00000000

91. Tranfer from alice to eve
– alice side

$ bitcoin-core.cli -regtest  -rpcport=10001 -named sendtoaddress address="bcrt1qhnt96hwgaknldamh4dq3sm5ehqr7nq4capdfg5" amount=0.2 comment="drinks-101" comment_to="room101" subtractfeefromamount=false replaceable=true conf_target=null estimate_mode="unset" avoid_reuse=false fee_rate=1.1
90427f31cc602a5a139332b63fa93bc7479e4d5cdce6229f93c1ae42f4ed9cb1

92. Transaction check
– alice seice

$ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -rpcport=10001 gettransaction 90427f31cc602a5a139332b63fa93bc7479e4d5cdce6229f93c1ae42f4ed9cb1
{
  "amount": -0.20000000,
  "fee": -0.00002121,
  "confirmations": 1,
  "blockhash": "219f1db53010ad9efcfc206aac2b76f1c1d22a334fe8cd7ac90e0319b975c332",
  "blockheight": 5893,
  "blockindex": 1,
  "blocktime": 1660260392,
  "txid": "90427f31cc602a5a139332b63fa93bc7479e4d5cdce6229f93c1ae42f4ed9cb1",
  "walletconflicts": [
  ],
  "time": 1660260361,
  "timereceived": 1660260361,
  "bip125-replaceable": "no",
  "comment": "drinks-101",
  "to": "room101",
  "details": [
    {
      "address": "bcrt1qhnt96hwgaknldamh4dq3sm5ehqr7nq4capdfg5",
      "category": "send",
      "amount": -0.20000000,
      "vout": 0,
      "fee": -0.00002121,
      "abandoned": false
    }
  ],
  "hex": 省略
}

93. Mining
– alice seice

$ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -datadir=. -rpcport=10001  generatetoaddress 1 bcrt1qht58vxn8avnek2ya3wfpyv65qml9q7l5a6lpek
[
  "219f1db53010ad9efcfc206aac2b76f1c1d22a334fe8cd7ac90e0319b975c332"
]

94. Balance ckeck
– eve side

$  bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf getbalance
0.20000000

95. transaction check
– eve side

$  bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf  gettransaction 90427f31cc602a5a139332b63fa93bc7479e4d5cdce6229f93c1ae42f4ed9cb1
{
  "amount": 0.20000000,
  "confirmations": 1,
  "blockhash": "219f1db53010ad9efcfc206aac2b76f1c1d22a334fe8cd7ac90e0319b975c332",
  "blockheight": 5893,
  "blockindex": 1,
  "blocktime": 1660260392,
  "txid": "90427f31cc602a5a139332b63fa93bc7479e4d5cdce6229f93c1ae42f4ed9cb1",
  "walletconflicts": [
  ],
  "time": 1660260362,
  "timereceived": 1660260362,
  "bip125-replaceable": "no",
  "details": [
    {
      "address": "bcrt1qhnt96hwgaknldamh4dq3sm5ehqr7nq4capdfg5",
      "category": "receive",
      "amount": 0.20000000,
      "label": "",
      "vout": 0
    }
  ],
  "hex": 省略
}

96.Balance ckeck
– eve side

$  bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf  getbalance
0.80000000

97. Tranfer dave to eve
– dave side


$ bitcoin-core.cli -conf=/home/user03/dev/dave/bitcoin.conf-named sendtoaddress address="bcrt1qhnt96hwgaknldamh4dq3sm5ehqr7nq4capdfg5" amount=0.2 comment="drinks-103" comment_to="room103" subtractfeefromamount=false replaceable=true conf_target=null estimate_mode="unset" avoid_reuse=false
cb202b4b58c9c3377df5f6fdc75c281b266a76069efbdb5bbe8670f8736caceb

98. Mining
– alice side

$ bitcoin-core.cli -regtest -conf=/home/user02/dev/alice/bitcoin.conf -datadir=. -rpcport=10001  generatetoaddress 1 bcrt1qht58vxn8avnek2ya3wfpyv65qml9q7l5a6lpek
[
  "0de0c4368a3fd3d94db4451378fb0024856b1f90675f07809ba07f7556c5a43c"

99. Balance ckeck- eve side

$  bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf  getbalance
1.00000000

100. Trabsaction ckeck
– eve side

$  bitcoin-core.cli -conf=/home/user04/dev/eve/bitcoin.conf  gettransaction cb202b4b58c9c3377df5f6fdc75c281b266a76069efbdb5bbe8670f8736caceb
{
  "amount": 0.20000000,
  "confirmations": 1,
  "blockhash": "0de0c4368a3fd3d94db4451378fb0024856b1f90675f07809ba07f7556c5a43c",
  "blockheight": 5898,
  "blockindex": 1,
  "blocktime": 1660265828,
  "txid": "cb202b4b58c9c3377df5f6fdc75c281b266a76069efbdb5bbe8670f8736caceb",
  "walletconflicts": [
  ],
  "time": 1660265824,
  "timereceived": 1660265824,
  "bip125-replaceable": "no",
  "details": [
    {
      "address": "bcrt1qhnt96hwgaknldamh4dq3sm5ehqr7nq4capdfg5",
      "category": "receive",
      "amount": 0.20000000,
      "label": "",
      "vout": 1
    }
  ],
  "hex":省略
}

以上