Documentation ¶
Index ¶
- Constants
- func AllDerivationPaths(params *chaincfg.Params) ([]string, [][]uint32, error)
- func AllNodeChannels(graph *lnrpc.ChannelGraph, nodePubKey string) []*lnrpc.ChannelEdge
- func ConnectPeer(conn *brontide.Conn, connReq *connmgr.ConnReq, netParams *chaincfg.Params, ...) (*peer.Brontide, error)
- func CreateChannelBackup(db *channeldb.DB, multiFile *chanbackup.MultiFile, ring keychain.KeyRing) error
- func DecodeAddressHash(addr string, chainParams *chaincfg.Params) ([]byte, bool, error)
- func DeriveChildren(key *hdkeychain.ExtendedKey, path []uint32) (*hdkeychain.ExtendedKey, error)
- func DeriveKey(extendedKey *hdkeychain.ExtendedKey, path string, params *chaincfg.Params) (*hdkeychain.ExtendedKey, *btcec.PublicKey, *btcutil.WIF, error)
- func ECDH(privKey *btcec.PrivateKey, pub *btcec.PublicKey) ([32]byte, error)
- func FindCommonEdges(graph *lnrpc.ChannelGraph, node1, node2 string) []*lnrpc.ChannelEdge
- func FindNode(graph *lnrpc.ChannelGraph, nodePubKey string) (*lnrpc.LightningNode, error)
- func GetP2WPKHScript(addr string, chainParams *chaincfg.Params) ([]byte, error)
- func GetP2WSHScript(addr string, chainParams *chaincfg.Params) ([]byte, error)
- func GetWitnessAddrScript(addr btcutil.Address, chainParams *chaincfg.Params) ([]byte, error)
- func HardenedKey(key uint32) uint32
- func IdentityPath(params *chaincfg.Params) string
- func MultisigPath(params *chaincfg.Params, index int) string
- func NP2WKHAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressScriptHash, error)
- func OpenDB(dbPath string, readonly bool) (*channeldb.DB, error)
- func P2AnchorStaticRemote(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressWitnessScriptHash, []byte, error)
- func P2PKHAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressPubKeyHash, error)
- func P2TRAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressTaproot, error)
- func P2WKHAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressWitnessPubKeyHash, error)
- func ParseAddress(addr string, chainParams *chaincfg.Params) (btcutil.Address, error)
- func ParseOutpoint(s string) (*wire.OutPoint, error)
- func ParsePath(path string) ([]uint32, error)
- func PrivKeyFromPath(extendedKey *hdkeychain.ExtendedKey, path []uint32) (*btcec.PrivateKey, error)
- func ReadAezeed(params *chaincfg.Params) (*hdkeychain.ExtendedKey, time.Time, error)
- func ShaChainFromPath(extendedKey *hdkeychain.ExtendedKey, path []uint32, ...) (*shachain.RevocationProducer, error)
- type HDKeyRing
- func (r *HDKeyRing) CheckDescriptor(keyDesc keychain.KeyDescriptor) error
- func (r *HDKeyRing) DeriveKey(keyLoc keychain.KeyLocator) (keychain.KeyDescriptor, error)
- func (r *HDKeyRing) DeriveNextKey(_ keychain.KeyFamily) (keychain.KeyDescriptor, error)
- func (r *HDKeyRing) NodePubKey() (*btcec.PublicKey, error)
- type LightningChannel
- type Signer
- func (s *Signer) AddPartialSignature(packet *psbt.Packet, keyDesc keychain.KeyDescriptor, utxo *wire.TxOut, ...) error
- func (s *Signer) ComputeInputScript(_ *wire.MsgTx, _ *input.SignDescriptor) (*input.Script, error)
- func (s *Signer) FetchPrivKey(descriptor *keychain.KeyDescriptor) (*btcec.PrivateKey, error)
- func (s *Signer) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) (input.Signature, error)
Constants ¶
const ( MnemonicEnvName = "AEZEED_MNEMONIC" PassphraseEnvName = "AEZEED_PASSPHRASE" )
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'" )
const (
DefaultOpenTimeout = time.Second * 10
)
Variables ¶
This section is empty.
Functions ¶
func AllDerivationPaths ¶ added in v0.2.0
func AllNodeChannels ¶ added in v0.8.3
func AllNodeChannels(graph *lnrpc.ChannelGraph, nodePubKey string) []*lnrpc.ChannelEdge
func ConnectPeer ¶ added in v0.10.7
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
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
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
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
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 HardenedKey ¶ added in v0.5.0
func IdentityPath ¶ added in v0.8.4
func NP2WKHAddr ¶ added in v0.9.3
func NP2WKHAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressScriptHash, error)
func P2AnchorStaticRemote ¶ added in v0.9.3
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
ParseAddress attempts to parse the given address string into a native address for the given network.
func ParseOutpoint ¶ added in v0.4.0
ParseOutpoint parses a transaction outpoint in the format <txid>:<idx> into the wire format.
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 (*HDKeyRing) NodePubKey ¶ added in v0.8.3
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 (*Signer) ComputeInputScript ¶
func (*Signer) FetchPrivKey ¶
func (s *Signer) FetchPrivKey(descriptor *keychain.KeyDescriptor) ( *btcec.PrivateKey, error)