Package fr. acinq. bitcoin
Types
https://en.bitcoin.it/wiki/Base58Check_encoding Base58Check is a format based on Base58 and used a lot in bitcoin, for encoding addresses and private keys for example. It includes a prefix (usually a single byte) and a checksum so you know what has been encoded, and that it has been transmitted correctly. For example, to create an address for a public key you could write: {{{ val pub: BinaryData = "0202a406624211f2abbdc68da3df929f938c3399dd79fac1b51b0e4ad1d26a47aa" val address = Base58Check.encode(Base58.Prefix.PubkeyAddress, Crypto.hash160(pub)) }}} And to decode a private key you could write: {{{ // check that is it a mainnet private key val (Base58.Prefix.SecretKey, priv) = Base58Check.decode("5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn") }}}
see https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
Lexicographical Ordering of Transaction Inputs and Outputs. See https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki
see https://en.bitcoin.it/wiki/Protocol_specification#Merkle_Trees
an out point is a reference to a specific output in a specific transaction that we want to claim
A bitcoin private key. A private key is valid if it is not 0 and less than the secp256k1 curve order when interpreted as an integer (most significant byte first). The probability of choosing a 32-byte string uniformly at random which is an invalid private key is negligible, so this condition is not checked by default. However, if you receive a private key from an external, untrusted source, you should call isValid() before actually using it.
A bitcoin public key (in compressed form). A public key is valid if it represents a point on the secp256k1 curve. The validity of this public key is not checked by default, because when you create a public key from a private key it will always be valid. However, if you receive a public key from an external, untrusted source, you should call isValid() before actually using it.
leaf of a script tree used to create and spend tapscript transactions
Simple binary tree structure
Transaction input
x-only pubkey, used with Schnorr signatures (see https://github.com/bitcoin/bips/tree/master/bip-0340) we only store the x coordinate of the pubkey, the y coordinate is always even