Transaction bundling

When you send StarkEx a list of transactions to execute, the StarkEx batcher enters those transactions into a batch in one of the following ways:

  • According to the order in which you send them, and according to how much room is left in the batch. If any transactions that you send do not enter into the batch because there is not enough room in the present batch, they are queued for the next batch.

  • A bundled set of transactions. The bundle is executed completely, or not at all. A transaction bundle is useful for trading multiple asset types in one operation. For example, you can use transaction bundling to sell a set of NFTs as one package.

    A bundle receives a single id. Individual transactions within a bundle do not have their own ids.

Choosing individual transactions or bundled transactions

You can choose which method to use for each transaction. When you send a list of transactions, you can send separate transactions along with a bundled transaction. For example, consider the following list of transactions:

(tx1-single, tx2-bundle, tx3-single)

The upcoming batch has room for tx1 and tx2, which is a bundle of transactions, but not for tx3. So it executes tx1 and tx2, but not tx3.

Example of a bundled transaction
"tx": {
     "txs": [
    	{
        	"vault_id": 1654615998,
        	"token_id": "0x2dd48fd7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378",
        	"stark_key": "0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac",
        	"amount": "4029557120079369747",
        	"type": "DepositRequest"
    	},
    	{
        	"vault_id": 1654615998,
        	"token_id": "0x5ba91fa7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378",
        	"stark_key": "0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac",
        	"amount": "4029557120079369747",
        	"type": "WithdrawalRequest"
    	},
        ]
      "type": "MultiTransactionRequest"
},
"tx_id": 1234

Sending a transaction bundle

To send a transaction bundle, use the MultiTransactionRequest API.

This feature is not verified at the prover level, only in the StarkEx backend.

Restrictions for bundled transactions

Bundled transactions have the following restrictions:

  • A bundled transaction cannot contain an empty transaction list.

  • Nested transaction bundles are not allowed.

Additional resources