Skip to content

Contract Expiration

Contract Expiration

Storing data on a blockchain network can be expensive—especially when you’re using large datasets for a limited amount of time (think: ML training sets). That’s why we’ve added contract expiration, a feature that lets you set time limits for how long contracts and their associated data are stored on the network. Instead of paying for data to be stored forever, gas costs are scaled based on the lifetime of the contract.

How it Works

Rather than charging high gas costs to store data for eternity, on the Oasis Devnet gas costs for storage are prorated based on the time remaining until the contract expires. If no expiration is specified for a new contract, it defaults to 100 years in the future, with the usual cost for storing 256-bit values (20000 gas). If you specify a shorter lifetime when deploying your contract, gas costs are scaled proportionally. For example, if you set your contract to expire in one year, the same operation costs only 200 gas—100x cheaper!

As time passes, gas costs for storage continue to go down proportional to the remaining lifetime of the contract. After the expiration time has passed, the contact and its associated data are no longer guaranteed to be stored, and calls made to the contract will fail. In the future, we plan to add the ability to extend the lifetime of existing contracts.

How to Deploy a Contract With Custom Expiry

See the Contract Settings section in the Web3c.js documentation.