EVM Raw Transactions

Use the EVM raw transaction format to create arbitrary EVM contract calls. For simple transfers or allowance revocations, consider using the dedicated higher-level formats (see EVM Transfers and EVM Revoke Allowances).

For more tutorials on calling EVM smart contracts, check out our pubic API Examples repository on Github.

JSON-RPC Provider

An alternative to Fordefi's REST API is the Fordefi JSON-RPC Provider interface.

When creating an EVM transaction request, you need to specify:

Required parameters

Request type parameters

  • type: Set to evm_transaction
  • details.type: Set to evm_raw_transaction
  • signer_type: In most cases, set it to api_signer

Network parameter

  • chain: The target chain (can be specified as chain name or chain ID)
{
    // ...
    "chain": "evm_1"
}

Transaction parameters

  • vault_id: The origin vault identifier
  • to: The recipient's address
  • value: The transaction value in wei
  • data: The call data, which can be specified in either hex or Base64 format.

The following examples show how to create transaction requests using the two different supported data formats:

{
    "vault_id": "16b5aa12-509e-4944-b656-cf096515d627",
    "signer_type": "api_signer",
    "type": "evm_transaction",
    "details": {
        "type": "evm_raw_transaction",
        "chain": "ethereum_mainnet",
        "to": "0x565697B5DD1F7Bdc61f774807057D058E5A27cbC",
        "value": "0",
        "data": {
            "type": "hex",
            "hex_data": "0x0d1d7ae50000000000000000000000000000000000000000000000000000000000000006"
        }
    }
}

Optional: MEV protection

Fordefi offers MEV protection for transactions on Ethereum Mainnet by sending the transaction to a secure node (Flashbots Protect) as opposed to the public mempool.

To enable MEV protection, set the use_secure_node field to true.

{
    // ...
    "details": {
        // ...
        "use_secure_node": true
    }
}