Browse Source

multi: unify code blocks in READMEs

master
Oliver Gugger 3 years ago
parent
commit
02267565fe
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
  1. 4
      aezeed/README.md
  2. 4
      brontide/README.md
  3. 4
      chainntnfs/README.md
  4. 4
      channeldb/README.md
  5. 89
      docker/README.md
  6. 44
      lnrpc/README.md
  7. 4
      lnwallet/README.md
  8. 4
      lnwire/README.md
  9. 18
      macaroons/README.md
  10. 20
      mobile/README.md
  11. 4
      routing/README.md
  12. 4
      tor/README.md
  13. 4
      zpay32/README.md

4
aezeed/README.md

@ -13,8 +13,8 @@ user addresses. Additionally, BIP39 use a very weak [KDF](https://en.wikipedia.o
scrypt with modern parameters (n=32768, r=8, p=1). A set of benchmarks has
been added, on my laptop I get about 100ms per attempt):
```bash
⛰ go test -run=XXX -bench=.
```shell
go test -run=XXX -bench=.
goos: linux
goarch: amd64

4
brontide/README.md

@ -23,6 +23,6 @@ between network enabled programs.
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/brontide
```shell
go get -u github.com/lightningnetwork/lnd/brontide
```

4
chainntnfs/README.md

@ -25,6 +25,6 @@ implementation of the `ChainNotifier` interface depends on `btcd`.
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/chainntnfs
```shell
go get -u github.com/lightningnetwork/lnd/chainntnfs
```

4
channeldb/README.md

@ -19,6 +19,6 @@ node and channel announcements, outgoing payments, and invoices
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/channeldb
```shell
go get -u github.com/lightningnetwork/lnd/channeldb
```

89
docker/README.md

@ -31,7 +31,7 @@ next versions will use the started `btcd` bitcoin node in `testnet` and
In the workflow below, we describe the steps required to recreate the following
topology, and send a payment from `Alice` to `Bob`.
```
```text
+ ----- + + --- +
| Alice | <--- channel ---> | Bob | <--- Bob and Alice are the lightning network daemons which
+ ----- + + --- + create channels and interact with each other using the
@ -59,47 +59,46 @@ topology, and send a payment from `Alice` to `Bob`.
Start `btcd`, and then create an address for `Alice` that we'll directly mine
bitcoin into.
```bash
```shell
# Init bitcoin network env variable:
$ export NETWORK="simnet"
export NETWORK="simnet"
# Create persistent volumes for alice and bob.
$ docker volume create simnet_lnd_alice
$ docker volume create simnet_lnd_bob
docker volume create simnet_lnd_alice
docker volume create simnet_lnd_bob
# Run the "Alice" container and log into it:
$ docker-compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd
$ docker exec -i -t alice bash
docker-compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd
docker exec -i -t alice bash
# Generate a new backward compatible nested p2sh address for Alice:
alice$ lncli --network=simnet newaddress np2wkh
alice lncli --network=simnet newaddress np2wkh
# Recreate "btcd" node and set Alice's address as mining address:
$ MINING_ADDRESS=<alice_address> docker-compose up -d btcd
MINING_ADDRESS=<alice_address> docker-compose up -d btcd
# Generate 400 blocks (we need at least "100 >=" blocks because of coinbase
# block maturity and "300 ~=" in order to activate segwit):
$ docker exec -it btcd /start-btcctl.sh generate 400
docker exec -it btcd /start-btcctl.sh generate 400
# Check that segwit is active:
$ docker exec -it btcd /start-btcctl.sh getblockchaininfo | grep -A 1 segwit
docker exec -it btcd /start-btcctl.sh getblockchaininfo | grep -A 1 segwit
```
Check `Alice` balance:
```
alice$ lncli --network=simnet walletbalance
```shell
alice lncli --network=simnet walletbalance
```
Connect `Bob` node to `Alice` node.
```bash
```shell
# Run "Bob" node and log into it:
$ docker-compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd
$ docker exec -i -t bob bash
docker-compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd
docker exec -i -t bob bash
# Get the identity pubkey of "Bob" node:
bob$ lncli --network=simnet getinfo
bob ⛰ lncli --network=simnet getinfo
{
----->"identity_pubkey": "0343bc80b914aebf8e50eb0b8e445fc79b9e6e8e5e018fa8c5f85c7d429c117b38",
"alias": "",
@ -117,13 +116,13 @@ bob$ lncli --network=simnet getinfo
}
# Get the IP address of "Bob" node:
$ docker inspect bob | grep IPAddress
docker inspect bob | grep IPAddress
# Connect "Alice" to the "Bob" node:
alice$ lncli --network=simnet connect <bob_pubkey>@<bob_host>
alice lncli --network=simnet connect <bob_pubkey>@<bob_host>
# Check list of peers on "Alice" side:
alice$ lncli --network=simnet listpeers
alice lncli --network=simnet listpeers
{
"peers": [
{
@ -140,7 +139,7 @@ alice$ lncli --network=simnet listpeers
}
# Check list of peers on "Bob" side:
bob$ lncli --network=simnet listpeers
bob lncli --network=simnet listpeers
{
"peers": [
{
@ -158,15 +157,15 @@ bob$ lncli --network=simnet listpeers
```
Create the `Alice<->Bob` channel.
```bash
```shell
# Open the channel with "Bob":
alice$ lncli --network=simnet openchannel --node_key=<bob_identity_pubkey> --local_amt=1000000
alice lncli --network=simnet openchannel --node_key=<bob_identity_pubkey> --local_amt=1000000
# Include funding transaction in block thereby opening the channel:
$ docker exec -it btcd /start-btcctl.sh generate 3
docker exec -it btcd /start-btcctl.sh generate 3
# Check that channel with "Bob" was opened:
alice$ lncli --network=simnet listchannels
alice lncli --network=simnet listchannels
{
"channels": [
{
@ -193,31 +192,31 @@ alice$ lncli --network=simnet listchannels
```
Send the payment from `Alice` to `Bob`.
```bash
```shell
# Add invoice on "Bob" side:
bob$ lncli --network=simnet addinvoice --amt=10000
bob lncli --network=simnet addinvoice --amt=10000
{
"r_hash": "<your_random_rhash_here>",
"pay_req": "<encoded_invoice>",
}
# Send payment from "Alice" to "Bob":
alice$ lncli --network=simnet sendpayment --pay_req=<encoded_invoice>
alice lncli --network=simnet sendpayment --pay_req=<encoded_invoice>
# Check "Alice"'s channel balance
alice$ lncli --network=simnet channelbalance
alice lncli --network=simnet channelbalance
# Check "Bob"'s channel balance
bob$ lncli --network=simnet channelbalance
bob lncli --network=simnet channelbalance
```
Now we have open channel in which we sent only one payment, let's imagine
that we sent lots of them and we'd now like to close the channel. Let's do
it!
```bash
```shell
# List the "Alice" channel and retrieve "channel_point" which represents
# the opened channel:
alice$ lncli --network=simnet listchannels
alice lncli --network=simnet listchannels
{
"channels": [
{
@ -244,17 +243,17 @@ alice$ lncli --network=simnet listchannels
# Channel point consists of two numbers separated by a colon. The first one
# is "funding_txid" and the second one is "output_index":
alice$ lncli --network=simnet closechannel --funding_txid=<funding_txid> --output_index=<output_index>
alice lncli --network=simnet closechannel --funding_txid=<funding_txid> --output_index=<output_index>
# Include close transaction in a block thereby closing the channel:
$ docker exec -it btcd /start-btcctl.sh generate 3
docker exec -it btcd /start-btcctl.sh generate 3
# Check "Alice" on-chain balance was credited by her settled amount in the channel:
alice$ lncli --network=simnet walletbalance
alice lncli --network=simnet walletbalance
# Check "Bob" on-chain balance was credited with the funds he received in the
# channel:
bob$ lncli --network=simnet walletbalance
bob lncli --network=simnet walletbalance
{
"total_balance": "10000",
"confirmed_balance": "10000",
@ -270,7 +269,7 @@ In this section we will try to connect our node to the faucet/hub node
which we will create a channel with and send some amount of
bitcoins. The schema will be following:
```
```text
+ ----- + + ------ + (1) + --- +
| Alice | <--- channel ---> | Faucet | <--- channel ---> | Bob |
+ ----- + + ------ + + --- +
@ -297,21 +296,21 @@ bitcoins. The schema will be following:
First of all you need to run `btcd` node in `testnet` and wait for it to be
synced with test network (`May the Force and Patience be with you`).
```bash
```shell
# Init bitcoin network env variable:
$ NETWORK="testnet" docker-compose up
NETWORK="testnet" docker-compose up
```
After `btcd` synced, connect `Alice` to the `Faucet` node.
The `Faucet` node address can be found at the [Faucet Lightning Community webpage](https://faucet.lightning.community).
```bash
```shell
# Run "Alice" container and log into it:
$ docker-compose run -d --name alice lnd_btc; docker exec -i -t "alice" bash
docker-compose run -d --name alice lnd_btc; docker exec -i -t "alice" bash
# Connect "Alice" to the "Faucet" node:
alice$ lncli --network=testnet connect <faucet_identity_address>@<faucet_host>
alice lncli --network=testnet connect <faucet_identity_address>@<faucet_host>
```
After a connection is achieved, the `Faucet` node should create the channel
@ -332,6 +331,6 @@ production), outside of `docker-compose`, see the
[![Irc](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channels=lnd)
* How to see `alice` | `bob` | `btcd` logs?
```bash
docker-compose logs <alice|bob|btcd>
```shell
docker-compose logs <alice|bob|btcd>
```

44
lnrpc/README.md

@ -147,8 +147,8 @@ description):
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/lnrpc
```shell
go get -u github.com/lightningnetwork/lnd/lnrpc
```
## Generate protobuf definitions
@ -160,40 +160,42 @@ build. Just run the following command (requires `sudo` permissions and the tools
`make`, `go`, `wget` and `unzip` to be installed) from the repository's root
folder:
`./scripts/install_travis_proto.sh`
```shell
⛰ ./scripts/install_travis_proto.sh
```
### MacOS / Unix like systems
1. Download [v.3.4.0](https://github.com/google/protobuf/releases/tag/v3.4.0) of
`protoc` for your operating system and add it to your `PATH`.
For example, if using macOS:
```bash
$ curl -LO https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-osx-x86_64.zip
$ unzip protoc-3.4.0-osx-x86_64.zip -d protoc
$ export PATH=$PWD/protoc/bin:$PATH
```shell
curl -LO https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-osx-x86_64.zip
unzip protoc-3.4.0-osx-x86_64.zip -d protoc
export PATH=$PWD/protoc/bin:$PATH
```
2. Install `golang/protobuf` at version `v1.3.2`.
```bash
$ git clone https://github.com/golang/protobuf $GOPATH/src/github.com/golang/protobuf
$ cd $GOPATH/src/github.com/golang/protobuf
$ git reset --hard v1.3.2
$ make
```shell
git clone https://github.com/golang/protobuf $GOPATH/src/github.com/golang/protobuf
cd $GOPATH/src/github.com/golang/protobuf
git reset --hard v1.3.2
make
```
3. Install 'genproto' at commit `20e1ac93f88cf06d2b1defb90b9e9e126c7dfff6`.
```bash
$ go get google.golang.org/genproto
$ cd $GOPATH/src/google.golang.org/genproto
$ git reset --hard 20e1ac93f88cf06d2b1defb90b9e9e126c7dfff6
```shell
go get google.golang.org/genproto
cd $GOPATH/src/google.golang.org/genproto
git reset --hard 20e1ac93f88cf06d2b1defb90b9e9e126c7dfff6
```
4. Install `grpc-ecosystem/grpc-gateway` at version `v1.14.3`.
```bash
$ git clone https://github.com/grpc-ecosystem/grpc-gateway $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
$ cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
$ git reset --hard v1.14.3
$ go install ./protoc-gen-grpc-gateway ./protoc-gen-swagger
```shell
git clone https://github.com/grpc-ecosystem/grpc-gateway $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
git reset --hard v1.14.3
go install ./protoc-gen-grpc-gateway ./protoc-gen-swagger
```
5. Run [`gen_protos.sh`](https://github.com/lightningnetwork/lnd/blob/master/lnrpc/gen_protos.sh)

4
lnwallet/README.md

@ -21,6 +21,6 @@ with the interface.
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/lnwallet
```shell
go get -u github.com/lightningnetwork/lnd/lnwallet
```

4
lnwire/README.md

@ -13,6 +13,6 @@ protocol level.
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/lnwire
```shell
go get -u github.com/lightningnetwork/lnd/lnwire
```

18
macaroons/README.md

@ -98,13 +98,17 @@ default macaroons (`admin`, `invoice` and `readonly`) are not sufficient.
For example, a macaroon that is only allowed to manage peers with a default root
key `0` would be created with the following command:
`lncli bakemacaroon peers:read peers:write`
```shell
⛰ lncli bakemacaroon peers:read peers:write
```
For even more fine-grained permission control, it is also possible to specify
single RPC method URIs that are allowed to be accessed by a macaroon. This can
be achieved by passing `uri:<methodURI>` pairs to `bakemacaroon`, for example:
`lncli bakemacaroon uri:/lnrpc.Lightning/GetInfo uri:/verrpc.Versioner/GetVersion`
```shell
⛰ lncli bakemacaroon uri:/lnrpc.Lightning/GetInfo uri:/verrpc.Versioner/GetVersion
```
The macaroon created by this call would only be allowed to call the `GetInfo` and
`GetVersion` methods instead of all methods that have similar permissions (like
@ -132,11 +136,15 @@ To manage the root keys used by macaroons, there are `listmacaroonids` and
`deletemacaroonid` available through gPRC and command line.
Users can view a list of all macaroon root key IDs that are in use using:
`lncli listmacaroonids`
```shell
⛰ lncli listmacaroonids
```
And remove a specific macaroon root key ID using command:
`lncli deletemacaroonid root_key_id`
```shell
⛰ lncli deletemacaroonid root_key_id
```
Be careful with the `deletemacaroonid` command as when a root key is deleted,
**all the macaroons created from it are invalidated**.
**all the macaroons created from it are invalidated**.

20
mobile/README.md

@ -16,18 +16,18 @@ point.
#### falafel
Install [`falafel`](https://github.com/lightninglabs/falafel):
```
go get -u -v github.com/lightninglabs/falafel
```shell
go get -u -v github.com/lightninglabs/falafel
```
### Building `lnd` for iOS
```
make ios
```shell
make ios
```
### Building `lnd` for Android
```
make android
```shell
make android
```
`make mobile` will build both iOS and Android libs.
@ -52,15 +52,15 @@ Swift, add `--swift_out=.` and run `make rpc`.
Similar to lnd, subservers can be conditionally compiled with the build by
setting the tags argument:
```
make ios
```shell
make ios
```
To support subservers that have APIs with name conflicts, pass the "prefix"
flag. This will add the subserver name as a prefix to each method name:
```
make ios prefix=1
```shell
make ios prefix=1
```
### API docs

4
routing/README.md

@ -12,6 +12,6 @@ channel graph state.
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/routing
```shell
go get -u github.com/lightningnetwork/lnd/routing
```

4
tor/README.md

@ -16,6 +16,6 @@ onion services, asynchronous messages, etc.
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/tor
```shell
go get -u github.com/lightningnetwork/lnd/tor
```

4
zpay32/README.md

@ -17,6 +17,6 @@ to send.
## Installation and Updating
```bash
$ go get -u github.com/lightningnetwork/lnd/zpay32
```shell
go get -u github.com/lightningnetwork/lnd/zpay32
```

Loading…
Cancel
Save