Rawtransactions RPCs
Rawtransactions RPCs
analyzepsbt
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
analyzepsbt "psbt"
Analyzes and provides information about the current status of a PSBT and its inputs.
请求参数说明:
- psbt: Type: string, required. A base64 string of a PSBT.
应答字段说明:
{ (json object)
"inputs" : [ (json array)
{ (json object)
"has_utxo" : true|false, (boolean) Whether a UTXO is provided
"is_final" : true|false, (boolean) Whether the input is finalized
"missing" : { (json object, optional) Things that are missing that are required to complete this input
"pubkeys" : [ (json array, optional)
"hex", (string) Public key ID, hash160 of the public key, of a public key whose BIP 32 derivation path is missing
...
],
"signatures" : [ (json array, optional)
"hex", (string) Public key ID, hash160 of the public key, of a public key whose signature is missing
...
],
"redeemscript" : "hex", (string, optional) Hash160 of the redeemScript that is missing
"witnessscript" : "hex" (string, optional) SHA256 of the witnessScript that is missing
},
"next" : "str" (string, optional) Role of the next person that this input needs to go to
},
...
],
"estimated_vsize" : n, (numeric, optional) Estimated vsize of the final signed transaction
"estimated_feerate" : n, (numeric, optional) Estimated feerate of the final signed transaction in BTC/kB. Shown only if all UTXO slots in the PSBT have been filled
"fee" : n, (numeric, optional) The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled
"next" : "str", (string) Role of the next person that this psbt needs to go to
"error" : "str" (string, optional) Error message (if there is one)
}
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "analyzepsbt", "params": ["psbt"]}'
Response
combinepsbt
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
combinepsbt ["psbt",...]
Combine multiple partially signed Bitcoin transactions into one transaction.
Implements the Combiner role.
请求参数说明:
- txs: Type: json array, required. The base64 strings of partially signed transactions.
[
"psbt", (string) A base64 string of a PSBT
...
]
应答字段说明:
- str: Type: string.The base64-encoded partially signed transaction.
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "combinepsbt", "params": ["psbt"]}'
Response
combinerawtransaction
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
combinerawtransaction ["hexstring",...]
Combine multiple partially signed transactions into one transaction.
The combined transaction may be another partially signed transaction or a fully signed transaction.
请求参数说明:
- txs: Type: json array, required. The hex strings of partially signed transactions.
[
"hexstring", (string) A hex-encoded raw transaction
...
]
应答字段说明:
- str: Type: string. The hex-encoded raw transaction with signature(s).
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "combinerawtransaction", "params": ["hexstring"]}'
Response
converttopsbt
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
converttopsbt "hexstring" ( permitsigdata iswitness )
Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction createpsbt and walletcreatefundedpsbt should be used for new applications.
请求参数说明:
- hexstring: Type: string, required. The hex string of a raw transaction.
- permitsigdata: Type: boolean, optional, default=false. If true, any signatures in the input will be discarded and conversion. will continue. If false, RPC will fail if any signatures are present.
- iswitness: Type: boolean, optional, default=depends on heuristic tests. Whether the transaction hex is a serialized witness transaction.If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserialization will be tried. If false, only non-witness deserialization will be tried. This boolean should reflect whether the transaction has inputs (e.g. fully valid, or on-chain transactions), if known by the caller.
应答字段说明:
- str: Type: string. The resulting raw transaction (base64-encoded string).
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "converttopsbt", "params": ["hexstring"]}'
Response
createpsbt
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
createpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount,...},{"data":"hex"},...] ( locktime replaceable )
Creates a transaction in the Partially Signed Transaction format.
Implements the Creator role.
请求参数说明:
- inputs: Type: json array, required. The json objects
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
"sequence": n, (numeric, optional, default=depends on the value of the 'replaceable' and 'locktime' arguments) The sequence number
},
...
]
- outputs: Type: json array, required. The outputs (key-value pairs), where none of the keys are duplicated. That is, each address can only appear once and there can only be one ‘data’ object. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also accepted as second parameter.
[
{ (json object)
"address": amount, (numeric or string, required) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in BTC
},
{ (json object)
"data": "hex", (string, required) A key-value pair. The key must be "data", the value is hex-encoded data
},
...
]
- locktime: Type: numeric, optional, default=0.Raw locktime. Non-0 value also locktime-activates inputs.
- replaceable: Type: boolean, optional, default=false. Marks this transaction as BIP125 replaceable. Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.
应答字段说明:
- str: Type: string. The resulting raw transaction (base64-encoded string).
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "createpsbt", "params": "[{\"txid\":\"myid\",\"vout\":0}]"}'
Response
createrawtransaction
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount,...},{"data":"hex"},...] ( locktime replaceable )
Create a transaction spending the given inputs and creating new outputs.
Outputs can be addresses or data.
Returns hex-encoded raw transaction.
Note that the transaction’s inputs are not signed, and it is not stored in the wallet or transmitted to the network.
请求参数说明:
- inputs: Type: json array, required. The inputs
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
"sequence": n, (numeric, optional, default=depends on the value of the 'replaceable' and 'locktime' arguments) The sequence number
},
...
]
- outputs: Type: json array, required. The outputs (key-value pairs), where none of the keys are duplicated. That is, each address can only appear once and there can only be one ‘data’ object. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also accepted as second parameter.
[
{ (json object)
"address": amount, (numeric or string, required) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in BTC
},
{ (json object)
"data": "hex", (string, required) A key-value pair. The key must be "data", the value is hex-encoded data
},
...
]
- locktime: Type: numeric, optional, default=0.Raw locktime. Non-0 value also locktime-activates inputs.
- replaceable: Type: boolean, optional, default=false. Marks this transaction as BIP125 replaceable. Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.
应答字段说明:
- str: Type: string. hex string of the transaction.
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"address\":0.01}]"]}'
Response
decodepsbt
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
decodepsbt "psbt"
Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.
请求参数说明:
- psbt: Type: string, required. The PSBT base64 string.
应答字段说明:
{ (json object)
"tx" : { (json object) The decoded network-serialized unsigned transaction.
... The layout is the same as the output of decoderawtransaction.
},
"unknown" : { (json object) The unknown global fields
"key" : "hex", (string) (key-value pair) An unknown key-value pair
...
},
"inputs" : [ (json array)
{ (json object)
"non_witness_utxo" : { (json object, optional) Decoded network transaction for non-witness UTXOs
...
},
"witness_utxo" : { (json object, optional) Transaction output for witness UTXOs
"amount" : n, (numeric) The value in BTC
"scriptPubKey" : { (json object)
"asm" : "str", (string) The asm
"hex" : "hex", (string) The hex
"type" : "str", (string) The type, eg 'pubkeyhash'
"address" : "str" (string) Bitcoin address if there is one
}
},
"partial_signatures" : { (json object, optional)
"pubkey" : "str", (string) The public key and signature that corresponds to it.
...
},
"sighash" : "str", (string, optional) The sighash type to be used
"redeem_script" : { (json object, optional)
"asm" : "str", (string) The asm
"hex" : "hex", (string) The hex
"type" : "str" (string) The type, eg 'pubkeyhash'
},
"witness_script" : { (json object, optional)
"asm" : "str", (string) The asm
"hex" : "hex", (string) The hex
"type" : "str" (string) The type, eg 'pubkeyhash'
},
"bip32_derivs" : [ (json array, optional)
{ (json object, optional) The public key with the derivation path as the value.
"master_fingerprint" : "str", (string) The fingerprint of the master key
"path" : "str" (string) The path
},
...
],
"final_scriptsig" : { (json object, optional)
"asm" : "str", (string) The asm
"hex" : "str" (string) The hex
},
"final_scriptwitness" : [ (json array)
"hex", (string) hex-encoded witness data (if any)
...
],
"unknown" : { (json object) The unknown global fields
"key" : "hex", (string) (key-value pair) An unknown key-value pair
...
}
},
...
],
"outputs" : [ (json array)
{ (json object)
"redeem_script" : { (json object, optional)
"asm" : "str", (string) The asm
"hex" : "hex", (string) The hex
"type" : "str" (string) The type, eg 'pubkeyhash'
},
"witness_script" : { (json object, optional)
"asm" : "str", (string) The asm
"hex" : "hex", (string) The hex
"type" : "str" (string) The type, eg 'pubkeyhash'
},
"bip32_derivs" : [ (json array, optional)
{ (json object)
"pubkey" : "str", (string) The public key this path corresponds to
"master_fingerprint" : "str", (string) The fingerprint of the master key
"path" : "str" (string) The path
},
...
],
"unknown" : { (json object) The unknown global fields
"key" : "hex", (string) (key-value pair) An unknown key-value pair
...
}
},
...
],
"fee" : n (numeric, optional) The transaction fee paid if all UTXOs slots in the PSBT have been filled.
}
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "decodepsbt", "params": ["psbt"]}'
Response
decoderawtransaction
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
decoderawtransaction "hexstring" ( iswitness )
Return a JSON object representing the serialized, hex-encoded transaction.
请求参数说明:
- hexstring: Type: string, required. The transaction hex string.
- iswitness: Type: boolean, optional, default=depends on heuristic tests. Whether the transaction hex is a serialized witness transaction. If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserialization will be tried. If false, only non-witness deserialization will be tried. This boolean should reflect whether the transaction has inputs (e.g. fully valid, or on-chain transactions), if known by the caller.
应答字段说明:
{ (json object)
"txid" : "hex", (string) The transaction id
"hash" : "hex", (string) The transaction hash (differs from txid for witness transactions)
"size" : n, (numeric) The transaction size
"vsize" : n, (numeric) The virtual transaction size (differs from size for witness transactions)
"weight" : n, (numeric) The transaction's weight (between vsize*4 - 3 and vsize*4)
"version" : n, (numeric) The version
"locktime" : xxx, (numeric) The lock time
"vin" : [ (json array)
{ (json object)
"txid" : "hex", (string) The transaction id
"vout" : n, (numeric) The output number
"scriptSig" : { (json object) The script
"asm" : "str", (string) asm
"hex" : "hex" (string) hex
},
"txinwitness" : [ (json array)
"hex", (string) hex-encoded witness data (if any)
...
],
"sequence" : n (numeric) The script sequence number
},
...
],
"vout" : [ (json array)
{ (json object)
"value" : n, (numeric) The value in BTC
"n" : n, (numeric) index
"scriptPubKey" : { (json object)
"asm" : "str", (string) the asm
"hex" : "hex", (string) the hex
"reqSigs" : n, (numeric) The required sigs
"type" : "str", (string) The type, eg 'pubkeyhash'
"addresses" : [ (json array)
"str", (string) bitcoin address
...
]
}
},
...
]
}
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "decoderawtransaction", "params": ["hexstring"]}'
Response
decodescript
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
decodescript "hexstring"
Decode a hex-encoded script.
请求参数说明:
- hexstring: Type: string, required. the hex-encoded script.
应答字段说明:
{ (json object)
"asm" : "str", (string) Script public key
"type" : "str", (string) The output type (e.g. nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot, witness_unknown)
"reqSigs" : n, (numeric) The required signatures
"addresses" : [ (json array)
"str", (string) bitcoin address
...
],
"p2sh" : "str", (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)
"segwit" : { (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness)
"asm" : "str", (string) String representation of the script public key
"hex" : "hex", (string) Hex string of the script public key
"type" : "str", (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)
"reqSigs" : n, (numeric) The required signatures (always 1)
"addresses" : [ (json array) (always length 1)
"str", (string) segwit address
...
],
"p2sh-segwit" : "str" (string) address of the P2SH script wrapping this witness redeem script
}
}
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "decodescript", "params": ["hexstring"]}'
Response
finalizepsbt
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
finalizepsbt "psbt" ( extract )
Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be created which has the final_scriptSig and final_scriptWitness fields filled for inputs that are complete.
Implements the Finalizer and Extractor roles.
请求参数说明:
- psbt: Type: string, required. A base64 string of a PSBT.
- extract: Type: boolean, optional, default=true. If true and the transaction is complete, extract and return the complete transaction in normal network serialization instead of the PSBT.
应答字段说明:
{ (json object)
"psbt" : "str", (string) The base64-encoded partially signed transaction if not extracted
"hex" : "hex", (string) The hex-encoded network transaction if extracted
"complete" : true|false (boolean) If the transaction has a complete set of signatures
}
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "finalizepsbt", "params": ["psbt"]}'
Response
fundrawtransaction
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
fundrawtransaction "hexstring" ( options iswitness )
If the transaction has no inputs, they will be automatically selected to meet its out value.
It will add at most one change output to the outputs.
No existing outputs will be modified unless “subtractFeeFromOutputs” is specified.
Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.
The inputs added will not be signed, use signrawtransactionwithkey
or signrawtransactionwithwallet for that.
Note that all existing inputs must have their previous output transaction be in the wallet.
Note that all inputs selected must be of standard form and P2SH scripts must be in the wallet using importaddress or addmultisigaddress (to calculate fees).
You can see whether this is the case by checking the “solvable” field in the listunspent output.
Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only.
请求参数说明:
- hexstring: Type: string, required. The hex string of the raw transaction.
- options: Type: json object, optional. for backward compatibility: passing in a true instead of an object will result in {“includeWatching”:true}. “replaceable”: bool, (boolean, optional, default=wallet default) Marks this transaction as BIP125 replaceable. Allows this transaction to be replaced by a transaction with higher fees “conf_target”: n, (numeric, optional, default=wallet -txconfirmtarget) Confirmation target in blocks “estimate_mode”: “str”, (string, optional, default=unset) The fee estimate mode, must be one of (case insensitive): “unset” “economical” “conservative” }
{
"add_inputs": bool, (boolean, optional, default=true) For a transaction with existing inputs, automatically include more if they are not enough.
"changeAddress": "str", (string, optional, default=pool address) The bitcoin address to receive the change
"changePosition": n, (numeric, optional, default=random) The index of the change output
"change_type": "str", (string, optional, default=set by -changetype) The output type to use. Only valid if changeAddress is not specified. Options are "legacy", "p2sh-segwit", and "bech32".
"includeWatching": bool, (boolean, optional, default=true for watch-only wallets, otherwise false) Also select inputs which are watch only.
Only solvable inputs can be used. Watch-only destinations are solvable if the public key and/or output script was imported,
e.g. with 'importpubkey' or 'importmulti' with the 'pubkeys' or 'desc' field.
"lockUnspents": bool, (boolean, optional, default=false) Lock selected unspent outputs
"fee_rate": amount, (numeric or string, optional, default=not set, fall back to wallet fee estimation) Specify a fee rate in sat/vB.
"feeRate": amount, (numeric or string, optional, default=not set, fall back to wallet fee estimation) Specify a fee rate in BTC/kvB.
"subtractFeeFromOutputs": [ (json array, optional, default=empty array) The integers.
The fee will be equally deducted from the amount of each specified output.
Those recipients will receive less bitcoins than you enter in their corresponding amount field.
If no outputs are specified here, the sender pays the fee.
vout_index, (numeric) The zero-based output index, before a change output is added.
...
],
- iswitness: Type: boolean, optional, default=depends on heuristic tests. Whether the transaction hex is a serialized witness transaction. If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserialization will be tried. If false, only non-witness deserialization will be tried. This boolean should reflect whether the transaction has inputs (e.g. fully valid, or on-chain transactions), if known by the caller.
应答字段说明:
{ (json object)
"hex" : "hex", (string) The resulting raw transaction (hex-encoded string)
"fee" : n, (numeric) Fee in BTC the resulting transaction pays
"changepos" : n (numeric) The position of the added change output, or -1
}
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "fundrawtransaction", "params": ["rawtransactionhex"]}'
Response
getrawtransaction
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
getrawtransaction "txid" ( verbose "blockhash" )
Return the raw transaction data.
By default this function only works for mempool transactions. When called with a blockhash argument, getrawtransaction will return the transaction if the specified block is available and the transaction is found in that block. When called without a blockhash argument, getrawtransaction will return the transaction if it is in the mempool, or if -txindex is enabled and the transaction is in a block in the blockchain.
Hint: Use gettransaction for wallet transactions.
If verbose is ‘true’, returns an Object with information about ‘txid’.
If verbose is ‘false’ or omitted, returns a string that is serialized, hex-encoded data for ‘txid’.
请求参数说明:
- txid: Type: string, required. The transaction id.
- verbose: Type: boolean, optional, default=false. If false, return a string, otherwise return a json object.
- blockhash: Type: string, optional. The block in which to look for the transaction.
Returns(if verbose is not set or set to false):
- str: Type:string. The serialized, hex-encoded data for ‘txid’
Returns(if verbose is set to true):
{ (json object)
"in_active_chain" : true|false, (boolean) Whether specified block is in the active chain or not (only present with explicit "blockhash" argument)
"hex" : "hex", (string) The serialized, hex-encoded data for 'txid'
"txid" : "hex", (string) The transaction id (same as provided)
"hash" : "hex", (string) The transaction hash (differs from txid for witness transactions)
"size" : n, (numeric) The serialized transaction size
"vsize" : n, (numeric) The virtual transaction size (differs from size for witness transactions)
"weight" : n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4)
"version" : n, (numeric) The version
"locktime" : xxx, (numeric) The lock time
"vin" : [ (json array)
{ (json object)
"txid" : "hex", (string) The transaction id
"vout" : n, (numeric) The output number
"scriptSig" : { (json object) The script
"asm" : "str", (string) asm
"hex" : "hex" (string) hex
},
"sequence" : n, (numeric) The script sequence number
"txinwitness" : [ (json array)
"hex", (string) hex-encoded witness data (if any)
...
]
},
...
],
"vout" : [ (json array)
{ (json object)
"value" : n, (numeric) The value in BTC
"n" : n, (numeric) index
"scriptPubKey" : { (json object)
"asm" : "str", (string) the asm
"hex" : "str", (string) the hex
"reqSigs" : n, (numeric) The required sigs
"type" : "str", (string) The type, eg 'pubkeyhash'
"addresses" : [ (json array)
"str", (string) bitcoin address
...
]
}
},
...
],
"blockhash" : "hex", (string) the block hash
"confirmations" : n, (numeric) The confirmations
"blocktime" : xxx, (numeric) The block time expressed in UNIX epoch time
"time" : n (numeric) Same as "blocktime"
}
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "getrawtransaction", "params": ["mytxid", true]}'
Response
joinpsbts
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
joinpsbts ["psbt",...]
Joins multiple distinct PSBTs with different inputs and outputs into one PSBT with inputs and outputs from all of the PSBTs No input in any of the PSBTs can be in more than one of the PSBTs.
请求参数说明:
- txs: Type: json array, required. The base64 strings of partially signed transactions.
[
"psbt", (string, required) A base64 string of a PSBT
...
]
Returns:
- str: Type: string. The base64-encoded partially signed transaction
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "joinpsbts", "params": ["psbt"]}'
Response
sendrawtransaction
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
sendrawtransaction "hexstring" ( maxfeerate )
Submit a raw transaction (serialized, hex-encoded) to local node and network.
Note that the transaction will be sent unconditionally to all peers, so using this for manual rebroadcast may degrade privacy by leaking the transaction’s origin, as nodes will normally not rebroadcast non-wallet transactions already in their mempool.
Also see createrawtransaction and signrawtransactionwithkey calls.
请求参数说明:
- hexstring: Type: string, required. The hex string of the raw transaction.
- maxfeerate: Type: numeric or string, optional, default=0.10. Reject transactions whose fee rate is higher than the specified value, expressed in BTC/kB. Set to 0 to accept any fee rate.
Returns:
- hex: Type: string. The transaction hash in hex
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "sendrawtransaction", "params": ["signedhex"]}'
Response
signrawtransactionwithkey
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
signrawtransactionwithkey "hexstring" ["privatekey",...] ( [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount},...] "sighashtype" )
Sign inputs for raw transaction (serialized, hex-encoded).
The second argument is an array of base58-encoded private keys that will be the only keys used to sign the transaction.
The third optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain.
请求参数说明:
- hexstring: Type: string, required. The transaction hex string.
- privkeys: Type: json array, required. The base58-encoded private keys for signing.
[
"privatekey", (string) private key in base58-encoding
...
]
- prevtxs: Type: json array, optional. The previous dependent transaction outputs.
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
"scriptPubKey": "hex", (string, required) script key
"redeemScript": "hex", (string) (required for P2SH) redeem script
"witnessScript": "hex", (string) (required for P2WSH or P2SH-P2WSH) witness script
"amount": amount, (numeric or string) (required for Segwit inputs) the amount spent
},
...
]
- sighashtype: Type: string, optional, default=ALL. The signature hash type. Must be one of: “ALL” “NONE” “SINGLE” “ALL|ANYONECANPAY” “NONE|ANYONECANPAY” “SINGLE|ANYONECANPAY”
Returns:
{ (json object)
"hex" : "hex", (string) The hex-encoded raw transaction with signature(s)
"complete" : true|false, (boolean) If the transaction has a complete set of signatures
"errors" : [ (json array, optional) Script verification errors (if there are any)
{ (json object)
"txid" : "hex", (string) The hash of the referenced, previous transaction
"vout" : n, (numeric) The index of the output to spent and used as input
"scriptSig" : "hex", (string) The hex-encoded signature script
"sequence" : n, (numeric) Script sequence number
"error" : "str" (string) Verification or signing error related to the input
},
...
]
}
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "signrawtransactionwithkey", "params": ["myhex", "[\"key1\",\"key2\"]"]}'
Response
testmempoolaccept
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
testmempoolaccept ["rawtx",...] ( maxfeerate )
Returns result of mempool acceptance tests indicating if raw transaction (serialized, hex-encoded) would be accepted by mempool.
This checks if the transaction violates the consensus or policy rules.
See sendrawtransaction call.
请求参数说明:
- rawtxs: Type: json array, required. An array of hex strings of raw transactions. Length must be one for now.
[
"rawtx", (string)
...
]
- maxfeerate: Type: numeric or string, optional, default=0.10. Reject transactions whose fee rate is higher than the specified value, expressed in BTC/kB
Returns:
[ (json array) The result of the mempool acceptance test for each raw transaction in the input array.
Length is exactly one for now.
{ (json object)
"txid" : "hex", (string) The transaction hash in hex
"allowed" : true|false, (boolean) If the mempool allows this tx to be inserted
"vsize" : n, (numeric) Virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted (only present when 'allowed' is true)
"fees" : { (json object) Transaction fees (only present if 'allowed' is true)
"base" : n (numeric) transaction fee in BTC
},
"reject-reason" : "str" (string) Rejection string (only present when 'allowed' is false)
},
...
]
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "testmempoolaccept", "params": [["signedhex"]]}'
Response
utxoupdatepsbt
POST
https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}
utxoupdatepsbt "psbt" ( ["",{"desc":"str","range":n or [n,n]},...] )
Updates all segwit inputs and outputs in a PSBT with data from output descriptors, the UTXO set or the mempool.
请求参数说明:
- psbt: Type: string, required. A base64 string of a PSBT.
- descriptors: Type: json array, optional. An array of either strings or objects.
[
"", (string) An output descriptor
{ (json object) An object with an output descriptor and extra information
"desc": "str", (string, required) An output descriptor
"range": n or [n,n], (numeric or array, optional, default=1000) Up to what index HD chains should be explored (either end or [begin,end])
},
...
]
Returns:
- str: Type: string. The base64-encoded partially signed transaction with inputs updated.
Request
curl --location -g 'https://services.tokenview.io/vipapi/nodeservice/btc?apikey={apikey}' \
--data '{"jsonrpc": "2.0", "method": "utxoupdatepsbt", "params": ["psbt"]}'
Response