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 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): been added, on my laptop I get about 100ms per attempt):
```bash ```shell
⛰ go test -run=XXX -bench=. go test -run=XXX -bench=.
goos: linux goos: linux
goarch: amd64 goarch: amd64

4
brontide/README.md

@ -23,6 +23,6 @@ between network enabled programs.
## Installation and Updating ## Installation and Updating
```bash ```shell
$ go get -u github.com/lightningnetwork/lnd/brontide 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 ## Installation and Updating
```bash ```shell
$ go get -u github.com/lightningnetwork/lnd/chainntnfs 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 ## Installation and Updating
```bash ```shell
$ go get -u github.com/lightningnetwork/lnd/channeldb 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 In the workflow below, we describe the steps required to recreate the following
topology, and send a payment from `Alice` to `Bob`. topology, and send a payment from `Alice` to `Bob`.
``` ```text
+ ----- + + --- + + ----- + + --- +
| Alice | <--- channel ---> | Bob | <--- Bob and Alice are the lightning network daemons which | Alice | <--- channel ---> | Bob | <--- Bob and Alice are the lightning network daemons which
+ ----- + + --- + create channels and interact with each other using the + ----- + + --- + 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 Start `btcd`, and then create an address for `Alice` that we'll directly mine
bitcoin into. bitcoin into.
```bash ```shell
# Init bitcoin network env variable: # Init bitcoin network env variable:
$ export NETWORK="simnet" export NETWORK="simnet"
# Create persistent volumes for alice and bob. # Create persistent volumes for alice and bob.
$ docker volume create simnet_lnd_alice docker volume create simnet_lnd_alice
$ docker volume create simnet_lnd_bob docker volume create simnet_lnd_bob
# Run the "Alice" container and log into it: # Run the "Alice" container and log into it:
$ docker-compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd docker-compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd
$ docker exec -i -t alice bash docker exec -i -t alice bash
# Generate a new backward compatible nested p2sh address for Alice: # 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: # 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 # Generate 400 blocks (we need at least "100 >=" blocks because of coinbase
# block maturity and "300 ~=" in order to activate segwit): # 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: # 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: Check `Alice` balance:
``` ```shell
alice$ lncli --network=simnet walletbalance alice lncli --network=simnet walletbalance
``` ```
Connect `Bob` node to `Alice` node. Connect `Bob` node to `Alice` node.
```bash ```shell
# Run "Bob" node and log into it: # Run "Bob" node and log into it:
$ docker-compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd docker-compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd
$ docker exec -i -t bob bash docker exec -i -t bob bash
# Get the identity pubkey of "Bob" node: # Get the identity pubkey of "Bob" node:
bob$ lncli --network=simnet getinfo bob ⛰ lncli --network=simnet getinfo
{ {
----->"identity_pubkey": "0343bc80b914aebf8e50eb0b8e445fc79b9e6e8e5e018fa8c5f85c7d429c117b38", ----->"identity_pubkey": "0343bc80b914aebf8e50eb0b8e445fc79b9e6e8e5e018fa8c5f85c7d429c117b38",
"alias": "", "alias": "",
@ -117,13 +116,13 @@ bob$ lncli --network=simnet getinfo
} }
# Get the IP address of "Bob" node: # Get the IP address of "Bob" node:
$ docker inspect bob | grep IPAddress docker inspect bob | grep IPAddress
# Connect "Alice" to the "Bob" node: # 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: # Check list of peers on "Alice" side:
alice$ lncli --network=simnet listpeers alice lncli --network=simnet listpeers
{ {
"peers": [ "peers": [
{ {
@ -140,7 +139,7 @@ alice$ lncli --network=simnet listpeers
} }
# Check list of peers on "Bob" side: # Check list of peers on "Bob" side:
bob$ lncli --network=simnet listpeers bob lncli --network=simnet listpeers
{ {
"peers": [ "peers": [
{ {
@ -158,15 +157,15 @@ bob$ lncli --network=simnet listpeers
``` ```
Create the `Alice<->Bob` channel. Create the `Alice<->Bob` channel.
```bash ```shell
# Open the channel with "Bob": # 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: # 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: # Check that channel with "Bob" was opened:
alice$ lncli --network=simnet listchannels alice lncli --network=simnet listchannels
{ {
"channels": [ "channels": [
{ {
@ -193,31 +192,31 @@ alice$ lncli --network=simnet listchannels
``` ```
Send the payment from `Alice` to `Bob`. Send the payment from `Alice` to `Bob`.
```bash ```shell
# Add invoice on "Bob" side: # 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>", "r_hash": "<your_random_rhash_here>",
"pay_req": "<encoded_invoice>", "pay_req": "<encoded_invoice>",
} }
# Send payment from "Alice" to "Bob": # 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 # Check "Alice"'s channel balance
alice$ lncli --network=simnet channelbalance alice lncli --network=simnet channelbalance
# Check "Bob"'s channel balance # 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 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 that we sent lots of them and we'd now like to close the channel. Let's do
it! it!
```bash ```shell
# List the "Alice" channel and retrieve "channel_point" which represents # List the "Alice" channel and retrieve "channel_point" which represents
# the opened channel: # the opened channel:
alice$ lncli --network=simnet listchannels alice lncli --network=simnet listchannels
{ {
"channels": [ "channels": [
{ {
@ -244,17 +243,17 @@ alice$ lncli --network=simnet listchannels
# Channel point consists of two numbers separated by a colon. The first one # Channel point consists of two numbers separated by a colon. The first one
# is "funding_txid" and the second one is "output_index": # 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: # 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: # 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 # Check "Bob" on-chain balance was credited with the funds he received in the
# channel: # channel:
bob$ lncli --network=simnet walletbalance bob lncli --network=simnet walletbalance
{ {
"total_balance": "10000", "total_balance": "10000",
"confirmed_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 which we will create a channel with and send some amount of
bitcoins. The schema will be following: bitcoins. The schema will be following:
``` ```text
+ ----- + + ------ + (1) + --- + + ----- + + ------ + (1) + --- +
| Alice | <--- channel ---> | Faucet | <--- channel ---> | Bob | | 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 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`). synced with test network (`May the Force and Patience be with you`).
```bash ```shell
# Init bitcoin network env variable: # Init bitcoin network env variable:
$ NETWORK="testnet" docker-compose up NETWORK="testnet" docker-compose up
``` ```
After `btcd` synced, connect `Alice` to the `Faucet` node. 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). 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: # 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: # 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 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) [![Irc](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channels=lnd)
* How to see `alice` | `bob` | `btcd` logs? * How to see `alice` | `bob` | `btcd` logs?
```bash ```shell
docker-compose logs <alice|bob|btcd> docker-compose logs <alice|bob|btcd>
``` ```

44
lnrpc/README.md

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

4
lnwire/README.md

@ -13,6 +13,6 @@ protocol level.
## Installation and Updating ## Installation and Updating
```bash ```shell
$ go get -u github.com/lightningnetwork/lnd/lnwire 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 For example, a macaroon that is only allowed to manage peers with a default root
key `0` would be created with the following command: 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 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 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: 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 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 `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. `deletemacaroonid` available through gPRC and command line.
Users can view a list of all macaroon root key IDs that are in use using: 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: 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, 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 #### falafel
Install [`falafel`](https://github.com/lightninglabs/falafel): Install [`falafel`](https://github.com/lightninglabs/falafel):
``` ```shell
go get -u -v github.com/lightninglabs/falafel go get -u -v github.com/lightninglabs/falafel
``` ```
### Building `lnd` for iOS ### Building `lnd` for iOS
``` ```shell
make ios make ios
``` ```
### Building `lnd` for Android ### Building `lnd` for Android
``` ```shell
make android make android
``` ```
`make mobile` will build both iOS and Android libs. `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 Similar to lnd, subservers can be conditionally compiled with the build by
setting the tags argument: setting the tags argument:
``` ```shell
make ios make ios
``` ```
To support subservers that have APIs with name conflicts, pass the "prefix" 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: flag. This will add the subserver name as a prefix to each method name:
``` ```shell
make ios prefix=1 make ios prefix=1
``` ```
### API docs ### API docs

4
routing/README.md

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

4
tor/README.md

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

4
zpay32/README.md

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

Loading…
Cancel
Save