- 運行全節點的用途: 1.挖礦 2.錢包 運行全節點,可以做關於btc的任何事情,例如創建錢包地址、管理錢包地址、發送交易、查詢全網的交易信息等等
- 選個節點錢包:bitcoind
1.配置文件:
~/.bitcoin/bitcoin.conf 文件配置
testnet=1 # 測試網絡 (同步快,17g左右)
server=1 #允許rpc訪問
daemon=1 #后台運行
datadir=/home/data #區塊存儲位置(硬盤要夠用)
walletnotify=sh /home/notify_btc/notify.sh %s #通知到賬
rpcallowip=116.247.112.151
rpcport=8332
rpcuser=bitcoinrpc
rpcpassword=123456
2.命令 bitcoin-cli getinfo
help ( "command" )
stop
getinfo
ping
getnettotals
getnetworkinfo
getpeerinfo
getconnectioncount
verifychain ( checklevel numblocks )
getaddednodeinfo dns ( "node" )
addnode "node" "add|remove|onetry"
3.獲取測試網絡的btc
https://testnet.manu.backend.hamburg/faucet
Linux 下運行 eth全節點:
有兩種選擇方案,官方的 go-ethereum 和 parity 兩個錢包選擇:
1. 下載安裝 go-ethereum
(需要安裝go環境,1.7版本以上)
git clone https://github.com/ethereum/go-ethereum.git
cd go-ethereum
make geth
make all
實驗了一把,發現國內go-ethereum同步非常慢,需要加入火星節點
2.parity:
運行命令:parity --config config.toml
#config.toml
[parity]
mode = "active"
chain = "mainnet"
light = false
base_path = "/home/parity/db"
[ui]
force = false
disable = false
port = 8180
interface = "all"
path = "$HOME/.local/share/io.parity.ethereum/signer"
[rpc]
#rpc相當於http接口,可通過http請求的形式與parity交互
#
disable = false
# # 是否關閉rpc接口
#
port = 8546
# # rpc接口的端口號
#
interface = "all"
apis = ["all","web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "traces", "rpc", "shh", "shh_pubsub"]
[websockets]
# # websockets是另一種與parity的交互形式,他能提供rpc不能提供的信息,比如能訂閱新的交易並收到推送。
# # 以下內容和rpc一致
disable = false
port = 39843
interface = "all"
使用web3.js python 或者rpc均可以和和區塊鏈節點進行交互