Para instalar se utilizo un Debian 9 64 bits recien instalado de "minimal iso".
Instalamos bitcoin-core
echo "unattended-upgrades unattended-upgrades/enable_auto_updates boolean true" | debconf-set-selections
apt-get -y install unattended-upgrades
wget https://bitcoin.org/bin/bitcoin-core-0.15.1/bitcoin-0.15.1-x86_64-linux-gnu.tar.gz
tar xfz bitcoin-0.15.1-x86_64-linux-gnu.tar.gz
install -m 755 -o root -g root -t /usr/local/bin/ bitcoin-0.15.1/bin/*
Creamos la configuracion inicial
mkdir ~/.bitcoin
cat >> ~/.bitcoin/bitcoin.conf << EOF
server=1
dbcache=1536
par=1
blocksonly=1
maxuploadtarget=137
maxconnections=16
rpcuser=bitcoinrpc
rpcpassword=$(xxd -l 16 -p /dev/urandom)
rpcallowip=127.0.0.1
testnet=1
prune=550
EOF
Arrancamos el cliente, va a empezar a descargar la cadena de bloques, limitada por el "prune"
bitcoind -daemon
Es importante abrir/redireccionar el port 18333/tcp (el de testnet) si esta detras de un firewall.
apt-get install git build-essential libgmp-dev libsqlite3-dev autoconf libtool
git clone https://github.com/ElementsProject/lightning.git
cd lightning
make
cp lightningd/lightningd /usr/local/bin/
cp lightningd/lightning_* /usr/local/bin/
cp cli/lightning-cli /usr/local/bin/
Arrancamos
lightningd --network=testnet --log-level=debug
Abrir/redireccionar el port 9735/tcp si esta detras de un firewall.
Generamos una direccion en testnet
$ bitcoin-cli getnewaddress
mqphi5Gu3i1uxHwpLZh7zq1RN8qFDpQeDg
Entramos a un sitio de faucet para enviar btc de prueba, ahi ingresan su direccion de wallet. https://testnet.manu.backend.hamburg/faucet
Una vez que recibimos algunas btc de prueba, podemos enviar a lightning, generamos la direccion de lightning
$ lightning-cli newaddr
2N4TYQXtaC1MPtRXbEX1qpzAM7D3ZsreHi8
Enviamos 0.1 btc a dicha direccion
$ bitcoin-cli sendtoaddress 2N4TYQXtaC1MPtRXbEX1qpzAM7D3ZsreHi8 0.1 lighting-test-001
91f7055f6d3427c0806384fb34713d625fbb0c8c8ec675f3ce8fdb3f045f7983
Esperamos un rato que se propague la transaccion, podemos listar los fondos.
lightning-cli listfunds
Nos conectamos a un canal
lightning-cli connect 03fdefe424b480b7d8f1a0b3dcb20f637ee56f330ee311402ad37049ebebce03f1 52.18.61.50 9735
Enviamos 50000 satoshis al canal
$ lightning-cli fundchannel 03fdefe424b480b7d8f1a0b3dcb20f637ee56f330ee311402ad37049ebebce03f1 50000
{ "tx" : "0200000000010183795f043fdb8fcef375c68e8c0cbb5f623d7134fb846380c027346d5f05f791010000001716001420f52d53d82569001a89d4d0218ccb8cd889d39bffffffff0250c3000000000000220020c6d4e040be229aeb14fa4ac7738e8c9fb39951b199172645ed03d7193861feaa6c9c970000000000160014791ae337cfb3a2d55c6e8abd4c113f36258f890c0247304402202400b29cf4100004129f967c85bbe51066c17745e45055405b789916201ba0af0220062697080e076709d197f3186f97c78389fd5da4ae07ade156df7de35a063b1d012102779470fa4466cbdacee257a6d1761eb351531c1036fe5ab2b9aa21f2ed1af35500000000", "txid" : "ad08987a5a9fe801a5f1814f0e48f57db99b7b079e0831bbb5f04ebab10e535f" }
Listamos el estado de los peers conectados
# lightning-cli listpeers
{ "peers" :
[
{ "id" : "03fdefe424b480b7d8f1a0b3dcb20f637ee56f330ee311402ad37049ebebce03f1", "connected" : true, "netaddr" :
[ "52.18.61.50:9735" ], "channels" :
[
{ "state" : "CHANNELD_AWAITING_LOCKIN", "owner" : "lightning_channeld", "funding_txid" : "ad08987a5a9fe801a5f1814f0e48f57db99b7b079e0831bbb5f04ebab10e535f", "msatoshi_to_us" : 50000000, "msatoshi_total" : 50000000, "dust_limit_satoshis" : 546, "max_htlc_value_in_flight_msat" : 18446744073709551615, "channel_reserve_satoshis" : 0, "htlc_minimum_msat" : 0, "to_self_delay" : 6, "max_accepted_htlcs" : 483 } ] } ] }