Gas Optimization
Urblock offers multiple approaches to reduce gas costs for your blockchain operations.
Solady Variants
Solady is an optimized Solidity library that produces contracts with ~40-50% lower gas costs. Urblock supports three Solady token standards:
| Standard | Gas Savings | ABI Compatible With |
|---|---|---|
ERC20_SOLADY | ~40% | ERC20 |
ERC721_SOLADY | ~45% | ERC721 |
ERC1155_SOLADY | ~50% | ERC1155 |
Deploy a Solady ERC-20
const token = await urblock.tokens.create({
name: "Gas Efficient Token",
symbol: "GET",
standard: "ERC20_SOLADY",
network: "polygon_amoy",
initial_supply: "1000000000000000000000000",
idempotency_key: "solady-001",
});
The ABI is 100% compatible — your existing integration code works without changes.
Batch Operations
Combine multiple operations into a single transaction:
const batch = await urblock.batch.create({
operations: [
{ method: "mint", token_id: "tok_abc123", params: { to: "0xAAA...", amount: "1000000000000000000" } },
{ method: "mint", token_id: "tok_abc123", params: { to: "0xBBB...", amount: "2000000000000000000" } },
{ method: "mint", token_id: "tok_abc123", params: { to: "0xCCC...", amount: "3000000000000000000" } },
],
idempotency_key: "batch-mint-001",
});
ERC-1155 Batch Operations
ERC-1155 tokens have native batch operations:
// Batch mint
await urblock.tokens.mintBatch("tok_abc123", {
to: "0xRecipient...",
items: [
{ nft_token_id: 1, amount: "100" },
{ nft_token_id: 2, amount: "200" },
{ nft_token_id: 3, amount: "300" },
{ nft_token_id: 4, amount: "400" },
{ nft_token_id: 5, amount: "500" },
],
idempotency_key: "batch-1155-001",
});
// Batch transfer
await urblock.tokens.transferBatch("tok_abc123", {
from: "0xSender...",
to: "0xRecipient...",
items: [
{ nft_token_id: 1, amount: "10" },
{ nft_token_id: 2, amount: "20" },
{ nft_token_id: 3, amount: "30" },
],
idempotency_key: "batch-transfer-001",
});
Gas Estimation
Before submitting operations, estimate gas costs:
const estimate = await urblock.gasEstimates.estimate({
operation: "mint",
token_id: "tok_abc123",
to: "0x...",
amount: "1000000000000000000",
});
console.log(estimate.gas_limit);
console.log(estimate.estimated_cost_wei);
Tips
- Use Solady variants for new deployments — same API, less gas
- Batch mints instead of individual calls — saves ~30% gas per additional operation
- Use ERC-1155 for collections with multiple token types — native batch support
- Estimate before submitting — avoid failed transactions from gas miscalculation
Next Steps
- Advanced Token Features — SBT, ERC-1363
- API: Gas Estimates — gas estimation endpoint
- Deploy Your First Token — token deployment guide
- Batch Operations — combine operations for even more savings
- Token Standards — compare all 10 standards