lnd

package
v0.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MnemonicEnvName   = "AEZEED_MNEMONIC"
	PassphraseEnvName = "AEZEED_PASSPHRASE"
)
View Source
const (
	HardenedKeyStart            = uint32(hdkeychain.HardenedKeyStart)
	WalletDefaultDerivationPath = "m/84'/0'/0'"
	WalletBIP49DerivationPath   = "m/49'/0'/0'"
	WalletBIP86DerivationPath   = "m/86'/0'/0'"
	LndDerivationPath           = "m/1017'/%d'/%d'"
)
View Source
const (
	DefaultOpenTimeout = time.Second * 10
)

Variables

This section is empty.

Functions

func AllDerivationPaths added in v0.2.0

func AllDerivationPaths(params *chaincfg.Params) ([]string, [][]uint32, error)

func AllNodeChannels added in v0.8.3

func AllNodeChannels(graph *lnrpc.ChannelGraph,
	nodePubKey string) []*lnrpc.ChannelEdge

func ConnectPeer added in v0.10.7

func ConnectPeer(conn *brontide.Conn, connReq *connmgr.ConnReq,
	netParams *chaincfg.Params,
	identityECDH keychain.SingleKeyECDH) (*peer.Brontide, error)

func CreateChannelBackup

func CreateChannelBackup(db *channeldb.DB, multiFile *chanbackup.MultiFile,
	ring keychain.KeyRing) error

CreateChannelBackup creates a channel backup file from all channels found in the given DB file, encrypted with the key in the key ring.

func DecodeAddressHash added in v0.2.0

func DecodeAddressHash(addr string, chainParams *chaincfg.Params) ([]byte, bool,
	error)

DecodeAddressHash returns the public key or script hash encoded in a native bech32 encoded SegWit address and whether it's a script hash or not.

func DeriveChildren

func DeriveChildren(key *hdkeychain.ExtendedKey, path []uint32) (
	*hdkeychain.ExtendedKey, error)

func DeriveKey

func DeriveKey(extendedKey *hdkeychain.ExtendedKey, path string,
	params *chaincfg.Params) (*hdkeychain.ExtendedKey, *btcec.PublicKey,
	*btcutil.WIF, error)

DeriveKey derives the public key and private key in the WIF format for a given key path of the extended key.

func ECDH added in v0.9.6

func ECDH(privKey *btcec.PrivateKey, pub *btcec.PublicKey) ([32]byte, error)

ECDH performs a scalar multiplication (ECDH-like operation) between the target private key and remote public key. The output returned will be the sha256 of the resulting shared point serialized in compressed format. If k is our private key, and P is the public key, we perform the following operation:

sx := k*P s := sha256(sx.SerializeCompressed())

func FindCommonEdges added in v0.8.4

func FindCommonEdges(graph *lnrpc.ChannelGraph, node1,
	node2 string) []*lnrpc.ChannelEdge

func FindNode added in v0.8.3

func FindNode(graph *lnrpc.ChannelGraph,
	nodePubKey string) (*lnrpc.LightningNode, error)

func GetP2WPKHScript added in v0.4.0

func GetP2WPKHScript(addr string, chainParams *chaincfg.Params) ([]byte,
	error)

GetP2WPKHScript creates a P2WKH output script from an address. If the address is not a P2WKH address, an error is returned.

func GetP2WSHScript added in v0.5.0

func GetP2WSHScript(addr string, chainParams *chaincfg.Params) ([]byte,
	error)

GetP2WSHScript creates a P2WSH output script from an address. If the address is not a P2WSH address, an error is returned.

func GetWitnessAddrScript added in v0.9.3

func GetWitnessAddrScript(addr btcutil.Address,
	chainParams *chaincfg.Params) ([]byte, error)

func HardenedKey added in v0.5.0

func HardenedKey(key uint32) uint32

func IdentityPath added in v0.8.4

func IdentityPath(params *chaincfg.Params) string

func MultisigPath added in v0.8.4

func MultisigPath(params *chaincfg.Params, index int) string

func NP2WKHAddr added in v0.9.3

func NP2WKHAddr(pubKey *btcec.PublicKey,
	params *chaincfg.Params) (*btcutil.AddressScriptHash, error)

func OpenDB added in v0.7.0

func OpenDB(dbPath string, readonly bool) (*channeldb.DB, error)

func P2AnchorStaticRemote added in v0.9.3

func P2AnchorStaticRemote(pubKey *btcec.PublicKey,
	params *chaincfg.Params) (*btcutil.AddressWitnessScriptHash, []byte,
	error)

func P2PKHAddr added in v0.9.3

func P2PKHAddr(pubKey *btcec.PublicKey,
	params *chaincfg.Params) (*btcutil.AddressPubKeyHash, error)

func P2TRAddr added in v0.10.6

func P2TRAddr(pubKey *btcec.PublicKey,
	params *chaincfg.Params) (*btcutil.AddressTaproot, error)

func P2WKHAddr added in v0.9.3

func P2WKHAddr(pubKey *btcec.PublicKey,
	params *chaincfg.Params) (*btcutil.AddressWitnessPubKeyHash, error)

func ParseAddress added in v0.10.7

func ParseAddress(addr string, chainParams *chaincfg.Params) (btcutil.Address,
	error)

ParseAddress attempts to parse the given address string into a native address for the given network.

func ParseOutpoint added in v0.4.0

func ParseOutpoint(s string) (*wire.OutPoint, error)

ParseOutpoint parses a transaction outpoint in the format <txid>:<idx> into the wire format.

func ParsePath

func ParsePath(path string) ([]uint32, error)

func PrivKeyFromPath added in v0.5.0

func PrivKeyFromPath(extendedKey *hdkeychain.ExtendedKey,
	path []uint32) (*btcec.PrivateKey, error)

func ReadAezeed added in v0.6.0

func ReadAezeed(params *chaincfg.Params) (*hdkeychain.ExtendedKey, time.Time,
	error)

func ShaChainFromPath added in v0.5.0

func ShaChainFromPath(extendedKey *hdkeychain.ExtendedKey, path []uint32,
	multiSigPubKey *btcec.PublicKey) (*shachain.RevocationProducer, error)

Types

type HDKeyRing

type HDKeyRing struct {
	ExtendedKey *hdkeychain.ExtendedKey
	ChainParams *chaincfg.Params
}

func (*HDKeyRing) CheckDescriptor

func (r *HDKeyRing) CheckDescriptor(
	keyDesc keychain.KeyDescriptor) error

CheckDescriptor checks if a key descriptor is correct by making sure that we can derive the key that it describes.

func (*HDKeyRing) DeriveKey

func (r *HDKeyRing) DeriveKey(keyLoc keychain.KeyLocator) (
	keychain.KeyDescriptor, error)

func (*HDKeyRing) DeriveNextKey

func (r *HDKeyRing) DeriveNextKey(_ keychain.KeyFamily) (
	keychain.KeyDescriptor, error)

func (*HDKeyRing) NodePubKey added in v0.8.3

func (r *HDKeyRing) NodePubKey() (*btcec.PublicKey, error)

NodePubKey returns the public key that represents an lnd node's public network identity.

type LightningChannel

type LightningChannel struct {
	LocalChanCfg  channeldb.ChannelConfig
	RemoteChanCfg channeldb.ChannelConfig
	SignDesc      *input.SignDescriptor
	ChannelState  *channeldb.OpenChannel
	TXSigner      *Signer
}

func (*LightningChannel) CreateSignDesc

func (lc *LightningChannel) CreateSignDesc() error

CreateSignDesc derives the SignDescriptor for commitment transactions from other fields on the LightningChannel.

func (*LightningChannel) SignedCommitTx

func (lc *LightningChannel) SignedCommitTx() (*wire.MsgTx, error)

SignedCommitTx function take the latest commitment transaction and populate it with witness data.

type Signer

type Signer struct {
	input.MockSigner

	ExtendedKey *hdkeychain.ExtendedKey
	ChainParams *chaincfg.Params
}

func (*Signer) AddPartialSignature added in v0.4.0

func (s *Signer) AddPartialSignature(packet *psbt.Packet,
	keyDesc keychain.KeyDescriptor, utxo *wire.TxOut, witnessScript []byte,
	inputIndex int) error

func (*Signer) ComputeInputScript

func (s *Signer) ComputeInputScript(_ *wire.MsgTx, _ *input.SignDescriptor) (
	*input.Script, error)

func (*Signer) FetchPrivKey

func (s *Signer) FetchPrivKey(descriptor *keychain.KeyDescriptor) (
	*btcec.PrivateKey, error)

func (*Signer) SignOutputRaw

func (s *Signer) SignOutputRaw(tx *wire.MsgTx,
	signDesc *input.SignDescriptor) (input.Signature, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL