bitcoin: 部署闪电网络

bitcoin: 部署闪电网络_第1张图片

安装闪电网络, 需要先安装bitcoin

安装bitcoin依赖

sudo apt-get install -y autoconf automake build-essential git libtool libgmp-dev libsqlite3-dev net-tools

安装bitcoin

通过ubuntu PPA

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install -y bitcoind

检查下安装好了没? which bitcoind
如果想亲自体验编译过程, 请戳 https://www.jianshu.com/p/660601be4681

运行bitcoin节点

bitcoind -daemon # 启动守护进程

bitcoin-cli getblockcount #是否已经运行

安装闪电网络依赖

sudo apt-get install -y \
  autoconf automake build-essential git libtool libgmp-dev \
  libsqlite3-dev net-tools libsodium-dev

编译闪电网络

git clone https://github.com/ElementsProject/lightning.git
cd lightning
make -j3 # 编译

运行闪电网络

./lightningd/lightningd --network bitcoin --log-level debug

./cli/lightning-cli help

lightning-cli 命令

./cli/lightning-cli connect 02f6725f9c1c40333b67...... 104.198.32.198 9735 # 链接

# { "id" : "......" }

./cli/lightning-cli newaddr #新地址
{ "address" : "3Ktzn15gwJL......" }

./cli/lightning-cli listpeers

{
  "peers": [
    {
      "state": "GOSSIPING",
      "id": "02f6725f9c1c40333b67......",
      "netaddr": [
        "104.198.32.198:9735"
      ],
      "connected": true,
      "owner": "lightning_gossipd"
    }
  ]
}


./cli/lightning-cli listchannels

闪电网络的不同语言版本

C: https://github.com/ElementsProject/lightning
Golang: https://github.com/lightningnetwork/lnd
Scala: https://github.com/ACINQ/eclair

更多资料: https://github.com/bcongdon/awesome-lightning-network


参考:
https://blockstream.com/2018/02/02/lightning-instant-bitcoin-transacting-tutorial.html 有操作视频
https://shimo.im/docs/9IhYT9ZV8EM5s46s # 用docker运行闪电网络
https://steemit.com/cn/@skenan/1 #同上

你可能感兴趣的:(bitcoin: 部署闪电网络)