bitcoin 测试网络
准备好私钥的地址:
mhqJ6JzvRkz5UWzJYbZ8BQhMN5oh7hrKvL
cQX8wK433Lyk7ufBKBitRjvHSLmXBroun8c6dMNxC3TfMTRVd2Mi
miui1AaQ7kTp2zX52P5bHDktWv8fRhborb
cMekKdFzrbawcYNz4p4F4Y1nSZ3nwhaeRCTA6xK982sxDm1mnknk启动测试网络
./omnicored -testnet //启动测试网络
./omnicore-cli -rpcconnect=192.168.1.227 -rpcport=8332 -rpcuser=a -rpcpassword=a -testnet getblock “0000000000287bffd321963ef05feab753ebe274e1d78b2fd4e2bfe9ad3aa6f2” 根据区块hash查询区块
./omnicore-cli -rpcconnect=192.168.1.227 -rpcport=8332 -rpcuser=a -rpcpassword=a -testnet sendtoaddress “msXs2qaoPDwLRjGXWpCsUQVjhjCU5pJoEL” 0.001
一些命令
./omnicore-cli getblockhash 100 //按块号查询块hash
./omnicore-cli getbalance //查询余额
./omnicore-cli getblockcount //查询块数量
./omnicore-cli getblock 000000002ce019cc4a8f2af62b3ecf7c30a19d29828b25268a0194dbac3cac50
./omnicore-cli importprivkey cMekKdFzrbawcYNz4p4F4Y1nSZ3nwhaeRCTA6xK982sxDm1mnknk
./omnicore-cli sendtoaddress "msXs2qaoPDwLRjGXWpCsUQVjhjCU5pJoEL" 0.001 //发送交易
./omnicore-cli omni_getactivations
./omnicore-cli omni_getbalance miui1AaQ7kTp2zX52P5bHDktWv8fRhborb 31 //查询USDT余额
./omnicore-cli omni_getwalletbalances //查询余额1.首先要找到一个可花费交易ID
bitcoin-cli listunspent 0
0是指最低需要多少个确认的可花费交易,一般填1。
返回:
{
"txid": "b95295525022af2b757cf1a65a477928e52ea0ebe71111111111111111",
"vout": 2,
"address": "1EvCft26Vuzxcn9pX537475DVV7m8k9wB8",
"account": "nghiemvo-panda-miner",
"scriptPubKey": "76a91498a96c4e71ad6a3b22709a8797e9749455133bf988ac",
"amount": 0.59000000,
"confirmations": 441,
"spendable": true,
"solvable": true
},2.根据TX和VOUT创建一个原生交易
./omnicore-cli -testnet createrawtransaction '[{"txid":"41a10aeb8de6792d755d584e8571744dade766dade0b36d7ca3e996977a9a1c9","vout":2}]' '{"mhqJ6JzvRkz5UWzJYbZ8BQhMN5oh7hrKvL":0.001}'
返回:
0100000001c9a1a97769993ecad7360bdeda66e7ad4d7471854e585d752d79e68deb0aa1410200000000ffffffff01a0860100000000001976a914196843d91205b94253cd24446c67458c9df0977888ac000000003.对这个交易进行签名
./omnicore-cli -testnet signrawtransaction 0100000001c9a1a97769993ecad7360bdeda66e7ad4d7471854e585d752d79e68deb0aa1410200000000ffffffff01a0860100000000001976a914196843d91205b94253cd24446c67458c9df0977888ac00000000
返回:
{
"hex": "0100000001feea1cb9cf5970883e3e5700c0d9497c76ee1031b22c39f6365168edd38870d3010000006a473044022072b723202bf793fef13e3c6bcf3d9fcfdb1052b671d42f969835d843820c76b6022072402c9bc9a479c2dc1ee0411c4888c86a63413ba537ce8fc10690a69033add4012103678afd6819e63fc6add7d1ea80c19dcf7ee113a7afc30f6fe4c461ebb5597972ffffffff0160decb1d000000001976a914f92e1a97926d8e965291b486efb2116e7c5471f088ac00000000",
"complete": true
}4.向区块广播这笔交易
bitcoin-cli sendrawtransaction 0100000001feea1cb9cf5970883e3e5700c0d9497c76ee1031b22c39f6365168edd38870d3010000006a473044022072b723202bf793fef13e3c6bcf3d9fcfdb1052b671d42f969835d843820c76b6022072402c9bc9a479c2dc1ee0411c4888c86a63413ba537ce8fc10690a69033add4012103678afd6819e63fc6add7d1ea80c19dcf7ee113a7afc30f6fe4c461ebb5597972ffffffff0160decb1d000000001976a914f92e1a97926d8e965291b486efb2116e7c5471f088ac00000000
返回TX:
25604bb691a001e6b580bed61e5880ca283db805188589eac825ddf73f098eed
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 ancjf@163.com
文章标题:bitcoin 测试网络
本文作者:ancjf
发布时间:2018-07-29, 20:50:06
最后更新:2020-09-15, 08:17:26
原始链接:http://ancjf.com/2018/07/29/bitcoin-%E6%B5%8B%E8%AF%95%E7%BD%91%E7%BB%9C/版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。