Transactions

A PTB is a list of up to 1,024 commands executed atomically, where outputs of earlier commands feed later ones:

35.1 Programmable transaction blocks (Sui)

A PTB is a list of up to 1,024 commands executed atomically, where outputs of earlier commands feed later ones:

Call a public or entry function Split amounts off a coin (including the gas coin) Merge coins into one Send objects to an address Build a vector from arguments Publish / Upgrade Publish or upgrade packages

Because PTBs compose public functions, Sui Move APIs should be designed as small composable functions that return objects, rather than monolithic entry functions that transfer internally.

import { Transaction } from '@mysten/sui/transactions';

const tx = new Transaction();
// 1. split 1 SUI off the gas coin
const [payment] = tx.splitCoins(tx.gas, [1_000_000_000]);
// 2. buy an item from a shared marketplace; the function returns the item
const item = tx.moveCall({
  target: `${PKG}::market::buy`,
  arguments: [tx.object(MARKET_ID), tx.pure.id(ITEM_ID), payment],
});
// 3. equip it on our hero in the same transaction
tx.moveCall({ target: `${PKG}::hero::equip`, arguments: [tx.object(HERO_ID), item] });
sui client ptb \
  --split-coins gas "[1000000000]" --assign coin \
  --transfer-objects "[coin]" @0xRECIPIENT

35.2 Sponsored transactions (Sui)

A sponsor pays gas for a user. The transaction's gas owner differs from the sender, and both sign:

User (or app) builds the transaction kind (the commands).

Sponsor sets gas payment coins, budget, and itself as gas owner.

User signs, sponsor signs, transaction is submitted with both signatures.

Services like Mysten's Enoki provide sponsorship and zkLogin (OAuth-based addresses) as a managed service.

tx.setSender(userAddress);
tx.setGasOwner(sponsorAddress);
tx.setGasPayment(sponsorCoins);      // object refs of sponsor's SUI coins
// both parties sign the same bytes, then execute with [userSig, sponsorSig]

35.3 Aptos transactions

Entry function payload Call one entry function with arguments

Run a compiled script (multiple calls, arbitrary logic) Multiple signers; the entry function takes several &signer params Fee payer (sponsored) A separate account pays gas

On-chain multisig accounts (0x1::multisig_account)

// multi-agent: both parties must sign
public entry fun swap_items(alice: &signer, bob: &signer) { /* ... */ }
// Aptos fee-payer (sponsored) transaction
const txn = await aptos.transaction.build.simple({
  sender: user.accountAddress,
  withFeePayer: true,
  data: { function: `${MODULE}::game::play`, functionArguments: [] },
});
const senderAuth = aptos.transaction.sign({ signer: user, transaction: txn });
const feePayerAuth = aptos.transaction.signAsFeePayer({ signer: sponsor, transaction: txn });
await aptos.transaction.submit.simple({
  transaction: txn, senderAuthenticator: senderAuth, feePayerAuthenticator: feePayerAuth,
});

35.4 Account abstraction & keyless

Sui zkLogin — derive an address from an OAuth login (Google, Apple, Twitch...) using zero-knowledge proofs; multisig addresses combine keys; passkey signatures are supported.

Aptos Keyless — similar OAuth-based accounts; Aptos accounts support key rotation (authentication key separate from address) and passkeys.