Post
Share your knowledge.
, is there an easy way to "retry" the transaction with the same Inputs and MoveCalls
Hi guys, is there an easy way to "retry" the transaction with the same Inputs and MoveCalls, but with a different gas budget?
My case is the following: I was uploading website on walrus, and the final transaction is pretty big (1000+ move calls), which failed because of the InsufficientGas error (which is because low default gas budget in site-builder).
What I would like to avoid is to re-uploading all the content of the website again, instead, it would be much much easier for me to just "retry" this tx with all the underlaying params from e.g. block explorer (or any other possible place).
Is there is something like that?
- Sui
- Architecture
Answers
10Yes, there is a way to "retry" a Sui transaction with the same inputs and Move calls, but with a different gas budget—as long as the input objects are still valid and unmodified.
How to Retry a Transaction with a Different Gas Budget
1. Get the Original Transaction Data
- You need the full transaction data: sender, inputs, Move calls, type arguments, and arguments.
- You can usually get this from a block explorer or by logging the transaction before submission.
2. Rebuild the Transaction
- Use the same inputs and Move calls, but specify a higher gas budget.
- On Sui, the transaction is not "replayed" from a hash; you must reconstruct it with the same parameters.
3. Resubmit
- Sign and submit the new transaction.
4. Caveats
- If any input objects were mutated, transferred, or deleted by the failed transaction or another transaction, you cannot reuse them.
- If the transaction failed due to insufficient gas, the objects should still be available.
Example: Using the Sui Transaction Builder
From the context:
pub async fn move_call(
&self,
signer: SuiAddress,
package_object_id: ObjectID,
module: String,
function: String,
type_arguments: Vec<SuiTypeTag>,
rpc_arguments: Vec<SuiJsonValue>,
gas: Option<ObjectID>,
gas_budget: BigInt<u64>,
_txn_builder_mode: Option<SuiTransactionBlockBuilderMode>,
) -> RpcResult<TransactionBlockBytes> {
Ok(TransactionBlockBytes::from_data(
self.0
.move_call(
signer,
package_object_id,
&module,
&function,
type_arguments,
rpc_arguments,
gas,
*gas_budget,
None,
)
.await
.map_err(crate::Error::from)?,
)
.map_err(crate::Error::from)?)
}
You can use the same parameters as before, but set a higher gas_budget.
Practical Steps
- Extract the transaction details from the block explorer or your logs.
- Rebuild the transaction using the Sui CLI, SDK, or your dApp, with the same parameters but a higher gas budget.
- Sign and submit the transaction.
No "Replay" by Hash
- Sui does not support replaying a transaction by hash with a different gas budget.
- You must reconstruct the transaction with the same parameters.
Summary
- Yes, you can retry by reconstructing the transaction with a higher gas budget, as long as the input objects are still valid.
- No, you cannot simply "replay" by hash—you must rebuild the transaction.
Yes, there is a way to retry a failed transaction in Sui using the same inputs and Move calls but with a different gas budget.
Here’s how you can approach this issue step by step:
1. Retrieving the Original Transaction Data
- If the transaction failed due to insufficient gas, you can retrieve the transaction details (such as inputs, Move calls, and other parameters) from the failed transaction. This can be done either by querying the block explorer or through the Sui CLI.
2. Extract the Transaction Data
- From Sui Explorer: If you have access to the failed transaction via a block explorer like Sui Explorer or Suivision, you can typically view the details of the transaction, including the inputs and the Move calls.
- From the CLI: You can also use the Sui CLI to fetch the details of a transaction. To do this, you need the transaction digest or ID. Once you have the transaction ID, you can query the details of the transaction.
Example:
sui client query --transaction <transaction_id>
This command will return the details of the transaction, including the inputs and Move calls.
3. Resubmit the Transaction with a New Gas Budget
- Once you have the full details of the failed transaction, you can retry the transaction with a higher gas budget. This means you will essentially reconstruct the transaction (with all the same parameters) and increase the gas budget to ensure it goes through successfully.
Here’s an example of how you can retry the transaction with a higher gas budget using the Sui CLI:
sui client submit-transaction --gas-budget 1000000 --transaction <transaction_file>
- In the above command, replace
<transaction_file>with the actual file or parameters that contain the same Move calls and inputs, and set the--gas-budgetto a higher value.
4. Using the sui CLI to Manually Retry the Transaction:
- If you want to retry a transaction programmatically, you can create a TransactionBlock using the Sui SDK and re-run the same Move calls with an updated gas budget.
Here's an example in JavaScript (using Sui SDK):
const { SuiClient, TransactionBlock } = require('@mysten/sui.js');
const suiClient = new SuiClient({ rpcUrl: 'https://testnet.sui.io/rpc' });
const retryTransaction = async (originalTransactionId) => {
try {
// Fetch the original transaction details using its ID
const originalTx = await suiClient.queryTransaction(originalTransactionId);
// Create a new transaction block with the same inputs and Move calls
const txn = new TransactionBlock();
// Add the same Move calls and inputs (you need to know the original Move calls here)
txn.moveCall({
target: '0x2::coin::transfer',
arguments: [txn.pure(sender), txn.pure(receiver), txn.pure(amount)],
});
// Resubmit the transaction with a higher gas budget
txn.setGasBudget(1000000); // Adjust gas budget as needed
const result = await suiClient.submitTransaction(txn);
console.log('Transaction retry result:', result);
} catch (error) {
console.error('Error retrying transaction:', error);
}
};
- In this example, you manually create a new transaction with the same inputs and Move calls and submit it with a new, higher gas budget. You can adjust the
setGasBudgetto a value large enough to ensure the transaction succeeds.
5. Automating Transaction Retry Logic
If this is something you plan to do frequently, you could implement retry logic with exponential backoff or manual retries in case the transaction continues to fail due to insufficient gas.
Example:
const retryWithBackoff = async (originalTransactionId, retries = 3) => {
let attempt = 0;
while (attempt < retries) {
try {
await retryTransaction(originalTransactionId);
break; // Success
} catch (error) {
console.error(`Retry attempt ${attempt + 1} failed`, error);
attempt++;
if (attempt >= retries) {
throw new Error('Max retries reached');
}
await new Promise(resolve => setTimeout(resolve, 1000 * Math.pow(2, attempt))); // Exponential backoff
}
}
};
6. Monitoring Gas Usage
To avoid running into insufficient gas issues in the future, it is important to monitor the gas usage for your specific Move functions, especially if your transactions involve large objects (like uploading content, in your case). Use the Sui CLI’s simulateTransaction feature to get gas estimates before submitting large transactions:
sui client simulate-transaction --gas-budget 1000000 --transaction <transaction_file>
This will provide an estimate of how much gas your transaction will consume and help you adjust the gas budget appropriately before resubmitting.
Summary
- Retrieve the transaction details from Sui Explorer or the Sui CLI using the transaction ID.
- Rebuild the transaction with the same Move calls and inputs.
- Submit the transaction again with a higher gas budget to avoid the "InsufficientGas" error.
- Implement retry logic with backoff for failed transactions.
- Monitor gas usage to ensure you set the correct gas budget for large transactions.
By following these steps, you can efficiently retry failed transactions without having to redo the entire operation like uploading website content again, and you’ll be able to ensure smooth execution of larger transactions in the future.
No, Sui does not support retrying a failed transaction with the same inputs and Move calls by default. Each transaction is unique and must be reconstructed. However, you can extract the original transaction data (e.g., from a block explorer or local logs), reuse the same inputs and commands, and submit a new transaction with an increased gas budget. For large operations like Walrus uploads, modify the gas settings in your tool (e.g., site-builder) before re-executing. To avoid re-uploading content, ensure the new transaction uses the same blob IDs if they were already stored.
Yes! Use sui client tx-block to fetch & retry a failed TX with higher gas:
# 1. Get failed TX details
sui client tx-block <FAILED_TX_DIGEST> --json > failed_tx.json
# 2. Retry with higher gas (edit `gas-budget` in JSON)
sui client execute --gas-budget 100000000 < failed_tx.json
Key Notes:
- Works for any MoveCall TX (including Walrus uploads).
- No need to re-upload content—reuses original inputs.
- Adjust
gas-budgetin JSON before retrying.
1. Quick Retry Method (Using CLI)
# 1. Get the failed tx digest from explorer or logs
sui client tx-block <FAILED_TX_DIGEST> --show-input
# 2. Copy the raw transaction bytes
# 3. Resubmit with higher gas budget
sui client execute-tx \
--tx-bytes <BASE64_TX_BYTES> \
--gas-budget 200_000_000 \ # 2x original budget
--gas-price <CURRENT_REFERENCE_GAS_PRICE>
2. Programmatic Retry (TypeScript)
import { SuiClient } from '@mysten/sui.js/client';
const client = new SuiClient({ url: 'https://walrus-rpc.testnet.sui.io' });
async function retryTx(failedTxDigest: string, newGasBudget: number) {
// 1. Fetch original tx data
const tx = await client.getTransactionBlock({
digest: failedTxDigest,
options: { showInput: true }
});
// 2. Recreate with higher budget
const txBytes = tx.transaction!.transaction;
await client.executeTransactionBlock({
transactionBlock: txBytes,
gasBudget: newGasBudget,
options: { showEffects: true }
});
}
3. For Site-Builder Specific Fix
# Set higher gas budget before upload
export SUI_GAS_BUDGET=300000000 # 300M gas
npx @sui-site/builder upload
Key Notes:
-
Gas Estimation Rule:
- For 1000+ Move calls: Start with 500M gas
- Adjust using:
gasBudget = base(50M) + (10K per additional call)
-
Where to Find TX Data:
- Sui Explorer → Transaction → "View Raw"
- CLI:
sui client tx-block <DIGEST> --json
-
Walrus-Specific:
# Check current reference gas price curl https://walrus-rpc.testnet.sui.io -s \ -X POST -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"suix_getReferenceGasPrice","id":1}' | jq
Yes, but only partially.
You can’t directly “replay” a failed Sui tx, but you can:
Use a block explorer or dev tool (e.g., sui-explorer, sui client) to extract the original MoveCall and inputs.
Manually rebuild the transaction with the same params but a higher gasBudget.
If you used the site-builder, check if it exposes a dry-run or cached plan you can reuse (some tools do this).
Sadly, there's no one-click retry yet — you need to re-execute the same logic with updated gas.
1. Rebuild the transaction locally
If you constructed the big transaction in a script (e.g. site-builder), you can rerun that script but override the gas budget with a higher value. Since the actual Move calls and inputs don’t change, it effectively reproduces the same block of calls but with enough budget to succeed. This is the common way teams handle retries.
2. Extract from Explorer or CLI
From the block explorer you can see the transaction digest, object IDs, and Move calls that were attempted. You can’t replay it directly from there with a new gas budget, but you can use that information to reconstruct the transaction. With the Sui CLI or SDK, you’d build a new ProgrammableTransactionBlock with the same calls and arguments, then call signAndExecuteTransactionBlock with a higher gasBudget.
Example (TypeScript SDK):
const tx = new TransactionBlock();
// re-add your same Move calls and inputs here
// ...
await provider.signAndExecuteTransactionBlock({
signer: keypair,
transactionBlock: tx,
options: { showEffects: true },
requestType: 'WaitForLocalExecution',
gasBudget: 200000000, // raise this
});
3. Future improvements
The community has discussed adding easier “resubmit with higher gas” tooling, but right now Sui requires you to re-create the tx. For large upload flows like Walrus, usually the builder can cache your file chunks locally, so a retry only rebuilds the transaction list rather than re-reading the files from scratch.
✅ In short: you can’t just replay the old digest with new gas, but you can reconstruct the exact same transaction block with the same inputs and set a higher gas budget in CLI or SDK.
👉 Read more: Sui Transaction Blocks
Do you know the answer?
Please log in and share it.
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.
- How to Maximize Profit Holding SUI: Sui Staking vs Liquid Staking616
- Why does BCS require exact field order for deserialization when Move structs have named fields?65
- Multiple Source Verification Errors" in Sui Move Module Publications - Automated Error Resolution55
- Sui Move Error - Unable to process transaction No valid gas coins found for the transaction419
- Sui Transaction Failing: Objects Reserved for Another Transaction410