Open h4x3rotab opened 6 years ago
go install
Error message:
vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go:13:2: cannot find package "golang.org/x/sys/cpu" in any of:
.../gocode/src/github.com/shelvenzhou/lnd/vendor/golang.org/x/sys/cpu (vendor tree)
/usr/lib/go-1.10/src/golang.org/x/sys/cpu (from $GOROOT)
.../gocode/src/golang.org/x/sys/cpu (from $GOPATH)
This issue is caused by bad glide dependency handling. We don't know the root cause but there are a few workarounds you can try.
Option 1
Sometimes the following command can solve the problem completely:
glide cc # clear cache
glide update # update the dependencies
go install . ./cmd/... # try to build & install again
Option 2
If option 1 doesn't work, you may need to manually fix the bad file structure. The problem is that glide installed the dependency to a wrong directory. For example, golang.org/x/sys/cpu
is a part of the package golang.org/x/sys
, but if you check the content of the former directory, you will notice that glide actually downloaded the full package (x/sys
) to the subdirectory (x/sys/cpu
). We need to manually move the full package from the subdirectory to the root:
cp ./vendor/golang.org/x/sys/cpu/* ./vendor/golang.org/x/sys/
That's saying, each time when you get error like Cannot find package <dir>/golang.org/x/<pkg_name>/<subdir>
, you should copy the content from <subdir>
to <pkg_name>
.
lnd
Error:
unable to start wallet: Post http://localhost:18332: dial tcp [::1]:18332: connect: connection refused
unable to create chain control: Post http://localhost:18332: dial tcp [::1]:18332: connect: connection refused
Post http://localhost:18332: dial tcp [::1]:18332: connect: connection refused
Solution: lnd
tries to connect to core wallet via port 18332. So we should set the rpcport
to 18332 in $HOME/.bitcoingold/bitcoingold.conf
.
[lncli] rpc error: code = Unknown desc = not enough witness outputs to create funding transaction, need 0.1 BTC only have 0 BTC available
Only balance in SegWit addresses are usable to open a channel. You can check the balance of your witness wallets by:
lncli --no-macaroons walletbalance --witness_only
If your coins are in a non-segwit address, use sendcoins
to move the funds (known issue: #3).
[lncli] rpc error: code = Unavailable desc = transport is closing
It means lncli
can't connect to lnd
. Please check if lnd
is dead.
[lncli] rpc error: code = Internal desc = connection error: desc = "transport: authentication handshake failed: remote error: tls: handshake failure"
Delete tls.key
and tls.cert
under $HOME/.lnd
[lncli] rpc error: code = OutOfRange desc = EOF
LND doesn't have very well written error descriptions. A possible reason can be that the public key you specified in lncli connect
command doesn't match the actual public key. Please reply here if you find you can't connect to my node:
0260af55e51ebb4def6298fd26eba1101e4ede0b54ca76d268f2c5dd30f3d5faa9@45.56.84.44:9735
See also: https://github.com/lightningnetwork/lnd/issues/662
Macaroons are flexible authorization credentials. You can read more here - https://github.com/lightningnetwork/lnd/blob/master/docs/macaroons.md and here - https://ai.google/research/pubs/pub41892 .
$HOME/.lnd
lnd --no-macaroons
, this will just not validate any macaroons (should replace --no-macaroons on every call, but has to be tested). Optionally to avoid having any Macaroons put no-macaroons=true
in $HOME/.lnd/lnd.conf
$(xxd -ps -u -c 1000 $HOME/.lnd/admin.macaroon)
. It should be added to the header of the call as Grpc-Metadata-macaroon
lncli
is looking for /.lnd/admin.macaroon
by default (where the files are auto-generated), so using the lncli
from the console on the same machine works out of the box.Example of remote call
curl --insecure --header "Grpc-Metadata-macaroon: 0201036C6E6402A201030A105FFBF56A5B1BFB879FFD8497405F05E11201301A160A0761646472657373120472656164120577726974651A130A04696E666F120472656164120577726974651A160A076D657373616765120472656164120577726974651A170A086F6666636861696E120472656164120577726974651A160A076F6E636861696E120472656164120577726974651A140A05706565727312047265616412057772697465000006202CCDFA5E245E4B390BD7A75D46BF2E5CFFE2B4159C8F1821BDFDD201DE9" https://62---:53280/v1/getinfo
Response
{"identity_pubkey":"03ec6515bb79e6e277ea327157a3e1773a322949d50439f5b8187d8c4c80e8574b","alias":"03ec6515bb79e6e277ea","block_height":18628,"block_hash":"000755b3a9c88f33c0bca04d6de6dd49c51b380775d6693346f4f67532fa261c","synced_to_chain":true,"testnet":true,"chains":["bitcoingold"],"best_header_timestamp":"1531316384"}
Toubleshooting:
Error message:
Detected RPC server listening on publicly reachable interface 0.0.0.0:8080 with authentication disabled! Refusing to start with --no-macaroons specified.
There is public url and Macaroons are required. Check $HOME/.lnd/lnd.conf
for 'no-macaroons=true' and commet it out. Doing it will enable Macaroons for the lnd.
$HOME/.lnd
Start the lnd again, if the files are still missing - the wallet was created with no-macaroons=true
in $HOME/.lnd/lnd.conf
. Comment it out and delete '$HOME/.lnd/data'. It will force the lnd to create new macaroons and .db files on next start. NOTE: Deliting /data WILL DELETE THE WALLET TOO! (the wallet.db is stored there). After deleting it new wallet has to be created lncli create
.
Add the following items to the config file under [Application Options]
section.
You can choose your nick name and color for your node.
externalip=<your public ip address>
alias=<nickname of your node, up to 32 utf8 characters>
color=#1a3868
Caveat
Technical Preview 2 is our second preview version and is not fully functional, but is useful to demonstrate the progress of development.
Changelog
lncli queryroutes
issueStatus of this version
Code base: https://github.com/BTCGPU/lnd
Implementation Checklist
Have some fun
If you can set up a BTG LN node successfully, please connect to me:
0260af55e51ebb4def6298fd26eba1101e4ede0b54ca76d268f2c5dd30f3d5faa9@45.56.84.44:9735
. I will pay you a virtual coffee by testnet btg.Instructions (BTG testnet only)
This guide will help you compile your own LND for BTG and send / receive Lightning payments between LND nodes. Note that this guide is for testnet only. We use Ubuntu as the example environment.
Step 1: Run BTG core node on testnet
master
branch. Make sure zmq support is enabled.$HOME/.bitcoingold/bitcoingold.conf
. This is the default config file path for Linux builds. Please adjust if you are running on a different OS.bgoldd
daemon and fully sync to the testnet. You can check https://test-explorer.bitcoingold.org to ensure the node is at the right block height.Step 2: Install LND
Generally the instructions are similar to the official LND installation guide (link), but you need to use our repo
BTCGPU/lnd
instead of the original one.Install
golang-1.10-go
:apt
failed to find the package, tryapt update
Create Go's base directory
$HOME/gocode
(as an example) for source management and add the path to $PATH. If you put them in your.bashrc
they'll always be ready for you:Install LND
cannot find package "golang.org/x/sys/cpu"
, please check the Troubleshooting Section.You should now be able to use the command line tools
lnd
andlncli
.Step 3: Configure LND
After installing LND, we connect LND to the BTG core client
bgoldd
. Note that LND will try to read the rpc credentials and zmq ports from the default core node configuration at$HOME/.bitcoingold/bitcoingold.conf
.$HOME/.lnd/lnd.conf
; Disable macaroon authentication. Macaroons are used are bearer credentials to ; authenticate all RPC access. If one wishes to opt out of macaroons, uncomment ; the line below. ; no-macaroons=true
; Listen on port 9735 for incoming connections. listen=0.0.0.0:9735
[Bitcoingold] ; If the Bitcoingold chain should be active. Atm, only a single chain can be ; active. bitcoingold.active=1
; Use Bitcoingold's test network. bitcoingold.testnet=1
; Use the bgoldd back-end bitcoingold.node=bgoldd
Attempting automatic RPC configuration to bgoldd Automatically obtained bgoldd's RPC credentials 2018-06-18 03:14:54.363 [INF] LTND: Version 0.3.0-alpha 2018-06-18 03:14:54.363 [INF] CHDB: Checking for schema update: latest_version=0, db_version=0 2018-06-18 03:14:54.367 [INF] RPCS: password gRPC proxy started at 127.0.0.1:8080 2018-06-18 03:14:54.367 [INF] RPCS: password RPC server listening on 127.0.0.1:10009 2018-06-18 03:14:54.367 [INF] LTND: Waiting for wallet encryption password. Use
lncli create
to create wallet, orlncli unlock
to unlock already created wallet.lncli connect 027c1d5d710579c641f4e00d5ee770620bb8d4a8a4f5080008e32ba97f1e18245f@45.56.84.44:9735
{ "peers": [ { "pub_key": "036a5657e9a7fb5a5c2ed0dcc51558403e21f87192e0ed9d7beb42e2abd296f116", "address": "xx.xx.xx.xx:xxxx", "bytes_sent": "111", "bytes_recv": "111", "sat_sent": "0", "sat_recv": "0", "inbound": true, "ping_time": "367537" } ] }
{ "channel_point": "2fea431670516009900619d02d1e6b6b9f30ca31679852a28cb2209ea90c15e6:0" }
{ "channels": [ { "active": true, "remote_pubkey": "027c1d5d710579c641f4e00d5ee770620bb8d4a8a4f5080008e32ba97f1e18245f", "channel_point": "2fea431670516009900619d02d1e6b6b9f30ca31679852a28cb2209ea90c15e6:0", "chan_id": "19985822860574720", "capacity": "10000000", "local_balance": "9989140", "remote_balance": "0", "commit_fee": "10860", "commit_weight": "600", "fee_per_kw": "15000", "unsettled_balance": "0", "total_satoshis_sent": "0", "total_satoshis_received": "0", "num_updates": "0", "pending_htlcs": [ ], "csv_delay": 1201 } ] }
{ "r_hash": "...", "pay_req": "lntbtg12340n1pdnl4m6pp5jkzj644hz9atcu3lm2qdws7xz55wwpud9gxljwmenznrvxtpd9rsdp9wpshjgrdv5sxzgrkd9e8gatpdssxxmmxvejk2cqzys4h5kj0hun46sda4veetl7gnhvh7qdc0a5vsylwc8xv4x0jerr855jak26vd3j94yz3nluv27wpwhrer04fjkl0hwf4wd7ycp6kz8hyqqsmddnk" }
lncli closechannel --funding_txid 2fea431670516009900619d02d1e6b6b9f30ca31679852a28cb2209ea90c15e { "closing_txid": "f17f006e355ce0d7394808f8346b4dae978e54657f95be1a8838c8c29efc161f" }