# [[lnd]]+[[bitcoind]] [[Testnet]] Setup ## Steps ### Build [[bitcoind]] https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md ### Build [[lnd]] https://github.com/lightningnetwork/lnd/blob/master/docs/INSTALL.md#building-a-development-version-from-source https://docs.lightning.engineering/lightning-network-tools/lnd/get-started-with-lnd#installing-lnd-from-source ### [[bitcoind]] Configuration Bitcoind - rpcuser= Username for RPC connections. It must match the username provided earlier in the Bitcoind configuration, or the username set in rpcauth - rpcpassword= Password for RPC connections. It must match the password set in the Bitcoind configuration file or the password obtained through rpcauth. - zmqpubrawblock= The address listening for ZMQ connections to deliver raw block notifications - zmqpubrawtx= The address listening for ZMQ connections to deliver raw transaction notifications - rpchost= (Optional) The daemon's rpc listening address. If a port is omitted, then the default port for the selected chain parameters will be used. (default: localhost) ```text chain=test datadir=/Volumes/WD5/Bitcoin server=1 disablewallet=1 timeout=6000 # rpchost=127.0.0.1:8332 rpcuser=test_user rpcpassword=al0ngAsshexpasswordsntahoeusnhaousnthaoeu prune=0 txindex=1 zmqpubrawblock=tcp://127.0.0.1:18500 zmqpubrawtx=tcp://127.0.0.1:18501 dbcache=5423 ``` Example `bitcoin.conf` https://github.com/bitcoin/bitcoin/blob/master/share/examples/bitcoin.conf ### [[lnd]] Configuration Example `lnd.conf` https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf Instructions: https://docs.lightning.engineering/lightning-network-tools/lnd/get-started-with-lnd#installing-lnd-from-source ```text # [lnd application] debuglevel=info # Auto-unlock & no macaroons - it's just a testnet node wallet-unlock-password-file=/Users/fang/Library/Application Support/Lnd/password.txt no-macaroons=true # [bitcoind] bitcoin.active=1 bitcoin.testnet=true bitcoin.node=bitcoind # bitcoind.rpchost=127.0.0.1:8332 bitcoind.rpcuser=test_user bitcoind.rpcpass=a0c4f5684867a625d228ab123c347816b271c1fd964d21210a27ef8f2a7ba9c8 bitcoind.zmqpubrawblock=tcp://127.0.0.1:18500 bitcoind.zmqpubrawtx=tcp://127.0.0.1:18501 # Make node available as a routing node listen=0.0.0.0:9735 listen=[::1]:9736 # listen=127.0.0.1:9735 ``` ### Start [[bitcoind]] ```bash cd /Users/fang/bitcoin/bitcoin ./src/bitcoind ``` ### Start [[lnd]] ```bash # At any location, but might as well go to ~/lightning/lnd lnd lncli create # only on the first time lncli unlock # afterwards ``` To avoid needing to type in a password every time during development (on testnet / regtest), follow the instructions here: ![[lnd#Auto-unlocking a wallet]] ### Test that [[lnd]] has been configured correctly ```bash lncli getinfo ``` ## Open a testnet channel / get coins ### Open permanent connection to the testnet Lightning faucet https://faucet.lightning.community/ ```bash lncli connect --perm 0270685ca81a8e4d4d01beec5781f4cc924684072ae52c507f8ebe9daf0caaab7b@159.203.125.125 ``` ### Open channel https://faucet.lightning.community/ - In UI, set channel amount to 100,000 sats - Set initial balance to 50,000 sats The channel will be open after the channel open transaction has three confirmations. Check on pending channel status: ```bash lncli pendingchannels ```