lnd version, "hacked" to enable seedless restore from xprv + scb
Go to file
Olaoluwa Osuntokun e22734f9cf
lnwallet: update HTLC+commitment scripts
This commit updates the previous HTLC and commitment scripts to their
current latest evolution.

The HTLC scripts have been optimized for space savings, the
functionality itself has remained relatively unchanged. A trade off was
made to add additional bytes into the sigScript in order to avoid
extraneous CHECKSIG’s. The rationale is that an extra 1-2 bytes in the
sigScript to guide execution, are worthwhile since they’re in the
witness, and witness data may be pruned in the near future.

The primary change is within the commitment transaction itself. Instead
of using revocation hashes, we now use signature based revocation. This
saves space in the Script, and optimizes away an extra hashing
operation. Elkrem/shachain is still used but, we now use the pre-images
to homomorphically derive a public key which the other party will be
able to sign with, once we disclose the pre-image itself.

Finally, we have switched to using SHA-256 everywhere uniformly for
both revocation hashes, and payment hashes. The rationale is that the
output of ripemd160 is too small for modern security margins, and that
other coins/chains are more likely to have SHA-256 implemented, than
ripemd160.

A set of tests has also been included which contain (mostly) exhaustive
tests of all possible redemption paths for both commitment and HTLC.
2016-06-27 11:35:32 -07:00
chainntfs chainntfs: include height in spending+conf notifications 2016-06-21 13:12:39 -07:00
channeldb channeldb: stored un-revoked hashes are now 32 bytes 2016-06-26 22:59:02 -07:00
cmd cmd/lncli: add json attribute tag for anonymous ChannelPoint struct 2016-06-22 21:48:39 -07:00
elkrem multi: change all imports to roasbeef's forks 2016-05-15 17:22:37 +03:00
lndc lndc: fix bug in pubkeyhash based authentication 2016-06-21 13:13:03 -07:00
lnrpc lnrpc: make remote_id and channel_point strings in ActiveChannel 2016-06-22 22:06:42 -07:00
lnstate multi: change all imports to roasbeef's forks 2016-05-15 17:22:37 +03:00
lnwallet lnwallet: update HTLC+commitment scripts 2016-06-27 11:35:32 -07:00
lnwire lnwire: add forgotten godoc comment for SFR 2016-06-21 13:13:10 -07:00
shachain multi: change all imports to roasbeef's forks 2016-05-15 17:22:37 +03:00
uspv uspv: update to new upstream btcd api to fix compile errors 2016-05-22 22:04:25 -07:00
.gitignore add testing sighash folder 2016-02-19 14:49:04 -08:00
.travis.yml Initial travis yml file 2016-06-21 13:12:21 -07:00
config.go lnd: make the http profiling server optional w/ a config param 2016-06-21 13:12:51 -07:00
doc.go add some daemon related skeleton files 2015-12-26 00:09:17 -06:00
fundingmanager.go lnd: implement open+close channel workflow in daemon 2016-06-21 13:14:05 -07:00
htlcswitch.go lnd: implement open+close channel workflow in daemon 2016-06-21 13:14:05 -07:00
LICENSE add copyright, license and discouragement in readme 2016-01-16 00:13:11 -08:00
lnd.go lnd: fix bug causing help (./lnd -h) to be printed twice 2016-06-21 13:12:55 -07:00
log.go lnd: create logger for fundingManger add closures 2016-06-21 13:13:53 -07:00
peer_test.go plasma: rough draft of peer struct 2015-12-20 15:16:38 -06:00
peer.go lnd: add support for channel state snapshots in peer 2016-06-22 22:22:09 -07:00
README.md Updating Readme with reference to Segnet4 instead of testnet-L 2016-05-10 18:32:11 +02:00
rpcserver.go lnd: list active channels in response to listpeers cmd 2016-06-22 22:22:44 -07:00
server.go lnd: implement open+close channel workflow in daemon 2016-06-21 13:14:05 -07:00
shell.go uspv: update to new upstream btcd api to fix compile errors 2016-05-22 22:04:25 -07:00
signal.go create signal.go to handle SIGINT's 2016-03-22 18:42:01 -07:00
version.go create version.go file 2016-03-22 18:40:54 -07:00

lnd - Lightning Network Daemon

This repo is preliminary work on a lightning network peer-to-peer node and wallet.

It's currently being tested on Segnet4, where malleability has been solved with segwit.

This version of Lnd is not yet fully-operational, but a proof of concept on Segnet4 will likely exist soon. The projection is it will be operational before the necessary malleability soft-forks are into bitcoin mainnet (may be significantly before if there are any delays in mainnet malleability fix).

Don't try to port it to mainnet or an altcoin and use it today! No really. Lightning transactions will be fast, but for now, please wait just a little bit.

Installation

  • If necessary, install Go according to the installation instructions here: http://golang.org/doc/install. It is recommended to add $GOPATH/bin to your PATH at this point.
  • Run the following command to obtain and install lnd, lncli, lnshell and all dependencies:
go get -u -v github.com/lightningnetwork/lnd/...

Packages and Utilities

chainntfs

A package centered around a generic interface for receiving transaction/confirmation based notifications concerning the blockchain. Such notifications are required in order for pending payment channels to be notified once the funding transaction gains a specified number of confirmations, and in order to catch a counter-party attempting a non-cooperative close using a past commitment transaction to steal funds.

At the moment, it only has a single concrete implementation: using btcd's websockets notifications. However, more implementations of the interface are planned, such as electrum, polling via JSON-RPC, Bitcoin Core's ZeroMQ notifications, and more.

channeldb

lnd's primary datastore. It uses a generic interface defined in walletdb allowing for usage of any storage backend which adheres to the interface. The current concrete implementation used is driven by bolt. channeldb is responsible for storing state such as meta-data concerning the current open channels, closed channels, past routes we used, fee schedules within the network, and information about remote peers (ID, uptime, reputation, etc).

cmd / lncli

A command line to query and control a running lnd. Similar to bitcoin-cli

cmd / lnshell

Interactive shell for commands to direct the lnd node. Will probably be merged into lnd soon as a command line option.

elkrem

Library to send and receive a tree structure of hashes which can be sequentially revealed. If you want to send N secrets, you only need to send N secrets (no penalty there) but the receiver only needs to store log2(N) hashes, and can quickly compute any previous secret from those.

This is useful for the hashed secrets in LN payment channels.

lndc

Library for authenticated encrypted communication between LN nodes. It uses chacha20_poly1305 for the symmetric cipher, and the secp256k1 curve used in bitcoin for public keys. No signing is used, only two ECDH calculations: first with ephemeral key pairs and second with persistent identifying public keys.

lnrpc

lnd's RPC interface. Currently gRPC, a high-performance RPC framework is used. gRPC provides features such as a stub-based client interface in several languages, streaming RPCs, payload agnostic request/response handling, and more. In addition to gRPC, lnd will also offer a basic REST-based http RPC interface. For now, connections are not encrypted, or authenticated. For authentication, macaroons will likely be integrated due to their simplicity, flexibility, and expressiveness.

lnstate

In-progress update which improves current implementation of channel state machine to allow for higher throughput.

lnwallet

An application specific, yet general Bitcoin wallet which understands all the fancy script, and transaction formats needed to transact on the Lightning Network. The interface, and interaction with the core wallet logic has been designed independent of any peer-to-peer communication. The goal is to make lnwallet self-contained, and easily embeddable within future projects interacting with the Lightning Network. The current state machine for channel updates is blocking, only allowing one pending update at a time. This will soon be replaced in favor of the highly concurrent, non-blocking state machine within lnstate.

lnwire

Library of messages for Lightning Network node to node communications. Messages for opening and closing channels, as well as updating and revoking channel states are described here.

shachain

An implementation of Rusty Russell's 64-dimensional shachain.

uspv

Wallet library to connect to bitcoin nodes and build a local SPV and wallet transaction state.