Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun blockHash(serializedBlockHeader: ByteArray): ByteArray

Calculates the block hash given a serialized header. Note that by convention hashes are displayed in byte-reverse order (as if a little-endian number was being displayed). This return value is not reversed. (hash.reversed().toHex() == "hex header from explorer") -> true

abstract fun blockHash(serializedBlockHeader: UByteArray): UByteArray
Link copied to clipboard
abstract fun createBloomFilter(items: Array<Any>, falsePosRate: Double, capacity: Int, maxSize: Int, flags: Int = 0, tweak: Int = 1): ByteArray

Given an array of items, creates a bloom filter and returns it serialized. Typical items are addresses (just the raw 20 bytes), transaction hashes, and outpoints

Link copied to clipboard
abstract fun decode64(encoded: String): ByteArray
Link copied to clipboard
abstract fun decodeCashAddr(chainSelector: ChainSelector, addr: String): ByteArray
Link copied to clipboard
abstract fun decodeWifPrivateKey(chainSelector: ChainSelector, secretWIF: String): ByteArray

Decodes a private key provided in Satoshi's original fnormat

Link copied to clipboard
abstract fun deriveHd44ChildKey(secretSeed: ByteArray, purpose: Long, coinType: Long, account: Long, change: Boolean, index: Int): Pair<ByteArray, String>

This function calculates the BIP44 key from the specified path. BIP44 requires that purpose, coinType and account are "hardened". This function will automatically harden those parameters if you pass unhardened values. Therefore this function cannot be used for generalized (non-BIP44) child key derivation.

Link copied to clipboard
abstract fun encode64(data: ByteArray): String
Link copied to clipboard
abstract fun encodeCashAddr(chainSelector: ChainSelector, type: PayAddressType, data: ByteArray): String
Link copied to clipboard
abstract fun extractFromMerkleBlock(numTxes: Int, merkleProofPath: ByteArray, hashes: Array<ByteArray>): Array<ByteArray>?
Link copied to clipboard
open fun generateBip39SecretWords(bytes: ByteArray, wordList: Array<String> = englishWordList): String
Link copied to clipboard
abstract fun getPubKey(privateKey: ByteArray): ByteArray

abstract fun getPubKey(privateKey: UByteArray): UByteArray

Given a private key, return the corresponding (secp256k1) public key -- that is the privKey*G where G is the group generator

Link copied to clipboard

Returns the work -- that is the expected number of hashes to find a solution -- given the difficulty expressed in Bitcoin's "bits" notation

Link copied to clipboard
abstract fun groupIdFromAddr(chainSelector: ChainSelector, addr: String): ByteArray
Link copied to clipboard
abstract fun groupIdToAddr(chainSelector: ChainSelector, data: ByteArray): String
Link copied to clipboard
abstract fun hash160(data: ByteArray): ByteArray
abstract fun hash160(data: UByteArray): UByteArray

Calculates the RIPEMD160 of the SHA256 of data. Result is 20 bytes

Link copied to clipboard
abstract fun hash256(data: ByteArray): ByteArray
abstract fun hash256(data: UByteArray): UByteArray

Returns the double sha256 of data. Result is 32 bytes

Link copied to clipboard
abstract fun minDust(chain: ChainSelector): Long

Returns the minimum amount of native coins (finest unit) that must be in every UTXO for the passed blockchain

Link copied to clipboard
abstract fun secureRandomBytes(amt: Int): ByteArray
Link copied to clipboard
abstract fun sha256(data: ByteArray): ByteArray
abstract fun sha256(data: UByteArray): UByteArray

Returns the sha256 of data. Result is 32 bytes

Link copied to clipboard
abstract fun signBchTxOneInputUsingECDSA(txData: ByteArray, sigHashType: Int, inputIdx: Long, inputAmount: Long, prevoutScript: ByteArray, secret: ByteArray): ByteArray

Create an ECDSA signature for the passed transaction

Link copied to clipboard
abstract fun signBchTxOneInputUsingSchnorr(txData: ByteArray, sigHashType: Int, inputIdx: Long, inputAmount: Long, prevoutScript: ByteArray, secret: ByteArray): ByteArray

Create a Schnorr signature for the passed transaction

Link copied to clipboard
abstract fun signHashSchnorr(data: ByteArray, secret: ByteArray): ByteArray
abstract fun signHashSchnorr(data: UByteArray, secret: UByteArray): UByteArray
Link copied to clipboard
abstract fun signMessage(message: ByteArray, secret: ByteArray): ByteArray?

Sign a message using the same algorithm as the original bitcoin wallet's signmessage functionality

Link copied to clipboard
abstract fun signTxOneInputUsingSchnorr(txData: ByteArray, sigHashType: ByteArray, inputIdx: Long, inputAmount: Long, prevoutScript: ByteArray, secret: ByteArray): ByteArray

Create a Schnorr signature for the passed transaction

Link copied to clipboard
abstract fun txid(serializedTx: ByteArray): ByteArray
abstract fun txid(serializedTx: UByteArray): UByteArray
Link copied to clipboard
abstract fun txidem(serializedTx: ByteArray): ByteArray
abstract fun txidem(serializedTx: UByteArray): UByteArray
Link copied to clipboard
abstract fun verifyBlockHeader(chainSelector: ChainSelector, serializedBlockHeader: ByteArray): Boolean
abstract fun verifyBlockHeader(chainSelector: ChainSelector, serializedBlockHeader: UByteArray): Boolean
Link copied to clipboard
abstract fun verifyMessage(message: ByteArray, address: ByteArray, signature: ByteArray): ByteArray?

Verify a message using the same algorithm as the original bitcoin wallet's signmessage functionality