coinlib_flutter library

Classes

Address
Base class for all addresses. Encoded addresses for sub-classes are provided via the toString() method.
Base58Address
Base class for all addresses that use base58: P2PKHAddress and P2SHAddress.
Bech32
Encapsules 5-bit words that can be bech32 encoded and decoded. The 5-bit words may need to be further converted into the required data.
Bech32Address
Base class for addresses that use bech32: P2WPKHAddress and P2WSHAddress. Unknown witness programs are encoded via UnknownWitnessAddress.
BytesReader
Reads serialized data from a Uint8List. Throws an OutOfData exception if there is not enough data to read. If there is an error, the offset may be different than before.
BytesWriter
Writes serialized data to a Uint8List. Throws an OutOfData exception if there is not enough space in the bytes to write to.
CoinlibLoader
A widget that ensures the coinlib library is loaded before use. This is currently only necessary on web but it is good practice to use in any case.
ECDSARecoverableSignature
An ECDSARecoverableSignature is similar to an ECDSASignature but contains an additional byte that encodes a "recid" and compression flag that allows for the public key to be recovered from the message hash and signature.
ECDSASignature
ECPrivateKey
Represents an ECC private key for use with the secp256k1 curve
ECPublicKey
Represents an ECC public key on the secp256k1 curve that has an associated private key
HDKey
HDPrivateKey
Represents a private key with a chain code that can derive BIP32 keys.
HDPublicKey
Input
The base class for all inputs, providing the match factory constructor to determine the appropriate subclass from a RawInput
InputSignature
Encapsulates an ECDSA signature and hashType for inclusion in an Input.
MagicHash
MeasureWriter
Measures the serialized size of data written to it without writing to a Uint8List
MessageSignature
Encapsulates a signature for messages that are encoded to base-64. The base-64 representation can be obtained via toString().
MultisigProgram
NetworkParams
OutPoint
Reference to an Output by transaction hash and index
Output
A transaction output that carries a value and program specifying how the value can be spent.
P2PKH
Pay-to-Public-Key-Hash program taking a 20-byte public key hash that can satisfy this script with a signature.
P2PKHAddress
P2PKHInput
An input for a Pay-to-Public-Key-Hash output (P2PKH). This contains the public key that should match the hash in the associated output. It is either signed or unsigned and the addSignature method can be used to add a signature.
P2SH
Pay-to-Script-Hash program taking a 20-byte script hash for a redeem script.
P2SHAddress
P2SHMultisigInput
An input for a Pay-to-Script-Hash output (P2SH) with a multisig redeemScript and any number of required signatures that may be provided with replaceSignatures.
P2Witness
Arbitrary witness program
P2WPKH
Pay-to-Witness-Public-Key-Hash program taking a 20-byte public key hash that can satisfy this script with a signature provided as witness data.
P2WPKHAddress
P2WPKHInput
An input for a Pay-to-Witness-Public-Key-Hash output (P2WPKH). This contains the public key that should match the hash in the associated output. It is either signed or unsigned and the addSignature method can be used to add a signature. Signature and public key data is stored in the witness data.
P2WSH
Pay-to-Witness-Script-Hash program taking a 32-byte script hash for a redeem script whereby the redeem script and other push data is to be provided as witness data.
P2WSHAddress
PKHInput
A mixin for Public Key Hash input types, providing the ECPublicKey and InputSignature required in these inputs.
Program
An interface for programs that wrap a Script with associated functionality. This is seperated from the Script class to present high-level abstractions.
RawInput
A transaction input without any associated witness data that acts as the base for all other inputs as all inputs include a outpoint, script and sequence number.
RawProgram
A program that is not recognised and merely wraps a Script.
Script
ScriptOp
Represents a single operation or script pushdata
ScriptOpCode
Represents a ScriptOp that is an op code
ScriptPushData
Represents a ScriptOp that is a pushdata
ScriptPushDataMatcher
Provides comparison with ScriptPushData of a particular size.
SigHashType
Encapsulates the signature hash type to be used for an input signature. Signatures may sign different output and inputs to allow for transaction modifications. To sign an entire transaction the all constructor should be used.
Transaction
Allows construction and signing of Peercoin transactions including those with witness data.
UnknownWitnessAddress
This address type is for all bech32 addresses that do not match known witness versions. Currently this includes taproot until it is fully specified.
WIF
Encapsulates a ECPrivateKey and version that can be encoded or decoded in the Wallet Import Format (WIF). toString can be used to obtain the encoded WIF string.
WitnessInput
The base-class for all witness inputs

Enums

Bech32Type

Mixins

Writable
Classes that use this mixin are serializable to a Writer via write and return cached bytes via toBytes. These classes should be immutable as the bytes are written to only once.
Writer
Methods to handle the writing of data

Properties

alphabet String
final
scriptOpCodeToName Map<int, String>
final
scriptOpNameToCode Map<String, int>
final

Functions

base58Decode(String b58) Uint8List
Decodes a checksumed base58 string. This will throw a InvalidBase58 exception if the base58 encoding is invalid, or InvalidBase58Checksum if the checksum is wrong.
base58Encode(Uint8List data) String
Encodes a checksumed base58 string
bytesEqual(Object? a, Object? b) bool
Determines if two objects are equal lists
bytesToHex(Uint8List bytes) String
checkBytes(Uint8List bytes, int length, {String name = "Bytes"}) Uint8List
Throws an ArgumentError if the bytes are not of the required length and returns the bytes.
convertBits(List<int> data, int from, int to, bool pad) List<int>?
Converts data from "from" bits to "to" bits with optional padding (pad). Returns the new data or null if conversion was not possible. Used to convert to and from the 5-bit words for bech32.
copyCheckBytes(Uint8List bytes, int length, {String name = "Bytes"}) Uint8List
Throws an ArgumentError if the bytes are not of the required length and returns a copy of the bytes.
generateRandomBytes(int size) Uint8List
Generates random bytes using a CSPRNG Tested with the ent command
hash160(Uint8List msg) Uint8List
hexToBytes(String hex) Uint8List
hmacSha512(Uint8List key, Uint8List msg) Uint8List
hrpValid(String hrp) bool
Returns true if a bech32 hrp uses valid characters.
loadCoinlib() Future<void>
sha256DoubleHash(Uint8List msg) Uint8List
sha256Hash(Uint8List msg) Uint8List