Skip to content

Commit 6ea838c

Browse files
committed
Adding simnet instructions to docs/
1 parent e63c049 commit 6ea838c

File tree

2 files changed

+110
-1
lines changed

2 files changed

+110
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ If you want Prettier to help you by applying changes on save you have to change
3939

4040
### LND
4141

42-
We are using the [LND](https://github.com/lightningnetwork/lnd) REST [API](https://app.swaggerhub.com/apis/lnd-rest/rpc-proto/master)
42+
We are using the [LND](https://github.com/lightningnetwork/lnd) REST [API](https://app.swaggerhub.com/apis/lnd-rest/rpc-proto/master).
43+
44+
You can run your LND simnet following the instructions in the [docs](https://github.com/Learn-by-doing/lightning-extension/tree/master/docs) direcotry.

docs/simnet.md

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Run you LND with btcd simnet
2+
3+
Simnet is a development/test network run locally that allows us to generate blocks at will, so we can avoid the time-consuming process of waiting for blocks to arrive for any on-chain functionality.
4+
5+
## Install GO and LND
6+
7+
In order to work with [`lnd`](https://github.com/lightningnetwork/lnd), the following build dependencies are required:
8+
9+
- **Go:** `lnd` and `btcd` are written in Go. To install, run one of the following commands:
10+
11+
```
12+
sudo apt-get install golang-1.11-go
13+
```
14+
15+
And adding the environment variables to your user's .profile::
16+
17+
```
18+
export PATH=$PATH:/usr/local/go/bin
19+
export PATH=$PATH:$(go env GOPATH)/bin
20+
export GOPATH=$(go env GOPATH)
21+
```
22+
23+
- [`btcd`](https://github.com/btcsuite/btcd)
24+
Run the following commands to obtain btcd, all dependencies, and install it:
25+
26+
```bash
27+
go get -u github.com/Masterminds/glide
28+
git clone https://github.com/btcsuite/btcd $GOPATH/src/github.com/btcsuite/btcd
29+
cd $GOPATH/src/github.com/btcsuite/btcd
30+
glide install
31+
go install . ./cmd/...
32+
```
33+
34+
- [`lnd`](https://github.com/lightningnetwork/lnd)
35+
Run the following commands to obtain and install lnd:
36+
37+
```
38+
go get -d github.com/lightningnetwork/lnd
39+
cd $GOPATH/src/github.com/lightningnetwork/lnd
40+
make && make install
41+
```
42+
43+
Once you have `lnd` and `btcd` you can continue:
44+
45+
## Running simnet
46+
47+
```
48+
btcd --simnet --txindex --rpcuser=kek --rpcpass=kek
49+
```
50+
51+
## Run LND
52+
53+
```bash
54+
lnd --restlisten=localhost:8001 --datadir=~/.lnd/data --logdir=~/.lnd/log --debuglevel=info --bitcoin.simnet --bitcoin.active --bitcoin.node=btcd --btcd.rpcuser=kek --btcd.rpcpass=kek
55+
```
56+
57+
## Test if it works:
58+
59+
```bash
60+
lncli --macaroonpath=~/.lnd/data/chain/bitcoin/simnet/admin.macaroon getinfo
61+
```
62+
63+
## Use the REST API
64+
65+
```bash
66+
curl --insecure --header "Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 ~/.lnd/data/chain/bitcoin/simnet/admin.macaroon)" https://localhost:8001/v1/getinfo
67+
```
68+
69+
## How to get founds in your lnd wallet
70+
71+
- Get an address from your lnd wallet
72+
73+
```
74+
lncli --macaroonpath=~/.lnd/data/chain/bitcoin/simnet/admin.macaroon newaddress np2wkh
75+
```
76+
77+
It gives you an output like: `rd6y7jJVPHGUBxbGjXer8W4ycQgVNbFHPb`
78+
79+
## Assign the new created address as your mining address in btcd
80+
81+
```
82+
btcd --simnet --txindex --rpcuser=kek --rpcpass=kek --miningaddr=NEW_ADDRESS
83+
```
84+
85+
## Generate bloks using btcctl cli
86+
87+
```
88+
btcctl --simnet --rpcuser=kek --rpcpass=kek generate 100
89+
```
90+
91+
## Check your balance
92+
93+
Now you should have founds in your lnd wallet, test it with the command bellow:
94+
95+
```
96+
lncli --macaroonpath=~/.lnd/data/chain/bitcoin/simnet/admin.macaroon walletbalance
97+
```
98+
99+
It should output:
100+
101+
```
102+
{
103+
"total_balance": "5000000000",
104+
"confirmed_balance": "5000000000",
105+
"unconfirmed_balance": "0"
106+
}
107+
```

0 commit comments

Comments
 (0)