# README
lnwire
The lnwire package implements the Lightning Network wire protocol.
This package has intentionally been designed so it can be used as a standalone package for any projects needing to interface with lightning peers at the wire protocol level.
Installation and Updating
$ go get -u github.com/lightningnetwork/lnd/lnwire
# Functions
NewAlias create the alias from string and also checks spec requirements.
NewCloseComplete creates a new empty CloseComplete message.
NewCloseRequest creates a new CloseRequest.
NewCommitSig creates a new empty CommitSig message.
NewErrorGeneric creates a new ErrorGeneric message.
NewFeatureVector creates new instance of feature vector.
NewFeatureVectorFromReader decodes the feature vector from binary representation and creates the instance of it.
NewFundingLocked creates a new FundingLocked message, populating it with the necessary IDs and revocation secret..
NewInitMessage creates new instance of init message object.
NewPing returns a new Ping message binded to the specified nonce.
NewPong returns a new Pong message binded to the specified nonce.
NewRevokeAndAck creates a new RevokeAndAck message.
NewShortChanIDFromInt returns a new ShortChannelID which is the decoded version of the compact channel ID encoded within the uint64.
NewSingleFundingComplete creates, and returns a new empty SingleFundingResponse.
NewSingleFundingRequest creates, and returns a new empty SingleFundingRequest.
NewSingleFundingResponse creates, and returns a new empty SingleFundingResponse.
NewSingleFundingSignComplete creates a new empty SingleFundingSignComplete message.
NewUpdateAddHTLC returns a new empty UpdateAddHTLC message.
NewUpdateFufillHTLC returns a new empty UpdateFufillHTLC.
ReadMessage reads, validates, and parses the next bitcoin Message from r for the provided protocol version and bitcoin network.
WriteMessage writes a lightning Message to w including the necessary header information and returns the number of bytes written.
# Constants
Commands used in lightning message headers which detail the type of message.
Commands for discovery service.
Commands used in lightning message headers which detail the type of message.
Commands used in lightning message headers which detail the type of message.
Commands for the workflow of cooperatively closing an active channel.
Commands for modifying commitment transactions.
Commands for reporting protocol errors.
Command for locking a funded channel.
Commands used in lightning message headers which detail the type of message.
Commands used in lightning message headers which detail the type of message.
Commands for connection keep-alive.
Commands used in lightning message headers which detail the type of message.
Commands used in lightning message headers which detail the type of message.
Commands used in lightning message headers which detail the type of message.
Commands for opening a channel funded by one party (single funder).
Commands used in lightning message headers which detail the type of message.
Commands used in lightning message headers which detail the type of message.
Commands for negotiating HTLCs.
Commands used in lightning message headers which detail the type of message.
Commands used in lightning message headers which detail the type of message.
ErrMaxPendingChannels is returned by remote peer when the number of active pending channels exceeds their maximum policy limit.
ErrSynchronizingChain is returned by a remote peer that receives a channel update or a funding request while their still syncing to the latest state of the blockchain.
IncorrectValue indicates that the HTLC ultimately extended to the destination did not match the value that was expected.
InsufficientCapacity indicates that a payment failed due to a link in the ultimate route not having enough satoshi flow to successfully carry the payment.
32MB.
MaxSliceLength is the maximum allowed lenth for any opaque byte slices in the wire protocol.
MessageHeaderSize is the number of bytes in a lightning message header.
OnionPacketSize is the size of the serialized Sphinx onion packet included in each UpdateAddHTLC message.
0b10.
0b01.
SphinxParseError indicates that an intermediate node was unable properly parse the HTLC.
UnknownDestination indicates that the specified next hop within the Sphinx packet at a point in the route contained an unknown or invalid "next hop".
UnknownPaymentHash indicates that the destination did not recognize the payment hash.
UpstreamTimeout indicates that an upstream link had to enforce the absolute HTLC timeout, removing the HTLC.
# Structs
Alias a hex encoded UTF-8 string that may be displayed as an alternative to the node's ID.
AnnounceSignatures this is a direct message between two endpoints of a channel and serves as an opt-in mechanism to allow the announcement of the channel to the rest of the network.
ChannelAnnouncement message is used to announce the existence of a channel between two peers in the overlay, which is propagated by the discovery service over broadcast handler.
ChannelUpdateAnnouncement message is used after channel has been initially announced.
CloseComplete is sent by Bob signalling a fufillment and completion of Alice's prior CloseRequest message.
CloseRequest is sent by either side in order to initiate the cooperative closure of a channel.
CommitSig is sent by either side to stage any pending HTLC's in the receiver's pending set into a new commitment state.
ErrorGeneric represents a generic error bound to an exact channel.
Feature represent the feature which is used on stage of initialization of feature vector.
FeatureVector represents the global/local feature vector.
FundingLocked is the message that both parties to a new channel creation send once they have observed the funding transaction being confirmed on the blockchain.
Init is the first message reveals the features supported or required by this node.
NetAddress represents information pertaining to the identity and network reachability of a peer.
NodeAnnouncement message is used to announce the presence of a Lightning node and also to signal that the node is accepting incoming connections.
Ping defines a message which is sent by peers periodically to determine if the connection is still valid.
Pong defines a message which is the direct response to a received Ping message.
RevokeAndAck is sent by either side once a CommitSig message has been received, and validated.
RGB is used to represent the color.
SharedFeatures is a product of comparison of two features vector which consist of features which are present in both local and remote features vectors.
ShortChannelID represent the set of data which is needed to retrieve all necessary data to validate the channel existence.
SingleFundingComplete is the message Alice sends to Bob once she is able to fully assemble the funding transaction, and both versions of the commitment transaction.
SingleFundingRequest is the message Alice sends to Bob if we should like to create a channel with Bob where she's the sole provider of funds to the channel.
SingleFundingResponse is the message Bob sends to Alice after she initiates the single funder channel workflow via a SingleFundingRequest message.
SingleFundingSignComplete is the message Bob sends to Alice which delivers a signature for Alice's version of the commitment transaction.
UnknownMessage is an implementation of the error interface that allows the creation of an error in response to an unknown message.
UpdateAddHTLC is the message sent by Alice to Bob when she wishes to add an HTLC to his remote commitment transaction.
UpdateFailHTLC is sent by Alice to Bob in order to remove a previously added HTLC.
UpdateFufillHTLC is sent by Alice to Bob when she wishes to settle a particular HTLC referenced by its HTLCKey within a specific active channel referenced by ChannelPoint.
# Interfaces
Message is an interface that defines a lightning wire protocol message.
# Type aliases
CreditsAmount are the native currency unit used within the Lightning Network.
ErrorCode represents the short error code for each of the defined errors within the Lightning Network protocol spec.
FailCode specifies the precise reason that an upstream HTLC was cancelled.
OpaqueReason is an opaque encrypted byte slice that encodes the exact failure reason and additional some supplemental data.
PkScript is simple type definition which represents a raw serialized public key script.
ServiceFlag identifies the services supported by a particular Lightning Network peer.