Documentation ¶
Index ¶
- Constants
- Variables
- func AllDerivationPaths(params *chaincfg.Params) ([]string, [][]uint32, error)
- func AllNodeChannels(graph *lnrpc.ChannelGraph, nodePubKey string) []*lnrpc.ChannelEdge
- func CheckAddress(addr string, chainParams *chaincfg.Params, allowDerive bool, hint string, ...) error
- 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 DecryptWalletRootKey(db walletdb.DB, privatePassphrase []byte) ([]byte, 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 DeriveMuSig2NoncePrivKey(extendedKey *hdkeychain.ExtendedKey, chainParams *chaincfg.Params) (*btcec.PrivateKey, error)
- func ECDH(privKey *btcec.PrivateKey, pub *btcec.PublicKey) ([32]byte, error)
- func ExtractChannel(extendedKey *hdkeychain.ExtendedKey, chainParams *chaincfg.Params, ...) (*dump.BackupSingle, error)
- func FindCommonEdges(graph *lnrpc.ChannelGraph, node1, node2 string) []*lnrpc.ChannelEdge
- func FindNode(graph *lnrpc.ChannelGraph, nodePubKey string) (*lnrpc.LightningNode, error)
- func GenerateMuSig2Nonces(extendedKey *hdkeychain.ExtendedKey, randomness [32]byte, ...) (*musig2.Nonces, 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 OpenWallet(walletDbPath string, chainParams *chaincfg.Params) (*wallet.Wallet, []byte, func() error, 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 P2TaprootStaticRemote(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressTaproot, *input.CommitScriptTree, 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 PasswordFromConsole(userQuery string) ([]byte, error)
- func PrepareWalletAddress(addr string, chainParams *chaincfg.Params, estimator *input.TxWeightEstimator, ...) ([]byte, error)
- func PrivKeyFromPath(extendedKey *hdkeychain.ExtendedKey, path []uint32) (*btcec.PrivateKey, error)
- func ReadAezeed(params *chaincfg.Params) (*hdkeychain.ExtendedKey, time.Time, error)
- func ReadPassphrase(verb string) ([]byte, error)
- func ShaChainFromPath(extendedKey *hdkeychain.ExtendedKey, path []uint32, ...) (*shachain.RevocationProducer, error)
- type AddrType
- 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) AddPartialSignatureForPrivateKey(packet *psbt.Packet, privateKey *btcec.PrivateKey, utxo *wire.TxOut, ...) error
- func (s *Signer) ComputeInputScript(_ *wire.MsgTx, _ *input.SignDescriptor) (*input.Script, error)
- func (s *Signer) FetchPrivateKey(descriptor *keychain.KeyDescriptor) (*btcec.PrivateKey, error)
- func (s *Signer) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) (input.Signature, error)
- func (s *Signer) SignOutputRawWithPrivateKey(tx *wire.MsgTx, signDesc *input.SignDescriptor, privKey *secp256k1.PrivateKey) (input.Signature, error)
Constants ¶
const ( MnemonicEnvName = "AEZEED_MNEMONIC" PassphraseEnvName = "AEZEED_PASSPHRASE" PasswordEnvName = "WALLET_PASSWORD" )
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'" AddressDeriveFromWallet = "fromseed" )
const (
DefaultOpenTimeout = time.Second * 10
)
Variables ¶
var ( // Namespace from github.com/btcsuite/btcwallet/wallet/wallet.go. WaddrmgrNamespaceKey = []byte("waddrmgr") )
Functions ¶
func AllDerivationPaths ¶
func AllNodeChannels ¶
func AllNodeChannels(graph *lnrpc.ChannelGraph, nodePubKey string) []*lnrpc.ChannelEdge
func CheckAddress ¶ added in v0.12.1
func ConnectPeer ¶
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 ¶
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 DecryptWalletRootKey ¶ added in v0.13.0
DecryptWalletRootKey decrypts a lnd compatible wallet's root key.
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 DeriveMuSig2NoncePrivKey ¶ added in v0.13.2
func DeriveMuSig2NoncePrivKey(extendedKey *hdkeychain.ExtendedKey, chainParams *chaincfg.Params) (*btcec.PrivateKey, error)
DeriveMuSig2NoncePrivKey derives a private key to be used as a nonce in a MuSig2 signing session.
func ECDH ¶
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 ExtractChannel ¶ added in v0.12.1
func ExtractChannel(extendedKey *hdkeychain.ExtendedKey, chainParams *chaincfg.Params, multiFilePath, channelPoint string) (*dump.BackupSingle, error)
ExtractChannel extracts a single channel from the given backup file and returns it as a dump.BackupSingle struct.
func FindCommonEdges ¶
func FindCommonEdges(graph *lnrpc.ChannelGraph, node1, node2 string) []*lnrpc.ChannelEdge
func FindNode ¶
func FindNode(graph *lnrpc.ChannelGraph, nodePubKey string) (*lnrpc.LightningNode, error)
func GenerateMuSig2Nonces ¶ added in v0.13.2
func GenerateMuSig2Nonces(extendedKey *hdkeychain.ExtendedKey, randomness [32]byte, chanPoint *wire.OutPoint, chainParams *chaincfg.Params, signingKey *btcec.PrivateKey) (*musig2.Nonces, error)
GenerateMuSig2Nonces generates random nonces for a MuSig2 signing session.
func GetP2WPKHScript ¶
GetP2WPKHScript creates a P2WKH output script from an address. If the address is not a P2WKH address, an error is returned.
func GetP2WSHScript ¶
GetP2WSHScript creates a P2WSH output script from an address. If the address is not a P2WSH address, an error is returned.
func GetWitnessAddrScript ¶
func HardenedKey ¶
func IdentityPath ¶
func NP2WKHAddr ¶
func NP2WKHAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressScriptHash, error)
func OpenWallet ¶ added in v0.13.0
func OpenWallet(walletDbPath string, chainParams *chaincfg.Params) (*wallet.Wallet, []byte, func() error, error)
OpenWallet opens a lnd compatible wallet and returns it, along with the private wallet password.
func P2AnchorStaticRemote ¶
func P2PKHAddr ¶
func P2PKHAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressPubKeyHash, error)
func P2TRAddr ¶
func P2TRAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressTaproot, error)
func P2TaprootStaticRemote ¶ added in v0.12.1
func P2TaprootStaticRemote(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressTaproot, *input.CommitScriptTree, error)
func P2WKHAddr ¶
func P2WKHAddr(pubKey *btcec.PublicKey, params *chaincfg.Params) (*btcutil.AddressWitnessPubKeyHash, error)
func ParseAddress ¶
ParseAddress attempts to parse the given address string into a native address for the given network.
func ParseOutpoint ¶
ParseOutpoint parses a transaction outpoint in the format <txid>:<idx> into the wire format.
func PasswordFromConsole ¶ added in v0.13.0
PasswordFromConsole reads a password from the console or stdin.
func PrepareWalletAddress ¶ added in v0.12.1
func PrepareWalletAddress(addr string, chainParams *chaincfg.Params, estimator *input.TxWeightEstimator, rootKey *hdkeychain.ExtendedKey, hint string) ([]byte, error)
func PrivKeyFromPath ¶
func PrivKeyFromPath(extendedKey *hdkeychain.ExtendedKey, path []uint32) (*btcec.PrivateKey, error)
func ReadAezeed ¶
func ReadAezeed(params *chaincfg.Params) (*hdkeychain.ExtendedKey, time.Time, error)
ReadAezeed reads an aezeed from the console or the environment variable.
func ReadPassphrase ¶ added in v0.13.0
ReadPassphrase reads a cipher seed passphrase from the console or the environment variable.
func ShaChainFromPath ¶
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 ¶
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 ¶
func (*Signer) AddPartialSignatureForPrivateKey ¶ added in v0.13.0
func (*Signer) ComputeInputScript ¶
func (*Signer) FetchPrivateKey ¶ added in v0.13.0
func (s *Signer) FetchPrivateKey(descriptor *keychain.KeyDescriptor) ( *btcec.PrivateKey, error)