import { IN3 } from '../../in3/sdk-wasm.js'; export declare class Btc { in3: IN3; /** initialiazes the Btc API * @param in3 - the incubed Client */ constructor(in3: IN3); /** returns a hex representation of the blockheader * @param hash - The block hash * @return the blockheader. * - verbose `0` or `false`: a hex string with 80 bytes representing the blockheader * - verbose `1` or `true`: an object representing the blockheader. * * * **Example** * * ```js * let result = await sdk.btc.getblockheaderAsHex("000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220") * // result = 3045022100ae5bd019a63aed404b743c9ebcc77fbaa657e481f745e4...f3255d * ``` * */ getblockheaderAsHex(hash: string): Promise; /** returns the blockheader * @param hash - The block hash * @return the blockheader. * - verbose `0` or `false`: a hex string with 80 bytes representing the blockheader * - verbose `1` or `true`: an object representing the blockheader. * * * **Example** * * ```js * let result = await sdk.btc.getblockheader("000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220") * // result = * // hash: 000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220 * // confirmations: 8268 * // height: 624958 * // version: 536928256 * // versionHex: 2000 * // merkleroot: d786a334ea8c65f39272d5b9be505ac3170f3904842bd52525538a9377b359cb * // time: 1586333924 * // mediantime: 1586332639 * // nonce: 1985217615 * // bits: 17143b41 * // difficulty: 13912524048945.91 * // chainwork: 00000000000000000000000000000000000000000e4c88b66c5ee78deff0d494 * // nTx: 33 * // previousblockhash: 00000000000000000013cba040837778744ce66961cfcf2e7c34bb3d194c7f49 * // nextblockhash: 0000000000000000000c799dc0e36302db7fbb471711f140dc308508ef19e343 * ``` * */ getblockheader(hash: string): Promise; /** returns a hex representation of the block * @param hash - The block hash * @return the block. * - verbose `0` or `false`: a hex string with 80 bytes representing the blockheader * - verbose `1` or `true`: an object representing the blockheader. * * * **Example** * * ```js * let result = await sdk.btc.getBlockAsHex("000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220") * // result = 3045022100ae5bd019a63aed404b743c9ebcc77fbaa657e481f745e4...f3255d * ``` * */ getBlockAsHex(hash: string): Promise; /** returns the block with transactionhashes * @param hash - The block hash * @return the block. * - verbose `0` or `false`: a hex string with 80 bytes representing the blockheader * - verbose `1` or `true`: an object representing the blockheader. * * * **Example** * * ```js * let result = await sdk.btc.getBlock("000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220") * // result = * // hash: 000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220 * // confirmations: 8268 * // height: 624958 * // version: 536928256 * // versionHex: 2000 * // merkleroot: d786a334ea8c65f39272d5b9be505ac3170f3904842bd52525538a9377b359cb * // time: 1586333924 * // mediantime: 1586332639 * // nonce: 1985217615 * // bits: 17143b41 * // difficulty: 13912524048945.91 * // chainwork: 00000000000000000000000000000000000000000e4c88b66c5ee78deff0d494 * // tx: * // - d79ffc80e07fe9e0083319600c59d47afe69995b1357be6e5dba035675780290 * // - ... * // - 6456819bfa019ba30788620153ea9a361083cb888b3662e2ff39c0f7adf16919 * // nTx: 33 * // previousblockhash: 00000000000000000013cba040837778744ce66961cfcf2e7c34bb3d194c7f49 * // nextblockhash: 0000000000000000000c799dc0e36302db7fbb471711f140dc308508ef19e343 * ``` * */ getBlock(hash: string): Promise; /** returns the block with full transactions * @param hash - The block hash * @return the block. * - verbose `0` or `false`: a hex string with 80 bytes representing the blockheader * - verbose `1` or `true`: an object representing the blockheader. * * * **Example** * * ```js * let result = await sdk.btc.getBlockWithTx("000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220") * // result = * // hash: 000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220 * // confirmations: 8268 * // height: 624958 * // version: 536928256 * // versionHex: 2000 * // merkleroot: d786a334ea8c65f39272d5b9be505ac3170f3904842bd52525538a9377b359cb * // time: 1586333924 * // mediantime: 1586332639 * // nonce: 1985217615 * // bits: 17143b41 * // difficulty: 13912524048945.91 * // chainwork: 00000000000000000000000000000000000000000e4c88b66c5ee78deff0d494 * // tx: * // - d79ffc80e07fe9e0083319600c59d47afe69995b1357be6e5dba035675780290 * // - ... * // - 6456819bfa019ba30788620153ea9a361083cb888b3662e2ff39c0f7adf16919 * // nTx: 33 * // previousblockhash: 00000000000000000013cba040837778744ce66961cfcf2e7c34bb3d194c7f49 * // nextblockhash: 0000000000000000000c799dc0e36302db7fbb471711f140dc308508ef19e343 * ``` * */ getBlockWithTx(hash: string): Promise; /** returns a hex representation of the tx * @param txid - The transaction id * @param blockhash - The block in which to look for the transaction * @return - verbose `0` or `false`: a string that is serialized, hex-encoded data for `txid` * - verbose `1` or `false`: an object representing the transaction. * * * **Example** * * ```js * let result = await sdk.btc.getRawTransactionAsHex("f3c06e17b04ef748ce6604ad68e5b9f68ca96914b57c2118a1bb9a09a194ddaf", true) * // result = 3045022100ae5bd019a63aed404b743c9ebcc77fbaa657e481f745e4...f3255d * ``` * */ getRawTransactionAsHex(txid: string, blockhash?: string): Promise; /** returns the raw transaction * @param txid - The transaction id * @param blockhash - The block in which to look for the transaction * @return - verbose `0` or `false`: a string that is serialized, hex-encoded data for `txid` * - verbose `1` or `false`: an object representing the transaction. * * * **Example** * * ```js * let result = await sdk.btc.getRawTransaction("f3c06e17b04ef748ce6604ad68e5b9f68ca96914b57c2118a1bb9a09a194ddaf", true) * // result = * // in_active_chain: true * // txid: f3c06e17b04ef748ce6604ad68e5b9f68ca96914b57c2118a1bb9a09a194ddaf * // hash: f3c06e17b04ef748ce6604ad68e5b9f68ca96914b57c2118a1bb9a09a194ddaf * // version: 1 * // size: 518 * // vsize: 518 * // weight: 2072 * // locktime: 0 * // vin: * // - txid: 0a74f6e5f99bc69af80da9f0d9878ea6afbfb5fbb2d43f1ff899bcdd641a098c * // vout: 0 * // scriptSig: * // asm: 30440220481f2b3a49b202e26c73ac1b7bce022e4a74aff08473228cc...254874 * // hex: 4730440220481f2b3a49b202e26c73ac1b7bce022e4a74aff08473228...254874 * // sequence: 4294967295 * // - txid: 869c5e82d4dfc3139c8a153d2ee126e30a467cf791718e6ea64120e5b19e5044 * // vout: 0 * // scriptSig: * // asm: 3045022100ae5bd019a63aed404b743c9ebcc77fbaa657e481f745e4...f3255d * // hex: 483045022100ae5bd019a63aed404b743c9ebcc77fbaa657e481f745...f3255d * // sequence: 4294967295 * // - txid: 8a03d29a1b8ae408c94a2ae15bef8329bc3d6b04c063d36b2e8c997273fa8eff * // vout: 1 * // scriptSig: * // asm: 304402200bf7c5c7caec478bf6d7e9c5127c71505034302056d1284...0045da * // hex: 47304402200bf7c5c7caec478bf6d7e9c5127c71505034302056d12...0045da * // sequence: 4294967295 * // vout: * // - value: 0.00017571 * // n: 0 * // scriptPubKey: * // asm: OP_DUP OP_HASH160 53196749b85367db9443ef9a5aec25cf0bdceedf OP_EQUALVERIFY * // OP_CHECKSIG * // hex: 76a91453196749b85367db9443ef9a5aec25cf0bdceedf88ac * // reqSigs: 1 * // type: pubkeyhash * // addresses: * // - 18aPWzBTq1nzs9o86oC9m3BQbxZWmV82UU * // - value: 0.00915732 * // n: 1 * // scriptPubKey: * // asm: OP_HASH160 8bb2b4b848d0b6336cc64ea57ae989630f447cba OP_EQUAL * // hex: a9148bb2b4b848d0b6336cc64ea57ae989630f447cba87 * // reqSigs: 1 * // type: scripthash * // addresses: * // - 3ERfvuzAYPPpACivh1JnwYbBdrAjupTzbw * // hex: 01000000038c091a64ddbc99f81f3fd4b2fbb5bfafa68e8...000000 * // blockhash: 000000000000000000103b2395f6cd94221b10d02eb9be5850303c0534307220 * // confirmations: 15307 * // time: 1586333924 * // blocktime: 1586333924 * ``` * */ getRawTransaction(txid: string, blockhash?: string): Promise; /** Returns the number of blocks in the longest blockchain. * @return the current blockheight * * **Example** * * ```js * let result = await sdk.btc.getblockcount() * // result = 640387 * ``` * */ getblockcount(): Promise; /** Returns the proof-of-work difficulty as a multiple of the minimum difficulty. * @param blocknumber - Can be the number of a certain block to get its difficulty. To get the difficulty of the latest block use `latest`, `earliest`, `pending` or leave `params` empty (Hint: Latest block always means `actual latest block` minus `in3.finality`) * @return - `blocknumber` is a certain number: the difficulty of this block * - `blocknumber` is `latest`, `earliest`, `pending` or empty: the difficulty of the latest block (`actual latest block` minus `in3.finality`) * * * **Example** * * ```js * let result = await sdk.btc.getdifficulty(631910) * // result = 15138043247082.88 * ``` * */ getdifficulty(blocknumber: number): Promise; /** Whenever the client is not able to trust the changes of the target (which is the case if a block can't be found in the verified target cache *and* the value of the target changed more than the client's limit `max_diff`) he will call this method. It will return additional proof data to verify the changes of the target on the side of the client. This is not a standard Bitcoin rpc-method like the other ones, but more like an internal method. * @param target_dap - the number of the difficulty adjustment period (dap) we are looking for * @param verified_dap - the number of the closest already verified dap * @param max_diff - the maximum target difference between 2 verified daps * @param max_dap - the maximum amount of daps between 2 verified daps * @param limit - the maximum amount of daps to return (`0` = no limit) - this is important for embedded devices since returning all daps might be too much for limited memory * @return A path of daps from the `verified_dap` to the `target_dap` which fulfils the conditions of `max_diff`, `max_dap` and `limit`. Each dap of the path is a `dap`-object with corresponding proof data. * * **Example** * * ```js * let result = await sdk.btc.proofTarget(230, 200, 5, 5, 15) * // result = * // - dap: 205 * // block: 0x04000000e62ef28cb9793f4f9cd2a67a58c1e7b593129b9b...0ab284 * // final: 0x04000000cc69b68b702321adf4b0c485fdb1f3d6c1ddd140...090a5b * // cbtx: 0x01000000...1485ce370573be63d7cc1b9efbad3489eb57c8...000000 * // cbtxMerkleProof: 0xc72dffc1cb4cbeab960d0d2bdb80012acf7f9c...affcf4 * // - dap: 210 * // block: 0x0000003021622c26a4e62cafa8e434c7e083f540bccc8392...b374ce * // final: 0x00000020858f8e5124cd516f4d5e6a078f7083c12c48e8cd...308c3d * // cbtx: 0x01000000...c075061b4b6e434d696e657242332d50314861...000000 * // cbtxMerkleProof: 0xf2885d0bac15fca7e1644c1162899ecd43d52b...93761d * // - dap: 215 * // block: 0x000000202509b3b8e4f98290c7c9551d180eb2a463f0b978...f97b64 * // final: 0x0000002014c7c0ed7c33c59259b7b508bebfe3974e1c99a5...eb554e * // cbtx: 0x01000000...90133cf94b1b1c40fae077a7833c0fe0ccc474...000000 * // cbtxMerkleProof: 0x628c8d961adb157f800be7cfb03ffa1b53d3ad...ca5a61 * // - dap: 220 * // block: 0x00000020ff45c783d09706e359dcc76083e15e51839e4ed5...ddfe0e * // final: 0x0000002039d2f8a1230dd0bee50034e8c63951ab812c0b89...5670c5 * // cbtx: 0x01000000...b98e79fb3e4b88aefbc8ce59e82e99293e5b08...000000 * // cbtxMerkleProof: 0x16adb7aeec2cf254db0bab0f4a5083fb0e0a3f...63a4f4 * // - dap: 225 * // block: 0x02000020170fad0b6b1ccbdc4401d7b1c8ee868c6977d6ce...1e7f8f * // final: 0x0400000092945abbd7b9f0d407fcccbf418e4fc20570040c...a9b240 * // cbtx: 0x01000000...cf6e8f930acb8f38b588d76cd8c3da3258d5a7...000000 * // cbtxMerkleProof: 0x25575bcaf3e11970ccf835e88d6f97bedd6b85...bfdf46 * ``` * */ proofTarget(target_dap: number, verified_dap: number, max_diff?: number, max_dap?: number, limit?: number): Promise; /** Returns the hash of the best (tip) block in the longest blockchain. * @return the hash of the best block * * **Example** * * ```js * let result = await sdk.btc.getbestblockhash() * // result = 000000000000000000039cbb4e842de0de9651852122b117d7ae6d7ac4fc1df6 * ``` * */ getbestblockhash(): Promise; } /** the blockheader. * - verbose `0` or `false`: a hex string with 80 bytes representing the blockheader * - verbose `1` or `true`: an object representing the blockheader. * */ export interface Btcblockheader { /** the block hash (same as provided) */ hash: string; /** The number of confirmations, or -1 if the block is not on the main chain */ confirmations: number; /** The block height or index */ height: number; /** The block version */ version: number; /** The block version formatted in hexadecimal */ versionHex: string; /** The merkle root ( 32 bytes ) */ merkleroot: string; /** The block time in seconds since epoch (Jan 1 1970 GMT) */ time: number; /** The median block time in seconds since epoch (Jan 1 1970 GMT) */ mediantime: number; /** The nonce */ nonce: number; /** The bits ( 4 bytes as hex) representing the target */ bits: string; /** The difficulty */ difficulty: number; /** Expected number of hashes required to produce the current chain (in hex) */ chainwork: string; /** The number of transactions in the block. */ nTx: number; /** The hash of the previous block */ previousblockhash: string; /** The hash of the next block */ nextblockhash: string; } /** the block. * - verbose `0` or `false`: a hex string with 80 bytes representing the blockheader * - verbose `1` or `true`: an object representing the blockheader. * */ export interface Btcblock { /** the block hash (same as provided) */ hash: string; /** The number of confirmations, or -1 if the block is not on the main chain */ confirmations: number; /** The block height or index */ height: bigint; /** The block version */ version: number; /** The block version formatted in hexadecimal */ versionHex: string; /** The merkle root ( 32 bytes ) */ merkleroot: string; /** The block time in seconds since epoch (Jan 1 1970 GMT) */ time: number; /** The median block time in seconds since epoch (Jan 1 1970 GMT) */ mediantime: number; /** The nonce */ nonce: number; /** The bits ( 4 bytes as hex) representing the target */ bits: string; /** The difficulty */ difficulty: number; /** Expected number of hashes required to produce the current chain (in hex) */ chainwork: string; /** The number of transactions in the block. */ nTx: number; /** the array of transactions either as ids (verbose=1) or full transaction (verbose=2) */ tx: string[]; /** The hash of the previous block */ previousblockhash: string; /** The hash of the next block */ nextblockhash: string; } /** the block. * - verbose `0` or `false`: a hex string with 80 bytes representing the blockheader * - verbose `1` or `true`: an object representing the blockheader. * */ export interface BtcblockWithTx { /** the block hash (same as provided) */ hash: string; /** The number of confirmations, or -1 if the block is not on the main chain */ confirmations: number; /** The block height or index */ height: number; /** The block version */ version: number; /** The block version formatted in hexadecimal */ versionHex: string; /** The merkle root ( 32 bytes ) */ merkleroot: string; /** The block time in seconds since epoch (Jan 1 1970 GMT) */ time: number; /** The median block time in seconds since epoch (Jan 1 1970 GMT) */ mediantime: number; /** The nonce */ nonce: number; /** The bits ( 4 bytes as hex) representing the target */ bits: string; /** The difficulty */ difficulty: number; /** Expected number of hashes required to produce the current chain (in hex) */ chainwork: string; /** The number of transactions in the block. */ nTx: number; /** the array of transactions either as ids (verbose=1) or full transaction (verbose=2) */ tx: Btctransaction[]; /** The hash of the previous block */ previousblockhash: string; /** The hash of the next block */ nextblockhash: string; } /** the array of transactions either as ids (verbose=1) or full transaction (verbose=2) */ export interface Btctransaction { /** txid */ txid: string; /** Whether specified block is in the active chain or not (only present with explicit "blockhash" argument) */ in_active_chain: boolean; /** The serialized, hex-encoded data for `txid` */ hex: string; /** The transaction hash (differs from txid for witness transactions) */ hash: string; /** The serialized transaction size */ size: number; /** The virtual transaction size (differs from size for witness transactions) */ vsize: number; /** The transaction's weight (between `vsize`\*4-3 and `vsize`\*4) */ weight: number; /** The version */ version: number; /** The lock time */ locktime: number; /** array of json objects of incoming txs to be used */ vin: BtcVin[]; /** array of json objects describing the tx outputs */ vout: BtcVout[]; /** the block hash */ blockhash: string; /** The confirmations */ confirmations: number; /** The block time in seconds since epoch (Jan 1 1970 GMT) */ blocktime: number; /** Same as "blocktime" */ time: number; } /** array of json objects of incoming txs to be used */ export interface BtcVin { /** the transaction id */ txid: string; /** the index of the transaction out to be used */ vout: number; /** the script */ scriptSig: BtcScriptSig; /** The script sequence number */ sequence: number; /** hex-encoded witness data (if any) */ txinwitness: string[]; } /** the script */ export interface BtcScriptSig { /** the asm-codes */ asm: string; /** hex representation */ hex: string; } /** array of json objects describing the tx outputs */ export interface BtcVout { /** The Value in BTC */ value: number; /** the index */ n: number; /** the script pubkey */ scriptPubKey: BtcScriptPubKey; } /** the script pubkey */ export interface BtcScriptPubKey { /** asm */ asm: string; /** hex representation of the script */ hex: string; /** the required signatures */ reqSigs: number; /** The type, eg 'pubkeyhash' */ type: string; /** Array of address(each representing a bitcoin adress) */ addresses: string[]; } /** A path of daps from the `verified_dap` to the `target_dap` which fulfils the conditions of `max_diff`, `max_dap` and `limit`. Each dap of the path is a `dap`-object with corresponding proof data. */ export interface BtcProofTarget { /** the difficulty adjustement period */ dap: number; /** the first blockheader */ block: string; /** the finality header */ final: string; /** the coinbase transaction as hex */ cbtx: string; /** the coinbasetx merkle proof */ cbtxMerkleProof: string; } export default Btc;