@did-btc1/method / IBitcoinRpc
Interface: IBitcoinRpc
Defined in: packages/method/src/bitcoin/interface.ts:28
Interface for the Bitcoin Core RPC client.
Methods
abandonTransaction()
> abandonTransaction(txid
): Promise
<void
>
Defined in: packages/method/src/bitcoin/interface.ts:33
Marks a transaction and its in-wallet descendants as abandoned, allowing their inputs to be respent.
Parameters
txid
string
Returns
Promise
<void
>
abortRescan()
> abortRescan(): Promise
<void
>
Defined in: packages/method/src/bitcoin/interface.ts:36
Stops the current wallet rescan triggered by an RPC call, such as by an importprivkey call.
Returns
Promise
<void
>
addMultiSigAddress()
> addMultiSigAddress(__namedParameters
): Promise
<string
>
Defined in: packages/method/src/bitcoin/interface.ts:39
Adds a multi-signature address with n required signatures and a set of keys.
Parameters
__namedParameters
Returns
Promise
<string
>
addWitnessAddress()
> addWitnessAddress(address
): Promise
<void
>
Defined in: packages/method/src/bitcoin/interface.ts:42
Adds a witness address for SegWit compatibility.
Parameters
address
string
Returns
Promise
<void
>
backupWallet()
> backupWallet(destination
): Promise
<void
>
Defined in: packages/method/src/bitcoin/interface.ts:45
Backs up the wallet file to a specified destination.
Parameters
destination
string
Returns
Promise
<void
>
bumpFee()
> bumpFee(txid
, options?
): Promise
<BumpFeeResult
>
Defined in: packages/method/src/bitcoin/interface.ts:48
Increases the fee of an unconfirmed transaction to improve its confirmation time.
Parameters
txid
string
options?
Returns
Promise
<BumpFeeResult
>
clearBanned()
> clearBanned(): Promise
<void
>
Defined in: packages/method/src/bitcoin/interface.ts:51
Removes all banned nodes from the ban list.
Returns
Promise
<void
>
combineRawTransaction()
> combineRawTransaction(txs
): Promise
<string
>
Defined in: packages/method/src/bitcoin/interface.ts:54
Combines multiple raw transactions into a single transaction.
Parameters
txs
string
[]
Returns
Promise
<string
>
command()?
> optional
command<R
>(methods
): Promise
<readonly R
[]>
Defined in: packages/method/src/bitcoin/interface.ts:30
Executes multiple commands in a batch request.
Type Parameters
R
R
extends unknown
Parameters
methods
Returns
Promise
<readonly R
[]>
createMultiSig()
> createMultiSig(nrequired
, keys
): Promise
<CreateMultiSigResult
>
Defined in: packages/method/src/bitcoin/interface.ts:57
Creates a multi-signature address with n required signatures and a set of keys.
Parameters
nrequired
number
keys
string
[]
Returns
Promise
<CreateMultiSigResult
>
createRawTransaction()
> createRawTransaction(inputs
, outputs
, locktime?
, replacable?
): Promise
<string
>
Defined in: packages/method/src/bitcoin/interface.ts:60
Creates a raw transaction spending specified inputs to specified outputs.
Parameters
inputs
outputs
locktime?
number
replacable?
boolean
Returns
Promise
<string
>
createWallet()
> createWallet(__namedParameters
): Promise
<CreateWalletResult
>
Defined in: packages/method/src/bitcoin/interface.ts:63
Creates a new wallet with various optional parameters.
Parameters
__namedParameters
Returns
Promise
<CreateWalletResult
>
decodeRawTransaction()
> decodeRawTransaction(hexstring
): Promise
<DecodedRawTransaction
>
Defined in: packages/method/src/bitcoin/interface.ts:74
Decodes a raw transaction hex string.
Parameters
hexstring
string
Returns
Promise
<DecodedRawTransaction
>
decodeScript()
> decodeScript(hexstring
): Promise
<ScriptDecoded
>
Defined in: packages/method/src/bitcoin/interface.ts:77
Decodes a hex-encoded script.
Parameters
hexstring
string
Returns
Promise
<ScriptDecoded
>
disconnectNode()
> disconnectNode(address?
, nodeid?
): Promise
<void
>
Defined in: packages/method/src/bitcoin/interface.ts:80
Disconnects a node by address or node ID.
Parameters
address?
string
nodeid?
number
Returns
Promise
<void
>
dumpPrivKey()
> dumpPrivKey(address
): Promise
<string
>
Defined in: packages/method/src/bitcoin/interface.ts:83
Reveals the private key corresponding to an address.
Parameters
address
string
Returns
Promise
<string
>
dumpWallet()
> dumpWallet(filename
): Promise
<{ filename
: string
; }>
Defined in: packages/method/src/bitcoin/interface.ts:86
Dumps all wallet keys and metadata to a file.
Parameters
filename
string
Returns
Promise
<{ filename
: string
; }>
encryptWallet()
> encryptWallet(passphrase
): Promise
<void
>
Defined in: packages/method/src/bitcoin/interface.ts:89
Encrypts the wallet with a passphrase.
Parameters
passphrase
string
Returns
Promise
<void
>
estimateSmartFee()
> estimateSmartFee(conf_target
, estimate_mode?
): Promise
<{ blocks?
: number
; errors?
: string
[]; feerate?
: number
; }>
Defined in: packages/method/src/bitcoin/interface.ts:92
Estimates the fee rate for a given confirmation target.
Parameters
conf_target
number
estimate_mode?
Returns
Promise
<{ blocks?
: number
; errors?
: string
[]; feerate?
: number
; }>
fundRawTransaction()
> fundRawTransaction(hexstring
, options
): Promise
<{ changepos
: number
; fee
: number
; hex
: string
; }>
Defined in: packages/method/src/bitcoin/interface.ts:98
Funds a raw transaction by adding necessary inputs and change.
Parameters
hexstring
string
options
Returns
Promise
<{ changepos
: number
; fee
: number
; hex
: string
; }>
getBlock()
> getBlock(__namedParameters
): Promise
<undefined
| BlockResponse
>
Defined in: packages/method/src/bitcoin/interface.ts:110
Gets detailed information about a specific block.
Parameters
__namedParameters
Returns
Promise
<undefined
| BlockResponse
>
getBlockchainInfo()
> getBlockchainInfo(): Promise
<ChainInfo
>
Defined in: packages/method/src/bitcoin/interface.ts:113
Retrieves general blockchain state info.
Returns
Promise
<ChainInfo
>
getBlockCount()
> getBlockCount(): Promise
<number
>
Defined in: packages/method/src/bitcoin/interface.ts:104
Returns the number of blocks in the longest blockchain.
Returns
Promise
<number
>
getBlockHash()
> getBlockHash(height
): Promise
<string
>
Defined in: packages/method/src/bitcoin/interface.ts:107
Gets the hash of a block at a given height.
Parameters
height
number
Returns
Promise
<string
>
getConnectionCount()
> getConnectionCount(): Promise
<number
>
Defined in: packages/method/src/bitcoin/interface.ts:116
Gets the number of active connections to other nodes.
Returns
Promise
<number
>
getDifficulty()
> getDifficulty(): Promise
<number
>
Defined in: packages/method/src/bitcoin/interface.ts:119
Gets the estimated network difficulty.
Returns
Promise
<number
>
getMempoolInfo()
> getMempoolInfo(): Promise
<MempoolInfo
>
Defined in: packages/method/src/bitcoin/interface.ts:122
Retrieves memory pool statistics.
Returns
Promise
<MempoolInfo
>
getMiningInfo()
> getMiningInfo(): Promise
<MiningInfo
>
Defined in: packages/method/src/bitcoin/interface.ts:125
Retrieves mining statistics.
Returns
Promise
<MiningInfo
>
getNewAddress()
> getNewAddress(account?
): Promise
<string
>
Defined in: packages/method/src/bitcoin/interface.ts:128
Gets a new Bitcoin address for receiving payments.
Parameters
account?
string
Returns
Promise
<string
>
getPeerInfo()
> getPeerInfo(): Promise
<PeerInfo
[]>
Defined in: packages/method/src/bitcoin/interface.ts:131
Gets detailed peer connection information.
Returns
Promise
<PeerInfo
[]>
sendRawTransaction()
> sendRawTransaction(hexstring
, maxfeerate?
, maxBurnAmount?
): Promise
<string
>
Defined in: packages/method/src/bitcoin/interface.ts:134
Sends raw transaction hex to the Bitcoin network.
Parameters
hexstring
string
maxfeerate?
string
| number
maxBurnAmount?
string
| number
Returns
Promise
<string
>
sendToAddress()
> sendToAddress(address
, amount
, comment?
, comment_to?
, subtreactfeefromamount?
, replaceable?
, conf_target?
, estimate_mode?
): Promise
<RawTransactionResponse
>
Defined in: packages/method/src/bitcoin/interface.ts:141
Sends bitcoins to a specified address.
Parameters
address
string
amount
number
comment?
string
comment_to?
string
subtreactfeefromamount?
boolean
replaceable?
boolean
conf_target?
number
estimate_mode?
Returns
Promise
<RawTransactionResponse
>
validateAddress()
> validateAddress(address
): Promise
<ValidateAddressResult
>
Defined in: packages/method/src/bitcoin/interface.ts:153
Validates a Bitcoin address.
Parameters
address
string
Returns
Promise
<ValidateAddressResult
>
verifyMessage()
> verifyMessage(address
, signature
, message
): Promise
<boolean
>
Defined in: packages/method/src/bitcoin/interface.ts:156
Verifies a signed message.
Parameters
address
string
signature
string
message
string
Returns
Promise
<boolean
>
walletLock()
> walletLock(passphrase
, timeout
): Promise
<void
>
Defined in: packages/method/src/bitcoin/interface.ts:159
Locks the wallet, requiring a passphrase to unlock.
Parameters
passphrase
string
timeout
number
Returns
Promise
<void
>