sigil-bitcoin-keys

sigil bitcoin keys

(sigil bitcoin keys) — Bitcoin key, address, BIP32, and BIP39 helpers

64 public exports

bitcoin-network

procedure

Bitcoin network parameters used by key and address encoders.

bitcoin-network?

procedure

Test if a value is a `bitcoin-network` struct.

bitcoin-network-name

procedure

Get the `name` field of a `bitcoin-network` struct.

bitcoin-network-wif

procedure

Get the `wif` field of a `bitcoin-network` struct.

bitcoin-network-p2pkh

procedure

Get the `p2pkh` field of a `bitcoin-network` struct.

bitcoin-network-p2sh

procedure

Get the `p2sh` field of a `bitcoin-network` struct.

bitcoin-network-bech32

procedure

Get the `bech32` field of a `bitcoin-network` struct.

bitcoin-network-xprv

procedure

Get the `xprv` field of a `bitcoin-network` struct.

bitcoin-network-xpub

procedure

Get the `xpub` field of a `bitcoin-network` struct.

bitcoin-mainnet

variable

Mainnet address and extended-key version constants.

bitcoin-testnet

variable

Testnet address and extended-key version constants.

extended-private-key

procedure

BIP32 extended private key record.

extended-private-key?

procedure

Test if a value is a `extended-private-key` struct.

extended-private-key-network

procedure

Get the `network` field of a `extended-private-key` struct.

extended-private-key-depth

procedure

Get the `depth` field of a `extended-private-key` struct.

extended-private-key-parent-fingerprint

procedure

Get the `parent-fingerprint` field of a `extended-private-key` struct.

extended-private-key-child-number

procedure

Get the `child-number` field of a `extended-private-key` struct.

extended-private-key-chain-code

procedure

Get the `chain-code` field of a `extended-private-key` struct.

extended-private-key-private-key

procedure

Get the `private-key` field of a `extended-private-key` struct.

extended-public-key

procedure

BIP32 extended public key record.

extended-public-key?

procedure

Test if a value is a `extended-public-key` struct.

extended-public-key-network

procedure

Get the `network` field of a `extended-public-key` struct.

extended-public-key-depth

procedure

Get the `depth` field of a `extended-public-key` struct.

extended-public-key-parent-fingerprint

procedure

Get the `parent-fingerprint` field of a `extended-public-key` struct.

extended-public-key-child-number

procedure

Get the `child-number` field of a `extended-public-key` struct.

extended-public-key-chain-code

procedure

Get the `chain-code` field of a `extended-public-key` struct.

extended-public-key-public-key

procedure

Get the `public-key` field of a `extended-public-key` struct.

private-key->wif

procedure

Encode a 32-byte private key as Wallet Import Format. `network` selects the WIF version byte. `compressed?` controls whether the compressed-public-key marker is included in the payload.

wif->private-key

procedure

Decode a Wallet Import Format string. Returns `(key network . compressed?)`.

private-key->public-key

procedure

Derive a compressed public key from a 32-byte secp256k1 private key.

public-key?

procedure

Return true when `key` is a valid compressed or uncompressed public key.

compressed-public-key?

procedure

Return true when `key` is a valid 33-byte compressed public key.

x-only-public-key

procedure

Convert a serialized public key into a 32-byte x-only public key.

public-key->p2pkh-address

procedure

Derive a Base58Check P2PKH address from a serialized public key.

script-hash->p2sh-address

procedure

Encode a 20-byte script hash as a Base58Check P2SH address.

public-key->p2wpkh-address

procedure

Derive a native SegWit P2WPKH address from a serialized public key.

script->p2wsh-address

procedure

Derive a native SegWit P2WSH address from a witness script.

x-only-public-key->p2tr-address

procedure

Encode a 32-byte x-only public key as a native Taproot address.

fingerprint

procedure

Return the BIP32 4-byte key fingerprint for a serialized public key.

extended-private-key->public-key

procedure

Neuter an extended private key into the matching extended public key.

bip32-master-key

procedure

Derive a BIP32 master extended private key from seed bytes.

bip32-private-child

procedure

Derive a BIP32 private child key. Hardened children use child numbers greater than or equal to `#x80000000`.

bip32-public-child

procedure

Derive a non-hardened BIP32 public child key.

bip32-derive-path

procedure

Derive a BIP32 path such as `m/84'/0'/0'/0/0`. The input key may be an extended private key or extended public key.

bip32-hardened-index

procedure

Convert a non-hardened child index into a hardened BIP32 index.

bip32-account-path

procedure

Build a BIP43 account path `m/purpose'/coin_type'/account'`.

bip44-account-path

procedure

BIP44 legacy P2PKH account path.

bip49-account-path

procedure

BIP49 nested SegWit account path.

bip84-account-path

procedure

BIP84 native SegWit account path.

bip86-account-path

procedure

BIP86 Taproot key-path account path.

bip32-account-key

procedure

Derive an account-level extended key for a BIP43 purpose.

bip44-account-key

procedure

Derive a BIP44 account key from a master extended key.

bip49-account-key

procedure

Derive a BIP49 account key from a master extended key.

bip84-account-key

procedure

Derive a BIP84 account key from a master extended key.

bip86-account-key

procedure

Derive a BIP86 account key from a master extended key.

bip32-chain-key

procedure

Derive an external (`#f`) or change (`#t`) chain from an account key.

bip32-address-key

procedure

Derive an address key at `/change/index` from an account key.

bip32-xprv->string

procedure

Serialize a BIP32 extended private key as Base58Check text.

bip32-xpub->string

procedure

Serialize a BIP32 extended public key as Base58Check text.

string->bip32-xprv

procedure

Parse a Base58Check BIP32 extended private key.

string->bip32-xpub

procedure

Parse a Base58Check BIP32 extended public key.

bip39-entropy->mnemonic

procedure

Convert BIP39 entropy bytes into an English mnemonic sentence.

bip39-mnemonic->entropy

procedure

Convert a BIP39 English mnemonic sentence back to entropy bytes.

bip39-mnemonic->seed

procedure

Derive a 64-byte BIP39 seed from a mnemonic and optional passphrase.