Skip to main content

Util RPCs

tokenviewAbout 3 min

Util RPCs

createmultisig

POST https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}

createmultisig nrequired ["key",...] ( "address_type" )

Creates a multi-signature address with n signature of m keys required.

It returns a json object with the address and redeemScript.

Parameters:

  • nrequired: Type: numeric, required. The number of required signatures out of the n keys.
  • keys: Type: json array, required. The hex-encoded public keys.
[
  "key",      (string) The hex-encoded public key
  ...
]

  • address_type: Type: string, optional, default=legacy. The address type to use. Options are “legacy”, “p2sh-segwit”, and “bech32”.

Returns:

{                            (json object)
  "address" : "str",         (string) The value of the new multisig address.
  "redeemScript" : "hex",    (string) The string value of the hex-encoded redemption script.
  "descriptor" : "str"       (string) The descriptor for this multisig
}

Request

curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{
    "jsonrpc": "2.0",
    "method": "createmultisig",
    "params": [
        2,
        "[\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\",\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\"]"
    ]
}'

Response


deriveaddresses

POST https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}

deriveaddresses "descriptor" ( range )

Derives one or more addresses corresponding to an output descriptor.

Examples of output descriptors are:

pkh(<pubkey>) P2PKH outputs for the given pubkey wpkh(<pubkey>) Native segwit P2PKH outputs for the given pubkey sh(multi(<n>,<pubkey>,<pubkey>,…)) P2SH-multisig outputs for the given threshold and pubkeys raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts

In the above, either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one or more path elements separated by “/”, where “h” represents a hardened child key.

For more information on output descriptors, see the documentation in the doc/descriptors.md file.

Parameters:

  • descriptor: Type: string, required. The descriptor.
  • range: Type: numeric or array, optional. If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive.

Returns:

[           (json array)
  "str",    (string) the derived addresses
  ...
]

Request

curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{
    "jsonrpc": "2.0",
    "method": "deriveaddresses",
    "params": []
}'

Response


estimatesmartfee

POST https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}

estimatesmartfee conf_target ( "estimate_mode" )

Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks if possible and return the number of blocks for which the estimate is valid. Uses virtual transaction size as defined in BIP 141 (witness data is discounted).

Parameters:

  • conf_target: Type: numeric, required. Confirmation target in blocks (1 - 1008).
  • estimate_mode: Type: string, optional, default=CONSERVATIVE. The fee estimate mode. Whether to return a more conservative estimate which also satisfies a longer history. A conservative estimate potentially returns a higher feerate and is more likely to be sufficient for the desired target, but is not as responsive to short term drops in the prevailing fee market. Must be one of: “UNSET” “ECONOMICAL” “CONSERVATIVE”

Returns:

{                   (json object)
  "feerate" : n,    (numeric, optional) estimate fee rate in BTC/kB (only present if no errors were encountered)
  "errors" : [      (json array, optional) Errors encountered during processing (if there are any)
    "str",          (string) error
    ...
  ],
  "blocks" : n      (numeric) block number where estimate was found
                    The request target will be clamped between 2 and the highest target
                    fee estimation is able to return based on how long it has been running.
                    An error is returned if not enough transactions and blocks
                    have been observed to make an estimate for any number of blocks.
}

Request

curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{
    "jsonrpc": "2.0",
    "method": "estimatesmartfee",
    "params": []
}'

Response


getdescriptorinfo

POST https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}

getdescriptorinfo "descriptor"

Analyses a descriptor.

Parameters:

  • descriptor: Type: string, required. The descriptor.

Returns:

{                                   (json object)
  "descriptor" : "str",             (string) The descriptor in canonical form, without private keys
  "checksum" : "str",               (string) The checksum for the input descriptor
  "isrange" : true|false,           (boolean) Whether the descriptor is ranged
  "issolvable" : true|false,        (boolean) Whether the descriptor is solvable
  "hasprivatekeys" : true|false     (boolean) Whether the input descriptor contained at least one private key
}

Request

curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{
    "jsonrpc": "2.0",
    "method": "getdescriptorinfo",
    "params": ["wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)"]
}'

Response

{
    "result": {
        "descriptor": "wpkh([d34db33f/84'/0'/0']0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)#n9g43y4k",
        "checksum": "qwlqgth7",
        "isrange": false,
        "issolvable": true,
        "hasprivatekeys": false
    },
    "error": null,
    "id": null
}

getindexinfo

POST https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}

getindexinfo ( "index_name" )

Returns the status of one or all available indices currently running in the node.

Parameters:

  • index_name: Type: string, optional. Filter results for an index with a specific name.

Returns:

{                               (json object)
  "name" : {                    (json object) The name of the index
    "synced" : true|false,      (boolean) Whether the index is synced or not
    "best_block_height" : n     (numeric) The block height to which the index is synced
  }
}

Request

curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{
    "jsonrpc": "2.0",
    "method": "getindexinfo",
    "params": []
}'

Response


signmessagewithprivkey

POST https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}

signmessagewithprivkey "privkey" "message"

Sign a message with the private key of an address.

Parameters:

  • privkey: Type: string, required. The private key to sign the message with.
  • message: Type: string, required. The message to create a signature of.

Returns:

  • str: Type: string. The signature of the message encoded in base 64.

Request

curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{
    "jsonrpc": "2.0",
    "method": "signmessagewithprivkey",
    "params": ["privkey", "my message"]
}'

Response


validateaddress

POST https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}

validateaddress "address"

Return information about the given bitcoin address.

Parameters:

  • address: Type: string, required. The bitcoin address to validate.

Returns:

{                               (json object)
  "isvalid" : true|false,       (boolean) If the address is valid or not. If not, this is the only property returned.
  "address" : "str",            (string) The bitcoin address validated
  "scriptPubKey" : "hex",       (string) The hex-encoded scriptPubKey generated by the address
  "isscript" : true|false,      (boolean) If the key is a script
  "iswitness" : true|false,     (boolean) If the address is a witness address
  "witness_version" : n,        (numeric, optional) The version number of the witness program
  "witness_program" : "hex"     (string, optional) The hex value of the witness program
}

Request

curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{
    "jsonrpc": "2.0",
    "method": "validateaddress",
    "params": ["bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl"]
}'

Response

{
    "result": {
        "isvalid": false
    },
    "error": null,
    "id": null
}

verifymessage

POST https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}

verifymessage "address" "signature" "message"

Verify a signed message.

Parameters:

  • address: Type: string, required. The bitcoin address to use for the signature.
  • signature: Type: string, required. The signature provided by the signer in base 64 encoding (see signmessage).
  • message: Type: string, required. The message that was signed.

Returns:

  • true|false: Type: boolean. If the signature is verified or not.

Request

curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{
    "jsonrpc": "2.0",
    "method": "verifymessage",
    "params": ["1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX", "signature", "my message"]
}'

Response


Last update: