bitcoin

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BIP322Tag = "BIP0322-signed-message"

Signed message via BIP-322 are prepended with this bip322Tag Taken from https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki#full

View Source
const ECDSASignatureLen = 65
View Source
const MagicMessage = "\x18Bitcoin Signed Message:\n"

Signed message are prepended with this magicMessage Taken from https://bitcoin.stackexchange.com/a/77325

Variables

This section is empty.

Functions

func AllFlags

func AllFlags() []int

All returns every possible recovery flag, taken from https://github.com/btclib-org/btclib/blob/v2022.7.20/btclib/ecc/bms.py#L83

func CompressedFlags

func CompressedFlags() []int

Compressed returns all compressed recovery flags.

func CreateMagicMessage

func CreateMagicMessage(message string) string

CreateMagicMessage builds a properly signed message.

func CreateMagicMessageBIP322

func CreateMagicMessageBIP322(message []byte) [32]byte

CreateMagicMessageBIP322 builds a properly signed message (in BIP-322 format).

func ElectrumP2SHAndP2WPKHFlags

func ElectrumP2SHAndP2WPKHFlags() []int

ElectrumP2SHAndP2WPKH returns all P2SH-P2WPKH recovery flags related to Electrum.

func ElectrumP2WPKHFlags

func ElectrumP2WPKHFlags() []int

ElectrumP2WPKH returns all P2WPKH recovery flags related to Electrum.

func GetKeyID

func GetKeyID(recoveryFlag int) int

GetKeyID returns the Key ID for a specified recovery flag Taken from https://github.com/btclib-org/btclib/blob/v2023.7.12/btclib/ecc/bms.py#L302

func ParsePublicKey

func ParsePublicKey(pubKeyHex string) (*secp2561k1.PublicKey, error)

ParsePublicKey parses a public key from a hex string

func ParseSignature

func ParseSignature(signature string) ([]byte, error)

ParseSignature is a convenience function to parse a signature from a hex or base64 string

func ParseWitnessSignatureBIP322

func ParseWitnessSignatureBIP322(sigBytes []byte) ([][]byte, error)

func SHA256

func SHA256(data []byte) (hash []byte)

SHA256 returns the SHA256 hash of the input data

func ShouldBeCompressed

func ShouldBeCompressed(recoveryFlag int) bool

ShouldBeCompressed returns if a recovery flag signals a compressed key Taken from https://github.com/btclib-org/btclib/blob/v2023.7.12/btclib/ecc/bms.py#L305

func TrezorFlags

func TrezorFlags() []int

Trezor returns all recovery flags related to Trezor.

func TrezorP2SHAndP2WPKHFlags

func TrezorP2SHAndP2WPKHFlags() []int

TrezorP2SHAndP2WPKH returns all P2SH-P2WPKH recovery flags related to Trezor.

func TrezorP2WPKHFlags

func TrezorP2WPKHFlags() []int

TrezorP2WPKH returns all P2WPKH recovery flags related to Trezor.

func UncompressedFlags

func UncompressedFlags() []int

Uncompressed returns all uncompressed recovery flags.

Types

This section is empty.

Jump to

Keyboard shortcuts

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