Engine v2.1.25: Transaction Batching & Atomic Operations

Engine v2.1.25: Transaction Batching & Atomic Operations

We're excited to introduce powerful new batching capabilities in Engine v2.1.25, enabling you to execute multiple operations atomically and efficiently read from multiple contracts in a single call.

New Features

1. Atomic Transaction Batching

New Endpoint: /backend-wallet/{chainId}/send-transaction-batch-atomic

Send multiple transactions that will be executed together in a single atomic operation. Perfect for operations that need to happen in a specific order, like token approvals followed by transfers. Check out the API Reference for more details.

Key Benefits:

  • Guaranteed order of execution
  • All transactions succeed or fail together
  • Single queue ID for tracking the entire batch
  • Compatible with all smart account setups:
    • Smart backend wallets (no additional headers needed)
    • Regular backend wallets using x-smart-account-address header

Usage Example:

curl --request POST \
  --url http://localhost:3005/backend-wallet/84532/send-transaction-batch-atomic \
  --header 'Authorization: Bearer {{authToken}}' \
  --header 'x-backend-wallet-address: {{walletAddress}}' \
  --data '{
  "transactions": [
    {
      "toAddress": "0x...",
      "value": "0",
      "data": "0x..." // First transaction (e.g., approval)
    },
    {
      "toAddress": "0x...",
      "value": "0",
      "data": "0x..." // Second transaction (e.g., transfer)
    }
  ]
}'

Example cURL for Atomic Batching

Difference from Previous Write Endpoint:

  • Previous: Each transaction got its own queue ID, executed independently
  • New: Single queue ID for entire batch, guaranteed atomic execution

2. Contract Read Batching

New Endpoint: /contract/{chainId}/read-batch

Execute multiple read operations across different contracts in a single call, with guaranteed consistency of data from the same block. Check out the API Reference for more details.

Key Benefits:

  • All reads executed in the same block
  • Reduced RPC calls using multicall3
  • Perfect for getting related data across contracts
  • Consistent state snapshot across all reads

Usage Example:

curl --request POST \
  --url http://localhost:3005/contract/421614/read-batch \
  --header 'Authorization: Bearer {{authToken}}' \
  --data '{
  "calls": [
    {
      "contractAddress": "0x...",
      "functionName": "balanceOf"
    },
    {
      "contractAddress": "0x...",
      "functionName": "allowance"
    }
  ]
}'

Example cURL for Batch Reads

Transaction Status Updates

The transaction status object now includes a batchOperations field that provides details about all operations in an atomic batch. This field will be null for non-batch transactions:

{
  batchOperations: [
    {
      to: string | null,
      data: string | null,
      value: string
    }
  ] | null
}

batchOperations field in Transaction Status Object


thirdweb Engine is an open-source server for your app to read, write, and deploy contracts at production scale. Self-host for free or get a cloud-hosted Engine for $99/month.