Git Product home page Git Product logo

bitcoind-lnd's Introduction

Regtest

docker-compose up -d

then restart lnd container, because btc container now is initialised and lnd now can connect to btc

docker-compose restart lnd
Connect to lnd
docker exec -i -t lnd bash
check wallet ballance

$lnd lncli -n=regtest walletbalance

{
    "total_balance": "0",
    "confirmed_balance": "0",
    "unconfirmed_balance": "0"
}
get wallet address

$lnd lncli -n=regtest newaddress np2wkh

{
    "address": "2NC4FMaJmgoXF6EPodAwokdEeMxFnNgerom"
}

Connect to btc

In new terminal window

docker exec -i -t btc bash
check balance

$btc bitcoin-cli getwalletinfo

Mine some bitcoins

generate 400 blocks

$btc bitcoin-cli generate 400

check balance

$btc bitcoin-cli getwalletinfo

Send bitcoin to LN wallet

$btc bitcoin-cli sendtoaddress 2NC4FMaJmgoXF6EPodAwokdEeMxFnNgerom 1 "My first Bitcoin"

Check LN wallet balance in lnd terminal

$lnd lncli -n=regtest walletbalance

{
    "total_balance": "100000000",
    "confirmed_balance": "0",
    "unconfirmed_balance": "100000000"
}
Generate 1 bock on btc

$btc bitcoin-cli generate 1

Check LN wallet balance

$lnd lncli -n=regtest walletbalance

{
    "total_balance": "100000000",
    "confirmed_balance": "100000000",
    "unconfirmed_balance": "0"
}

So we have a bitcoin in our LN wallet, lets open some channels.. Or first create two more lnd nodes - Alice and Bob

docker-compose -f docker-compose.yaml -f docker-compose-alice.yaml run -d --name alice -p 10010:10009 -p 9010:9735 lnd
docker-compose -f docker-compose.yaml -f docker-compose-bob.yaml run -d --name bob -p 10011:10009 -p 9011:9735 lnd
Alice

New terminal

docker exec -i -t alice bash

$bob lncli -n=regtest walletbalance

$bob lncli -n=regtest newaddress np2wkh

copy bobs Alices address

BTC container

$btc bitcoin-cli sendtoaddress ALICE_ADDRESS 1 "Alices first Bitcoin"

$btc bitcoin-cli generate 1

$bob lncli -n=regtest walletbalance

Now Bob have 1 bitcoin ;)

Bob

New terminal

docker exec -i -t bob bash

$bob lncli -n=regtest walletbalance

$bob lncli -n=regtest newaddress np2wkh

copy Bobs btc address

BTC container

$btc bitcoin-cli sendtoaddress BOBS_ADDRESS 1 "Bobs first Bitcoin"

$btc bitcoin-cli generate 1

$bob lncli -n=regtest walletbalance

Now Alice have 1 bitcoin ;)

We have 3 lnd nodes lnd | bob | alice

Now we can make channels...

Bitcoind + LND setup for testnet

Find replace all regtest -> testnet in docker-compose and lnd.conf, bitcoin.conf files

Docker setup to create bictoind and LND containers work together, to create Lightning network.

  • Edit bitcoind/bitcoin.conf and lnd/lnd.conf with your settings and just docker-compose up -d should work

  • If you'd like to stop just one of the services (btc or lnd containers), use docker-compose stop lnd and then use the command docker-compose up -d --build lnd to start it again

  • If you've made changes to any of the files and need to rebuild just one of the containers, use docker-compose up -d --build lnd

After blockchain is synced

After containers are started for the first time, let btc sync with blockchain (that may take a while ~27GB for testnet). After that you need:

  • create lightning wallet with command docker-compose exec lnd lncli -n=testnet create

  • Unlock walet use command docker-compose exec lnd lncli -n=testnet unlock

bitcoind-lnd's People

Contributors

cherijs avatar rubenwaterman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.