Create Transaction
This endpoint creates a transaction for a given coin and request ID. The request must include the amount, from_address, and to_address. Optional parameters include fee, gas_price, gas_limit, max_fee, max_priority_fee, operation, and extra_parameters. The endpoint returns a JSON response with a ‘cobo_id’ field containing the ID of the created transaction.
Request
transaction amount in decimal places (e.g. one bitcoin is divisible to eight decimal places, and 100000000 represents 1 BTC)
Account Model: this parameter is required
UTXO Model: this parameter is optional. The transaction sending amount will be based on the to_address_details
parameter if the amount
is zero or empty
Account Model: this parameter is required
UTXO Model: this parameter is optional, the input will be selected based off the extra_parameters
parameter if the from_address
is empty or not passed. The from_address
will also be used as the change address of UTXO transactions when utxo_change_address not specified in extra_parameters
list of addresses used for receiving coins associated with the UTXO model; this value must be a JSON string and has a parameter type that fits. Please note that the to_address_details
parameter and amount
parameter are alternative.
to_address_details: '[{"to_address": "2N4J1WajwKZKpRtzzUmaW9B5GEqkppqdVY9","amount": "547"},
{"to_address": "tb1qycxy8d8jgff8hql09y62smw5s5mrf3ryn2j9lk","amount": "548"}]'
estimate_fee
API to obtain an estimated fee for UTXO transactions before creating the transaction, please use the fee_amount
parameter instead of fee
to specify the transaction fee. Otherwise, it will re-estimate the transaction fee based on the fee
parameter when creating the transaction.action type, 100: TRANSFER (default); 200: CONTRACT_CALL
UTXO Model:
- input_selection: inputs to be excluded and included in transactions associated with the UTXO model; inputs must be in correspondence with from_address (if specified); it must be a JSON string and has a structure that fits InputSelection
- inputs_to_spend: UTXO you want as input
- tx_hash: Transaction tx_hash
- vout_n: UTXO index
- inputs_to_exclude: UTXO you don’t want as input
- tx_hash: Transaction tx_hash
- vout_n: UTXO index
- utxo_change_address: the change address for UTXO transactions. if parameter from_address passed and utxo_change_address not passed, from_address will be used as the change address. otherwise, the permanent address (SegWit) will be used as the change address
extra_parameters: '{"input_selection":
{"inputs_to_spend":[
{"tx_hash": "e7ddfa61cc2a78e1661da44b10cdc862256573d2dc0485dc989fb7045ed9032c", "vout_n": 1},
{"tx_hash": "eabaee1f1a196b087e78303c6eaaeb9d1166de5f8d85f4ef7872b88bfcd60914", "vout_n": 2}],
"inputs_to_exclude":[
{"tx_hash": "e7ddfa61cc2a78e1661da44b10cdc862256573d2dc0485dc989fb7045ed9032c", "vout_n": 3},
{"tx_hash": "eabaee1f1a196b087e78303c6eaaeb9d1166de5f8d85f4ef7872b88bfcd60914", "vout_n": 4}]
},
"utxo_change_address": "2MznT7D2tKZKshfQPfhTuLYB7Bw9TZqb17w"
}'
Web3 wallet:
- calldata: request data associated with an EVM transaction; When deploying a new contract, the
to_address
parameter should be set to0x0000000000000000000000000000000000000000
. Please note that when usingcalldata
, thegas_limit
parameter should be set to an appropriate value based on the data being sent and the contract’s execution requirements.
extra_parameters: '{"calldata": "0xa8059cbb000000000000000000000000971948873f869e4517311b190d7eb31e30eba0ef000000000000000000000000000000000000000000000000002386f26fc10000"}'
- instructions: request data associated with a Solana transaction. This parameter is in JSON format and contains a list of instructions. Each instruction includes the following parameters:
- accounts: a list of accounts associated with Solana contract, each of which has the following attributes:
- pubkey: account address. If the account is signer,
pubkey
needs to match thefrom_address
parameter. - is_signer: boolean value indicating whether the account can sign transactions.
- is_writable: boolean value indicating whether the account can be modified.
- pubkey: account address. If the account is signer,
- data: data used for calling Solana contract.
- program_id: contract address. when calling a Solana contract, the
to_address
parameter needs to match theprogram_id
parameter. If multiple contracts are being called, then theto_address
parameter should match theprogram_id
parameter of the first instruction.
- accounts: a list of accounts associated with Solana contract, each of which has the following attributes:
extra_parameters: '{"instructions": "[{\\"accounts\\":[{\\"pubkey\\":\\"E4MhQWiqCLER3fFZNf8LyQFpLWW3BRxtsR5eps3c3vNS\\",\\"is_signer\\":true,\\"is_writable\\":true}],\\"data\\":\\"Canary TX 4, slot: 219858117\\",\\"program_id\\":\\"MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr\\"}]"}'
This parameter is used when you’ve activated the gas station service and use the gas station to support the transaction fee for MPC transactions.