Rawtransactions
createrawtransaction
createrawtransaction '[{ "txid": "id_string", "vout": number }, ... ]' '{ "address": amount, ... }'
The createrawtransaction method creates a transaction, spending the given inputs and sending to the given addresses. The method returns a hex-encoded raw transaction.
::: tip This is a raw transaction, and therefore the inputs are not signed and the transaction is not stored in the wallet nor transmitted to the network. :::
Arguments
Name
Type
Description
"transactions"
(string, required)
a json array of json objects
"txid"
(string, required)
the transaction id
"vout"
(numeric, required)
the output number
"addresses"
(string, required)
a json object with addresses as keys and amounts as values
"address"
(numeric, required)
the key is the address, the value is the COIN amount
Response
Name
Type
Description
"transaction"
(string)
a hex string of the transaction
📌 Examples
Command:
./komodo-cli createrawtransaction '[{"txid":"9f44dc664882198b14e9a8c466d466efcdd070ccb6f57be8e2884aa11e7b2a30","vout":0}]' '{"RHCXHfXCZQpbUbihNHh5gTwfr7NXmJXmHi":0.01}'<collapse-text hidden title="Response">
</collapse-text>
You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.
Command:
<collapse-text hidden title="Response">
</collapse-text>
decoderawtransaction
decoderawtransaction "hexstring"
The decoderawtransaction method returns a json object representing the serialized, hex-encoded transaction.
Arguments
Name
Type
Description
"hex"
(string, required)
the transaction hex string
Response
Name
Type
Description
"txid"
(string)
the transaction id
"overwintered"
(boolean)
the overwintered flag
"version"
(numeric)
the version
"versiongroupid"
(string, optional)
the version group id (overwintered txs)
"locktime"
(numeric)
the lock time
"expiryheight"
(numeric, optional)
last valid block height for mining transaction (overwintered txs)
"vin" : [ ... ]
(array of json objects)
"txid"
(string)
the transaction id
"vout" : [ ... ]
(numeric)
the output number
"scriptSig"
(json object)
the script
"asm"
(string)
asm
"hex"
(string)
hex
"sequence"
(numeric)
the script sequence number
"vout"
(array of json objects)
"value"
(numeric)
the value
"number"
(numeric)
index
"scriptPubKey"
(json object)
"asm"
(string)
the asm
"hex"
(string)
the hex
"reqSigs"
(numeric)
the required sigs
"type"
(string)
the type, eg 'pubkeyhash'
"addresses"
"address"
(string)
the address
"vjoinsplit" : [ ... ]
(array of json objects, only for version >= 2)
"vpub_old"
(numeric)
public input value
"vpub_new"
(numeric)
public output value
"anchor"
(string)
the anchor
"nullifiers" : [ ... ]
(array of strings)
"hex"
(string)
input note nullifier
"commitments" : [ ... ]
(array of strings)
"hex"
(string)
output note commitment
"onetimePubKey"
(string)
the onetime public key used to encrypt the ciphertexts
"randomSeed"
(string)
the random seed
"macs" : [ ... ]
(array of strings)
"hex"
(string)
input note MAC
"proof"
(string)
the zero-knowledge proof
"ciphertexts" : [ ... ]
(array of strings)
"hex"
(string)
output note ciphertext
📌 Examples
Command:
<collapse-text hidden title="Response">
</collapse-text>
You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.
Command:
<collapse-text hidden title="Response">
</collapse-text>
decodescript
decodescript "hex"
The decodescript method decodes a hex-encoded script.
Arguments
Name
Type
Description
"hex"
(string)
the hex encoded script
Response
Name
Type
Description
"asm"
(string)
the script public key
"hex"
(string)
the hex-encoded public key
"type"
(string)
the output type
"reqSigs"
(numeric)
the required signatures
"addresses": [ ... ]
(array of strings)
"address"
(string)
the address
"p2sh"
(string)
the script address
📌 Examples
Command:
<collapse-text hidden title="Response">
</collapse-text>
You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.
Command:
<collapse-text hidden title="Response">
</collapse-text>
fundrawtransaction
fundrawtransaction "hexstring"
The fundrawtransaction method adds inputs to a transaction until it has enough in value to meet its out value. This will not modify existing inputs, and will add one change output to the outputs.
::: tip Inputs which were signed may need to be resigned after completion since in/outputs have been added. To sign the inputs added, use signrawtransaction. :::
::: tip This method comes from the BTC codebase, of which DIC is ultimately a fork (via Zcash). For full details, please see the linked documentation. :::
Arguments
Name
Type
Description
"hexstring"
(string, required)
the hex string of the raw transaction
Response
Name
Type
Description
"hex"
(string)
the resulting raw transaction (hex-encoded string)
"fee"
(numeric)
the fee added to the transaction
"changepos"
(numeric)
the position of the added change output, or -1
📌 Examples
Create a transaction with no inputs:
Command:
<collapse-text hidden title="Response">
</collapse-text>
Add sufficient unsigned inputs to meet the output value:
Command:
<collapse-text hidden title="Response">
</collapse-text>
Sign the transaction:
Command:
<collapse-text hidden title="Response">
</collapse-text>
Send the transaction:
Command:
<collapse-text hidden title="Response">
</collapse-text>
getrawtransaction
getrawtransaction "transaction_id" ( verbose )
The getrawtransaction method returns the raw transaction data.
If verbose=0, the method returns a string that is serialized, hex-encoded data for transaction_id. If verbose is non-zero, the method returns an object with information about transaction_id.
::: tip This method relies on the txindex runtime parameter, which is enabled by default on all DIC-based chains. Disabling txindex will cause this method to malfunction. :::
Arguments
Name
Type
Description
"txid"
(string, required)
the transaction id
verbose
(numeric, optional, default=0)
if 0, the method returns a string in hex; otherwise, it returns a json object
Response (if verbose is not set, or set to 0)
verbose is not set, or set to 0)Name
Type
Description
"data"
(string)
the serialized, hex-encoded data for 'txid'
Response (if verbose > 0)
verbose > 0)Name
Type
Description
"hex"
(string)
the serialized, hex-encoded data for 'txid'
"txid"
(string)
the transaction id (same as provided)
"version"
(numeric)
the version
"locktime"
(numeric)
the lock time
"expiryheight"
(numeric, optional)
the block height after which the transaction expires
"vin" : [ ... ]
(array of json objects)
"txid"
(string)
the transaction id
"vout"
(numeric)
"scriptSig": { ... }
(array of json objects)
the script
"asm"
(string)
asm
"hex"
(string)
hex
"sequence"
(numeric)
the script sequence number
"vout" : [ ... ]
(array of json objects)
"value"
(numeric)
the value
"number"
(numeric)
index
"scriptPubKey"
"asm"
(string)
the asm
"hex"
(string)
the hex
"reqSigs"
(numeric)
the required sigs
"type"
(string)
the type, e.g. 'pubkeyhash'
"addresses" : [ ... ]
(array of strings)
"address"
(string)
the address
"vjoinsplit" : [ ... ]
(array of json objects, only for version >= 2)
"vpub_old"
(numeric)
public input value
"vpub_new"
(numeric)
public output value
"anchor"
(string)
the anchor
"nullifiers"
"hex"
(string)
input note nullifier
"commitments" : [ ... ]
(array of strings)
"hex"
(string)
output note commitment
"onetimePubKey"
(string)
the onetime public key used to encrypt the ciphertexts
"randomSeed"
(string)
the random seed
"macs": [ ... ]
(array of strings)
"hex"
(string)
input note MAC
"proof"
(string)
the zero-knowledge proof
"ciphertexts": [ ... ]
(array of strings)
"hex"
(string)
output note ciphertext
"blockhash"
(string)
the block hash
"height"
(numeric)
height of the block
"confirmations"
(numeric)
a confirmation number that is aware of dPoW security
"rawconfirmations"
(numeric)
the raw confirmations (number of blocks on top of this transaction's block)
"time"
(numeric)
the transaction time in seconds since epoch (Jan 1 1970 GMT)
"blocktime"
(numeric)
the block time in seconds since epoch (Jan 1 1970 GMT)
📌 Examples
Command:
<collapse-text hidden title="Response">
</collapse-text>
Command:
<collapse-text hidden title="Response">
</collapse-text>
You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.
Command:
<collapse-text hidden title="Response">
</collapse-text>
sendrawtransaction
sendrawtransaction "hexstring" ( allowhighfees )
The sendrawtransction method submits raw transaction (serialized, hex-encoded) to local nodes and the network.
Also see createrawtransaction and signrawtransaction calls.
Arguments
Name
Type
Description
"hexstring"
(string, required)
the hex string of the raw transaction
allowhighfees
(boolean, optional, default=false)
whether to allow high fees
Response
Name
Type
Description
"hex"
(string)
the transaction hash in hex
📌 Examples
Create a transaction:
Command:
<collapse-text hidden title="Response">
</collapse-text>
Sign the transaction, and get back the hex:
Command:
<collapse-text hidden title="Response">
</collapse-text>
Send the transaction (signed hex):
Command:
<collapse-text hidden title="Response">
</collapse-text>
You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.
Command:
<collapse-text hidden title="Response">
</collapse-text>
signrawtransaction
signrawtransaction "hexstring" ( { "txid": "id", "vout": n, "scriptPubKey": "hex", "redeemScript": "hex" }, ... sighashtype )
The signrawtransaction method signs inputs for a raw transaction (serialized, hex-encoded). The second 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. The third optional argument (may be null) is an array of base58-encoded private keys that, if given, will be the only keys used to sign the transaction.
::: tip For full details, please see the linked documentation. :::
Arguments
Name
Type
Description
"hexstring"
(string, required)
the transaction hex string
"prevtxs"
(string, optional)
a json array of previous dependent transaction outputs
"txid"
(string, required)
the transaction id
"vout"
(numeric, required)
the output number
"scriptPubKey"
(string, required)
the script key
"redeemScript"
(string, required for P2SH)
redeem script
"amount"
(numeric, required)
the amount spent
"privatekeys"
(string, optional)
a json array of base58-encoded private keys for signing
"privatekey"
(string)
the private key in base58-encoding
"sighashtype"
(string, optional, default=ALL)
the signature hash type; the following options are available: "ALL"
Response
Name
Type
Description
"hex"
(string)
the hex-encoded raw transaction with signature(s)
"complete"
(boolean)
whether the transaction has a complete set of signatures
"errors"
"txid"
(string)
the hash of the referenced, previous transaction
"vout"
(numeric)
the index of the output to spend and used as input
"scriptSig"
(string)
the hex-encoded signature script
"sequence"
(numeric)
the script sequence number
"error"
(string)
verification or signing error related to the input
📌 Examples
Command:
<collapse-text hidden title="Response">
</collapse-text>
You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.
Command:
<collapse-text hidden title="Response">
</collapse-text>
Last updated
Was this helpful?