Build And Submit Transaction

Sending a transaction is a convenience method that first builds and then submits a transaction.

Required Params

ParamTypeDescription

account_id

string

The account on which to perform this action. Must exist in the wallet.

Optional Params

ParamTypeDescription

addresses_and_amounts

(string, Amount)[]

An array of public addresses and Amount object tuples

recipient_public_address

string

b58-encoded public address bytes of the recipient for this transaction.

amount

The Amount to send in this transaction

input_txo_ids

string[]

Specific TXOs to use as inputs to this transaction

fee_value

string(u64)

The fee value to submit with this transaction. If not provided, uses MINIMUM_FEE of the first outputs token_id, if available, or defaults to MOB

fee_token_id

string(u64)

The fee token to submit with this transaction. If not provided, uses token_id of first output, if available, or defaults to MOB

tombstone_block

string(u64)

The block after which this transaction expires. If not provided, uses cur_height + 10

max_spendable_value

string(u64)

The maximum amount for an input TXO selected for this transaction

block_version

string(u64)

The block version to build this transaction for. Defaults to the network block version

sender_memo_credential_subaddress_index

string(u64)

The subaddress to generate the SenderMemoCredentials from. Defaults to the default subaddress for the account.

payment_request_id

string(u64)

The payment request id to set in the RTH Memo.

comment

string

Comment to annotate this transaction in the transaction log

##Response

Example

{
  "method": "build_and_submit_transaction",
  "params": {
    "account_id": "60ef9401f98fc278cd8a1ef51f466111244c9d4b97e8f8886a86bd840238dcaa",
    "recipient_public_address": "3FDsgJgz4mtGpDFL5cibrKZJgTPcwA8bw4kTDT1j64A6kgPbxgW2QfUS3TbNsjaeBc9wzYyNhcCabtuEjbKhfSc8oLoJLUi9QzomiVBq778",
    "amount": { "value": "240800000000", "token_id": "0" }
  },
  "jsonrpc": "2.0",
  "id": 1
}

If an account is not fully-synced, you may see the following error message:

{
  "error": "Connection(Operation { error: TransactionValidation(ContainsSpentKeyImage), total_delay: 0ns, tries: 1 })"
}

Call check_balance for the account, and note the synced_blocks value. If that value is less than the local_block_height value, then your TXOs may not all be updated to their spent status.

Last updated