Gas and Fee Architecture
All gas fees on SwssChain are denominated in SWSS Coin. The fee mechanism follows the EIP-1559 model (base fee, priority fee, and maximum fee) with a SwssChain-specific modification for deed transaction priority processing. For standard smart contract interactions, the EIP-1559 model works identically to Ethereum: unused gas is refunded, the base fee adjusts per block based on network utilisation, and the priority fee is an optional tip to validators.
EIP-1559 on SwssChain
| Fee Component | Description | Notes |
| Base Fee | Algorithmically adjusted per block based on utilisation | Partially retired via TSL for deed transactions |
| Priority Fee | Optional tip paid directly to the validator | Lower competition than Ethereum: 1-second blocks reduce urgency |
| Max Fee | Maximum total fee (base + priority) you are willing to pay | Set via maxFeePerGas in transaction |
| Refund | Unused gas is refunded to sender | Identical to Ethereum behaviour |
Deed Transaction Fee Priority
Deed transactions pay a higher base fee than standard transactions. This elevated fee activates the Transactional Settlement Levy at the consensus layer, permanently retiring a micro-fraction of SWSS Coin supply. Importantly, SAPE guarantees deed transactions first-position processing in every block regardless of fee level, the priority lane is protocol-enforced, not fee-enforced. Standard fee competition does not apply to deed transaction ordering.
Estimating Gas with ethers.js
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider(process.env.SWSSCHAIN_RPC_URL);
const contract = new ethers.Contract(contractAddress, abi, provider);
const gasEstimate = await provider.estimateGas({
to: contractAddress,
data: contract.interface.encodeFunctionData('myFunction', [arg1, arg2])
});
const feeData = await provider.getFeeData();
const estimatedCost = gasEstimate * feeData.gasPrice;
console.log('Estimated cost (SWSS):', ethers.formatEther(estimatedCost));
Sending a Transaction with Explicit Gas Settings
const signer = await provider.getSigner();
const contractWithSigner = contract.connect(signer);
const tx = await contractWithSigner.myFunction(arg1, arg2, {
gasLimit: (gasEstimate * 120n) / 100n,
maxFeePerGas: feeData.maxFeePerGas,
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas
});
const receipt = await tx.wait();
console.log('Confirmed in block:', receipt.blockNumber);
Gas Optimisation on SwssChain
The 1-second block time significantly reduces the need for elevated priority fees. On Ethereum, a higher priority fee is often necessary to avoid waiting multiple blocks during periods of congestion. On SwssChain, the next block is always one second away: standard priority fees are sufficient in all but the most extreme load scenarios.
EIP-1153 transient storage (TSTORE/TLOAD) is available and recommended for reentrancy guards and flash loan patterns. Transient storage costs significantly less than permanent storage and is automatically cleared at the end of the transaction.
contract ReentrancyGuarded {
uint256 private constant LOCK_SLOT = 1;
modifier nonReentrant() {
assembly { if tload(LOCK_SLOT) { revert(0, 0) } }
assembly { tstore(LOCK_SLOT, 1) }
_;
assembly { tstore(LOCK_SLOT, 0) }
}
}
Next Steps