---
# System prepended metadata

title: 架設比特幣測試節點紀錄
tags: [BlockChain]

---

---
title: 架設比特幣測試節點紀錄
---
###### tags: `BlockChain`
# 架設比特幣測試節點紀錄

起
/home/ubuntu/omnicore-0.11.0/bin/omnicored -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf

停
/home/ubuntu/omnicore-0.11.0/bin/omnicored -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf stop

查
lsof -i:端口号

殺
lsof -P | grep 8332 | awk '{print $2}' | xargs kill -9

測
telnet 172.31.23.131 8332

conf檔官方說明:https://github.com/bitmartexchange/omni/blob/master/contrib/debian/examples/bitcoin.conf

conf
```
# 数据存储目录
# datadir=/data/omnicore/data
# 使用测试网络
testnet=1
# 告知 Bitcoin-Qt 和 bitcoind 接受JSON-RPC命令
server=1
# 后台执行
daemon=1
# 启用交易索引
txindex=1
# 连接节点相关
rest=1
rpcuser=admin
rpcpassword=admin
rpcallowip=0.0.0.0/0
rpcconnect=0.0.0.0/0
[test]
rpcport=8888
rpcbind=0.0.0.0
```

國內的配置檔
```
server=1
txindex=1
listen=0
rpcuser=admin
rpcpassword=admin
rpcallowip=0.0.0.0/0
rpcconnect=0.0.0.0/0
regtest=1
[regtest]
rpcport=8889
rpcbind=0.0.0.0
```

正式站配置
```
server=1
rpcbind=0.0.0.0
rpcuser=admin
rpcpassword=admin
rpcallowip=0.0.0.0/0
rpcport=8332
txindex=1
datacarriersize=80
logtimestamps=1
omnidebug=tally
omnidebug=packets
omnidebug=pending
daemon=1
rpcconnect=0.0.0.0/0
```

發送測試
/wwwroot/backend/chain$ curl http://172.31.23.131:8888

bitconre config generate: https://jlopp.github.io/bitcoin-core-config-generator/

testnet簡易操作範例:
---
https://www.jianshu.com/p/417c280b8f9f

比特幣及測試鏈查看:
---
https://live.blockcypher.com/btc-testnet/tx/30aa4a6efa4b692f1d879bfd15cd2da12d39b9413bf9e718251fb3e1d0136725/

### Omni操作：
1. 產生新地址： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf getnewaddress “ronnie”
2. 產出新區塊： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf generatetoaddress 3 "2Mw5zTUBqvst7HzZJ4qoF3zRwDaHyoV1aUK"
3. 查看挖礦資訊： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf getmininginfo
4. 取得私鏈、omni版本等資訊： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf getblockchaininfo
5. 查看餘額-omni幣種： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf omni_getbalance "2Mw5zTUBqvst7HzZJ4qoF3zRwDaHyoV1aUK" 1  #(properties id)
6. 查看錢包資訊-wallet： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf getwalletinfo
7. 查看餘額-wallet list unspent： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf bitcoin-cli listunspent
8. 轉帳： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf sendtoaddress "2MzWvwL1R3PAK8A1u8VsrioQZAAzuxEeJTJ" 0.1 "donation" "seans outpost"
9. 轉帳失敗遇到以下錯誤時：/home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf settxfee 0.0000100000
```
"error code: -4
error message:
Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee."
```
10. 
11. 創建錢包： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf createwallet "testwallet2"
12. 取消掛載某錢包： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf unloadwallet "testwallet"
13. 錢包列表： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf listwalletdir
14. 地址列表(限錢包中的地址？)： /home/ubuntu/omnicore-0.11.0/bin/omnicore-cli -conf=/home/ubuntu/omnicore-0.11.0/bitcoin.conf listaddressgroupings
15. 導出私鑰： ./omnicore-cli dumpprivkey "address"