qbit-rpc
    Preparing search index...

    Variable requestsConst

    requests: {
        backupWallet: (destination: string) => RpcRequest<null>;
        getBalances: () => RpcRequest<WalletBalances>;
        getBestBlockHash: () => RpcRequest<string>;
        getBlockchainInfo: () => RpcRequest<BlockchainInfo>;
        getBlockCount: () => RpcRequest<number>;
        getBlockHash: (height: number) => RpcRequest<string>;
        getChainTips: () => RpcRequest<ChainTip[]>;
        getMempoolEntry: (txid: string) => RpcRequest<MempoolEntry>;
        getMempoolInfo: () => RpcRequest<MempoolInfo>;
        getMiningInfo: () => RpcRequest<MiningInfo>;
        getNetworkInfo: () => RpcRequest<NetworkInfo>;
        getRawMempool: () => RpcRequest<string[]>;
        getRawMempoolSequence: () => RpcRequest<MempoolSnapshot>;
        getRawMempoolVerbose: () => RpcRequest<Record<string, MempoolEntry>>;
        getWalletInfo: () => RpcRequest<WalletInfo>;
        listLockUnspent: () => RpcRequest<Outpoint[]>;
        listWalletDir: () => RpcRequest<WalletDirEntry[]>;
        validateAddress: (address: string) => RpcRequest<AddressValidation>;
        walletLock: () => RpcRequest<null>;
        walletPassphrase: (
            passphrase: string,
            timeoutSeconds: number,
        ) => RpcRequest<null>;
        walletPassphraseChange: (
            oldPassphrase: string,
            newPassphrase: string,
        ) => RpcRequest<null>;
        checkBlockProposal(blockHex: string): RpcRequest<BlockSubmissionResult>;
        createAuxBlock(payoutAddress: string): RpcRequest<AuxBlock>;
        createWallet(
            walletName: string,
            options?: {
                avoidReuse?: boolean;
                blank?: boolean;
                disablePrivateKeys?: boolean;
                loadOnStartup?: boolean;
                passphrase?: string;
            },
        ): RpcRequest<LoadedWallet>;
        deriveAddresses(
            descriptor: string,
            options?: { range?: DescriptorRange },
        ): RpcRequest<string[]>;
        estimateSmartFee(
            confTarget: number,
            options?: { mode?: FeeEstimateMode },
        ): RpcRequest<SmartFeeEstimate>;
        finalizePsbt(
            psbt: string,
            options?: { extract?: boolean },
        ): RpcRequest<FinalizedPsbt>;
        getAddressInfo(address: string): RpcRequest<AddressInfo>;
        getBlock(blockHash: string): RpcRequest<Block>;
        getBlockHeader(blockHash: string): RpcRequest<BlockHeader>;
        getBlockHex(blockHash: string): RpcRequest<string>;
        getBlockTemplate(
            options?: {
                capabilities?: readonly string[];
                rules?: readonly string[];
            },
        ): RpcRequest<BlockTemplate>;
        getBlockWithTransactions(
            blockHash: string,
        ): RpcRequest<BlockWithTransactions>;
        getConfirmationTarget(
            valueBits: bigint,
            options?: {
                btcHashrate?: number;
                mergeMiningPct?: number;
                securityLevel?: SecurityLevel;
            },
        ): RpcRequest<ConfirmationTarget>;
        getDescriptorInfo(descriptor: string): RpcRequest<DescriptorInfo>;
        getNewAddress(
            options?: { addressType?: AddressType; label?: string },
        ): RpcRequest<string>;
        getRawChangeAddress(
            options?: { addressType?: AddressType },
        ): RpcRequest<string>;
        getRawTransaction(
            txid: string,
            options?: { blockHash?: string },
        ): RpcRequest<string>;
        getRawTransactionVerbose(
            txid: string,
            options?: { blockHash?: string },
        ): RpcRequest<DecodedTransaction>;
        getTransaction(txid: string): RpcRequest<WalletTransaction>;
        getTxOut(
            txid: string,
            vout: number,
            options?: { includeMempool?: boolean },
        ): RpcRequest<TxOut | null>;
        getTxSpendingPrevout(
            outputs: readonly Outpoint[],
        ): RpcRequest<TxSpendingPrevout[]>;
        importDescriptors(
            descriptors: readonly DescriptorImport[],
        ): RpcRequest<DescriptorImportResult[]>;
        keypoolRefill(options?: { newSize?: number }): RpcRequest<null>;
        listSinceBlock(
            options?: ListSinceBlockOptions,
        ): RpcRequest<SinceBlockHistory>;
        listTransactions(
            options?: ListTransactionsOptions,
        ): RpcRequest<WalletHistoryEntry[]>;
        listUnspent(options?: ListUnspentOptions): RpcRequest<UnspentOutput[]>;
        loadWallet(
            filename: string,
            options?: { loadOnStartup?: boolean },
        ): RpcRequest<LoadedWallet>;
        lockUnspent(
            outputs: readonly Outpoint[],
            options?: { persistent?: boolean },
        ): RpcRequest<true>;
        psbtBumpFee(
            txid: string,
            options?: PsbtBumpFeeOptions,
        ): RpcRequest<BumpedPsbt>;
        raw(method: string, params?: readonly unknown[]): RpcRequest<unknown>;
        rescanBlockchain(
            options?: { startHeight?: number; stopHeight?: number },
        ): RpcRequest<RescanResult>;
        sendRawTransaction(
            hexTx: string,
            options?: { maxBurnAmountBits?: bigint; maxFeeRateBitsPerKvB?: bigint },
        ): RpcRequest<string>;
        signDataPqcHash(
            address: string,
            messageHash: string,
            options?: {
                controlBlock?: string;
                includePqcUsage?: boolean;
                leafScript?: string;
                pubkey?: string;
            },
        ): RpcRequest<DataPqcHashSignature>;
        submitAuxBlock(
            blockHash: string,
            auxpowHex: string,
        ): RpcRequest<BlockSubmissionResult>;
        submitBlock(blockHex: string): RpcRequest<BlockSubmissionResult>;
        submitPackage(
            rawTxs: readonly string[],
            options?: { maxBurnAmountBits?: bigint; maxFeeRateBitsPerKvB?: bigint },
        ): RpcRequest<PackageSubmission>;
        testMempoolAccept(
            rawTxs: readonly string[],
            options?: { maxFeeRateBitsPerKvB?: bigint },
        ): RpcRequest<MempoolAcceptance[]>;
        unloadWallet(
            walletName: string,
            options?: { loadOnStartup?: boolean },
        ): RpcRequest<UnloadedWallet>;
        unlockUnspent(outputs: readonly Outpoint[]): RpcRequest<true>;
        verifyDataPqcHash(
            proof: DataPqcHashProof,
        ): RpcRequest<DataPqcHashVerification>;
        waitForBlockHeight(height: number, waitMs: number): RpcRequest<BlockRef>;
        waitForNewBlock(
            waitMs: number,
            options?: { currentTip?: string },
        ): RpcRequest<BlockRef>;
        walletCreateFundedPsbt(
            args: WalletCreateFundedPsbtArgs,
        ): RpcRequest<FundedPsbt>;
        walletProcessPsbt(
            psbt: string,
            options?: {
                bip32derivs?: boolean;
                finalize?: boolean;
                sighashType?: SighashType;
                sign?: boolean;
            },
        ): RpcRequest<ProcessedPsbt>;
    } = ...

    Request builders for every typed method. Each validates its arguments (throwing TypeError or RangeError before anything is sent) and returns an RpcRequest carrying the result parser. Use them with QbitRpcClient.batch; the client's methods of the same name use them too.

    Type Declaration

    • backupWallet: (destination: string) => RpcRequest<null>

      Copy the wallet to destination, a file path on the node's host, which it overwrites; a relative one is resolved against qbitd's working directory. qbit Core v1.0.0 refuses a directory, and a path whose directory does not exist, with RpcError -4.

    • getBalances: () => RpcRequest<WalletBalances>

      The wallet's balances, in bits.

    • getBestBlockHash: () => RpcRequest<string>

      The hash of the active chain's tip.

    • getBlockchainInfo: () => RpcRequest<BlockchainInfo>

      getblockchaininfo: the chain, its tip, the node's sync state and the activation state of qbit's rules.

    • getBlockCount: () => RpcRequest<number>

      The height of the active chain's tip; the genesis block is 0.

    • getBlockHash: (height: number) => RpcRequest<string>

      The hash of the active chain's block at height. Rejects with RpcError -8 for a height past the tip.

    • getChainTips: () => RpcRequest<ChainTip[]>

      Every block tip the node knows: the active chain's, once, and those of other branches.

    • getMempoolEntry: (txid: string) => RpcRequest<MempoolEntry>

      Rejects with RpcError code -5 when the transaction is not in the mempool.

    • getMempoolInfo: () => RpcRequest<MempoolInfo>

      getmempoolinfo: the mempool's size, fee floor and limits.

    • getMiningInfo: () => RpcRequest<MiningInfo>

      getmininginfo: the tip's difficulty, the network hashrate and the next block's target.

    • getNetworkInfo: () => RpcRequest<NetworkInfo>

      getnetworkinfo: the node's version, connections and relay fee rates.

    • getRawMempool: () => RpcRequest<string[]>

      The txids in the mempool.

    • getRawMempoolSequence: () => RpcRequest<MempoolSnapshot>

      The txids in the mempool and the mempool sequence they stand at, to line up with the ZMQ sequence topic.

    • getRawMempoolVerbose: () => RpcRequest<Record<string, MempoolEntry>>

      Every mempool entry, by txid. A full mempool's reply can pass the client's maxResponseBytes.

    • getWalletInfo: () => RpcRequest<WalletInfo>

      getwalletinfo: the wallet's state, its lock and any rescan included.

    • listLockUnspent: () => RpcRequest<Outpoint[]>

      The outputs lockUnspent or walletCreateFundedPsbt's lockUnspents locked, persistent or not.

    • listWalletDir: () => RpcRequest<WalletDirEntry[]>

      The wallets in the node's wallet directory, loaded or not.

    • validateAddress: (address: string) => RpcRequest<AddressValidation>

      Whether address is valid on the node's chain, and what it pays to. Needs no wallet.

    • walletLock: () => RpcRequest<null>

      Lock the wallet; see QbitRpcClient.walletLock for its deadline.

    • walletPassphrase: (passphrase: string, timeoutSeconds: number) => RpcRequest<null>

      Unlocks the wallet for timeoutSeconds (qbit Core caps it at 100,000,000). The passphrase is never logged or put in an error.

    • walletPassphraseChange: (oldPassphrase: string, newPassphrase: string) => RpcRequest<null>

      Change an encrypted wallet's passphrase. Neither passphrase is ever logged or put in an error. Rejects with RpcError -14 for a wrong old passphrase, and -15 for an unencrypted wallet.

    • checkBlockProposal: function
    • createAuxBlock: function
      • Ask for a merge-mining candidate paying its coinbase to payoutAddress, which must be a P2MR address (RpcError -5 otherwise). The reply does not name the address, so nothing can check it against the request: the coinbase shows it once the block is accepted. The node holds the candidate in a cache until its parent leaves the tip, -auxpowtemplateexpiry or -auxpowtemplatecachelimit. An unknown outcome names nothing: ask again.

        Parameters

        • payoutAddress: string

        Returns RpcRequest<AuxBlock>

    • createWallet: function
      • Create and load a wallet; a name with a path creates it there. With passphrase it is encrypted, never echoed, and its first unlock runs its deferred keypool top-up (see walletPassphrase); an empty one is refused, as qbit Core would create the wallet unencrypted. A failure after sending is an RpcUnknownOutcomeError: listWalletDir() shows whether it exists. Rejects with RpcError -4 when it exists already.

        Parameters

        • walletName: string
        • Optionaloptions: {
              avoidReuse?: boolean;
              blank?: boolean;
              disablePrivateKeys?: boolean;
              loadOnStartup?: boolean;
              passphrase?: string;
          }

        Returns RpcRequest<LoadedWallet>

    • deriveAddresses: function
      • The addresses a descriptor derives, one per index of range, which a ranged descriptor (one with *) needs and any other refuses. The descriptor needs its checksum. On a P2MR chain a ranged descriptor derives from private key material, pqc(<xprv>/...): it is redacted from the node's error as getDescriptorInfo's is. A multipath descriptor (<0;1>) is refused: derive each of getDescriptorInfo()'s multipathExpansion.

        Parameters

        Returns RpcRequest<string[]>

    • estimateSmartFee: function
    • finalizePsbt: function
    • getAddressInfo: function
    • getBlock: function
      • getblock at verbosity 1: the header's fields, sizes and txids, checked against blockHash. RpcError -5 for an unknown block; -1 for one pruned, or whose witness data was pruned.

        Parameters

        • blockHash: string

        Returns RpcRequest<Block>

    • getBlockHeader: function
    • getBlockHex: function
      • getblock at verbosity 0: the block as stored, as hex, its header checked to hash to blockHash. A block whose witness data was pruned comes without it.

        Parameters

        • blockHash: string

        Returns RpcRequest<string>

    • getBlockTemplate: function
      • The data to build the next permissionless block from. rules are those the miner understands, ['segwit'] by default (QbitRpcClient.getBlockTemplate adds signet on signet); it must hold segwit, which qbit Core requires, and on signet also signet. qbit Core v1.0.0 does not read capabilities. On main, RpcError -9 with no peers and -10 while the node syncs. See Mining.

        Parameters

        • Optionaloptions: { capabilities?: readonly string[]; rules?: readonly string[] }

        Returns RpcRequest<BlockTemplate>

    • getBlockWithTransactions: function
    • getConfirmationTarget: function
      • How many confirmations to wait for before crediting valueBits, from qbit Core's security model. securityLevel defaults to medium; mergeMiningPct (0 to 1) and btcHashrate (H/s, above 0) replace the node's own inputs to the model.

        Parameters

        • valueBits: bigint
        • Optionaloptions: { btcHashrate?: number; mergeMiningPct?: number; securityLevel?: SecurityLevel }

        Returns RpcRequest<ConfirmationTarget>

    • getDescriptorInfo: function
      • Analyse a descriptor: its canonical form, without private keys, and its checksum, checked here against the descriptor. The checksum may be left out. A descriptor can hold private keys: they travel only in the request body, and the node's error, which can quote a key, is redacted.

        Parameters

        • descriptor: string

        Returns RpcRequest<DescriptorInfo>

    • getNewAddress: function
      • A new receiving address from the wallet's external keypool, listed under label (the default label, '', when left out; qbit Core reserves *). See AddressType for the types each chain offers; one the chain or the wallet does not offer rejects with RpcError code -5, and a wallet with no keys with code -4. On regtest, a wallet encrypted at creation rejects with code -12 unless addressType is p2mr.

        Parameters

        • Optionaloptions: { addressType?: AddressType; label?: string }

        Returns RpcRequest<string>

    • getRawChangeAddress: function
      • A new address from the wallet's internal (change) keypool. See AddressType for the types each chain offers; one the chain or the wallet does not offer rejects with RpcError code -5. On regtest, a wallet encrypted at creation rejects with code -12 unless addressType is p2mr or the node runs with -changetype=p2mr.

        Parameters

        Returns RpcRequest<string>

    • getRawTransaction: function
      • The serialized transaction as hex, checked to hash to txid. Without -txindex, only mempool transactions or ones in blockHash.

        Parameters

        • txid: string
        • Optionaloptions: { blockHash?: string }

        Returns RpcRequest<string>

    • getRawTransactionVerbose: function
    • getTransaction: function
    • getTxOut: function
      • An unspent output, or null when it is spent or does not exist. With includeMempool (the node's default, true), outputs of mempool transactions are found and outputs spent in the mempool are not. vout is 0 to 4,294,967,295: qbit Core reads it as an unsigned 32-bit integer.

        Parameters

        • txid: string
        • vout: number
        • Optionaloptions: { includeMempool?: boolean }

        Returns RpcRequest<TxOut | null>

    • getTxSpendingPrevout: function
    • importDescriptors: function
    • keypoolRefill: function
      • Derive keys until each active descriptor's keypool holds newSize (default -keypool, 1,000). The default deadline is 120 s: see Wallet administration. Needs the wallet unlocked (RpcError -13).

        Parameters

        • Optionaloptions: { newSize?: number }

        Returns RpcRequest<null>

    • listSinceBlock: function
    • listTransactions: function
    • listUnspent: function
    • loadWallet: function
      • Load a wallet from the wallet directory, or a path. loadOnStartup true adds it to the node's startup list and false removes it. Rejects with RpcError -35 when it is loaded already, and -18 when it does not exist.

        Parameters

        • filename: string
        • Optionaloptions: { loadOnStartup?: boolean }

        Returns RpcRequest<LoadedWallet>

    • lockUnspent: function
      • Lock wallet outputs against automatic coin selection (lockunspent with unlock false). A lock is kept in memory and gone after a node restart, unless persistent is set: then it is written to the wallet and loaded again on start. The node checks every output first and rejects with RpcError code -8, changing nothing, when one is unknown, spent or already locked; with persistent, an output already locked is locked again, persistently. outputs must not be empty.

        Parameters

        • outputs: readonly Outpoint[]
        • Optionaloptions: { persistent?: boolean }

        Returns RpcRequest<true>

    • psbtBumpFee: function
      • An unsigned replacement for the wallet's unconfirmed transaction txid, paying a higher fee. It spends every input of the original and may add more; nothing is signed or sent. Sign it with walletProcessPsbt, store the hex, then sendRawTransaction. It needs the wallet unlocked (RpcError -13 otherwise). Side-effecting all the same: when the original has no change output the wallet recognises, or outputs leave out its change address, each call takes change keys from the keypool for good. A lost reply is an RpcUnknownOutcomeError; calling again is safe, at worst using up more change keys. The change position is random, so a repeat call can return another transaction. Rejects with RpcError -5 for a transaction the wallet does not know, -8 for a fee rate too low or a transaction with descendants, -1 once the original or a replacement is mined (an input "is already spent"), and -4 for insufficient funds or a fee above -maxtxfee.

        Parameters

        Returns RpcRequest<BumpedPsbt>

    • raw: function
      • Any allowlisted method, untyped: the result keeps every number as a JsonNumber. For sendrawtransaction and submitpackage the txids are computed from the hex, as the typed methods do, and for submitblock, submitheader (opened with extraMethods) and submitauxblock the block hash, so an unknown outcome still names them. For a long poll (waitfornewblock, waitforblockheight, waitforblock) the wait is read from its timeout parameter, which must be 1 to 3,590,000 ms: absent or 0, the node would wait with no end, so it is a RangeError. The call's deadline is then at least the wait plus 10 s, as for the typed long polls. When the client sends it, it refuses an option qbit Core accepts and then ignores (a TypeError), and redacts the node's error about importdescriptors, deriveaddresses or getdescriptorinfo of the key material of the descriptors sent, as for the typed methods; an importdescriptors result is the node's as it is, and can quote a descriptor in full.

        The params are serialized here, once, and the request holds them as they will be sent: parsed back without loss, every number a JsonNumber and every object without a prototype. So a toJSON or a getter in them runs once, and what the client checks when it sends them is what it sends; the txids and the wait are read from them too. The depth limit counts the request envelope they are sent in, as call() sends them; batch() refuses an entry its array takes over the limit.

        Parameters

        • method: string
        • params: readonly unknown[] = []

        Returns RpcRequest<unknown>

    • rescanBlockchain: function
      • Rescan the chain from startHeight (default 0) to stopHeight (default the tip) for the wallet's transactions. The default deadline is 120 s: see Wallet administration. Rejects with RpcError -8 for a height past the wallet's tip, -4 while a rescan runs, and -13 while the wallet is locked.

        Parameters

        • Optionaloptions: { startHeight?: number; stopHeight?: number }

        Returns RpcRequest<RescanResult>

    • sendRawTransaction: function
      • Returns the txid. A failure after the request may have reached the node is an RpcUnknownOutcomeError. maxFeeRateBitsPerKvB caps the fee rate, 1n to 99,999,999n bits per 1,000 vbytes; left out, qbit Core's default cap of 0.1 QBT/kvB (10,000,000n) applies. 0n is refused: qbit Core reads 0 as no cap at all. maxBurnAmountBits (default 0n) is the most the transaction may send to provably unspendable outputs.

        Parameters

        • hexTx: string
        • Optionaloptions: { maxBurnAmountBits?: bigint; maxFeeRateBitsPerKvB?: bigint }

        Returns RpcRequest<string>

    • signDataPqcHash: function
      • Sign a 32-byte hash with the PQC key that a wallet P2MR address commits to, for sign-in or attestation: verifyDataPqcHash takes the result as it is. Every signature counts against the key's signature budget (2^30), so a failure after sending is an RpcUnknownOutcomeError, and a call again signs again. includePqcUsage adds the key's budget fields, which qbit Core advises enabling only for local diagnostics. pubkey, leafScript and controlBlock choose the leaf when the address commits to more than one. Rejects with RpcError -13 while the wallet is locked, and -4 for an address the wallet does not have.

        Parameters

        • address: string
        • messageHash: string
        • Optionaloptions: {
              controlBlock?: string;
              includePqcUsage?: boolean;
              leafScript?: string;
              pubkey?: string;
          }

        Returns RpcRequest<DataPqcHashSignature>

    • submitAuxBlock: function
    • submitBlock: function
      • Submit a solved block, whole, as hex. Null if it was accepted, or a BlockSubmissionReason: duplicate and inconclusive are no refusals. RpcError -22 for hex that does not decode as a block. A failure after the request may have reached the node is an RpcUnknownOutcomeError naming the block in blockHash, the hash of the hex's 80-byte header, when it holds one. Look it up with getBlockHeader, or submit it again: a block the node has answers duplicate.

        Parameters

        • blockHex: string

        Returns RpcRequest<BlockSubmissionResult>

    • submitPackage: function
      • Submit up to 25 signed transactions as one package, parents first and the child last, so a child's fee can pay for its parents (CPFP). A refusal is in the result, and may be partial: see PackageSubmission. A failure after the request may have reached the node is an RpcUnknownOutcomeError naming the package in txids. maxFeeRateBitsPerKvB and maxBurnAmountBits are as for requests.sendRawTransaction, each transaction checked: 0n as a fee-rate cap is refused.

        Parameters

        • rawTxs: readonly string[]
        • Optionaloptions: { maxBurnAmountBits?: bigint; maxFeeRateBitsPerKvB?: bigint }

        Returns RpcRequest<PackageSubmission>

    • testMempoolAccept: function
      • Whether the mempool would accept each transaction, without broadcasting. maxFeeRateBitsPerKvB caps the fee rate, 1n to 99,999,999n bits per 1,000 vbytes; left out, qbit Core's default cap of 0.1 QBT/kvB (10,000,000n) applies. 0n is refused: qbit Core reads 0 as no cap at all.

        Parameters

        • rawTxs: readonly string[]
        • Optionaloptions: { maxFeeRateBitsPerKvB?: bigint }

        Returns RpcRequest<MempoolAcceptance[]>

    • unloadWallet: function
      • Unload a wallet. With a client wallet, the name must be that one (-8 otherwise). The node answers once every call still running on the wallet has ended, so its default deadline is 120 s. Rejects with RpcError -18 when it is not loaded, and -4 while it rescans.

        Parameters

        • walletName: string
        • Optionaloptions: { loadOnStartup?: boolean }

        Returns RpcRequest<UnloadedWallet>

    • unlockUnspent: function
      • Unlock wallet outputs (lockunspent with unlock true), whether they were locked persistently or in memory only. The node checks every output first and rejects with RpcError code -8, changing nothing, when one is unknown, spent or not locked. outputs must not be empty: qbit Core unlocks nothing for an empty list and every output when the list is left out, which is call('lockunspent', [true]).

        Parameters

        Returns RpcRequest<true>

    • verifyDataPqcHash: function
    • waitForBlockHeight: function
    • waitForNewBlock: function
      • Hold the request until the tip differs from options.currentTip (left out, from the tip when the node runs the call: a block found between two calls is missed, and the client does not retry it) or waitMs (1 to 3,590,000) has passed, then return the tip. A returned tip equal to the one passed means the wait ran out. A tip that is not the node's returns at once. See Long polls.

        Parameters

        • waitMs: number
        • Optionaloptions: { currentTip?: string }

        Returns RpcRequest<BlockRef>

    • walletCreateFundedPsbt: function
    • walletProcessPsbt: function
      • Signs (by default) and finalizes what the wallet can. A failure after sending is an RpcUnknownOutcomeError.

        Parameters

        • psbt: string
        • Optionaloptions: {
              bip32derivs?: boolean;
              finalize?: boolean;
              sighashType?: SighashType;
              sign?: boolean;
          }

        Returns RpcRequest<ProcessedPsbt>