Smart Contract Rent on Hedera - Part 1: What You Need to Know
Headshot
Jan 12, 2023
by Ed Marquez
Developer Evangelist

Smart Contract Rent is the recurring payment required for contracts to remain active on the network. Rent is comprised of auto-renewal and storage payments.

The previous blog post, Smart Contract Rent is Coming to Hedera, outlines why rent is being introduced and how smart contracts can pay rent. This Part 1 of the new blog series explains Hedera's pricing structure and renewal windows for contract rent payments. Read Part 2 for a how-to on making rent payments and avoiding expiration.

Foundational to the conversation about smart contract rent, distributed networks like Hedera have a finite amount of computational resources. When entities like smart contracts are deployed on a decentralized network, a portion of those resources are consumed. Thus, it is unfeasible to maintain an unlimited number of entities for an infinite amount of time on finite resources. Solving this problem is necessary, and it’s a key topic of discussion by Leemon and others in the layer 1 network space.

Rent is an economically and technically viable approach to manage smart contract entities and state storage.

Bottom Line on Top

  • Rent is the recurring payment required for contracts to remain active on the network. Rent is comprised of auto-renewal and storage payments

  • Auto-renewal payments for contracts will be enabled on mainnet with the Hedera Services release planned for February 9th, 2023

    • The auto-renewal fee for a contract is $0.026 USD

  • Storage payments on Hedera will start once a total of 100 million key-value pairs are stored cumulatively across the network. These storage fees will be part of the rent payment collected when a contract is auto renewed. Once storage payments start (100M k-v pair threshold):
    • Each contract has 100 free key-value pairs of storage available

    • Once a contract exceeds the first 100 free key-value pairs, it must pay storage fees. Valid renewal windows are between ~30 and ~92 days (see HIP-372)

    • The storage fee rate is $0.02 per key-value pair per year

  • If a high enough utilization threshold is reached, congestion pricing applies
    • In this circumstance, prices charged are inversely proportional to the remaining system capacity of the network (lower remaining capacity means higher pricing)

    • This applies to all transactions

Rent Equation

The Model for Storage Payments: Rent with an Initial Promotional Offer

The Hedera network does not collect any storage payments today. This will change once the network reaches 100 million key-value pairs cumulatively across the network. We are committed to providing as much notice to our developer community as possible as to when usage is likely to reach a threshold that will trigger collection of storage payments.

After that point, every contract on the network gets 100 key-value pairs of storage for free. That means that if the state size of a contract is relatively small, it won’t have to pay storage fees. However, if a contract exceeds 100 key-value pairs of storage, then it must pay for every key-value pair. The expectation is that Hedera Coin Economics Committee will set this rate to $0.02 per key-value pair per year. This applies to all contracts on Hedera, regardless of the contract being created before or after the rent payments go live.

Finally, a congestion pricing model is also implemented when a high utilization threshold for the network is reached to encourage the responsible utilization of network resources. In this model’s pricing, the cost per key-value pair increases proportionally to 1/d, where d is network capacity minus utilization. In simple English, the pricing at this stage is inversely proportional to the remaining system storage capacity of the network – so, lower remaining capacity means higher prices. Keep in mind that deleted entities (after expiration and grace period) free up storage on the network. This means that in a scenario where congestion pricing is triggered, prices would go back down to normal if enough entities are deleted.

The storage fee schedule for the entire Hedera network can be visually represented by something like the following:

Fee Structure

Valid renewal windows for entities are defined in HIP-372: Entity Auto-Renewals and Expiry Window. The minimum renewal period possible is 2,592,000 seconds (~30 days) and the maximum is 8,000,001 seconds (~92 days). So, if you decide to renew your contract for the maximum possible duration of about 3 months (25% of a year), the rent payment would be 25% of the yearly rent. Also keep in mind that when a contract allocates new key-value pairs (beyond 100) in a transaction, the network will charge prorated rent in the same transaction. For example, if contract 0.0.X has 10 days until its next auto-renewal, and it allocates 2 new key-value pairs in a transaction, then the network will charge 10 days worth of rent for those 2 pairs.

How Do I Get Ready to Pay Rent?

The previous blog post about rent outlines that a smart contract on Hedera will be able to pay in two ways: contract funds or external funds. The network will first try to charge rent to the contract’s auto-renew account, if specified; it will then fall back to charging any unpaid rent to the contract account itself. If the full rent cannot be paid for a transaction, the entire contract operation will be reverted and all gas consumed, with no effect on the state of the contract.

Rent payments are collected automatically. You don’t have to worry about making any API calls or taking any manual steps for the contract to renew as long as there is a sufficient HBAR balance in the contract or in the designated auto-renew account.

Here are a few actions to help you prepare and plan for rent going live on Hedera:

  • Remember the renewal windows for smart contracts (~30 to ~90 days) and consider one that aligns with your needs
  • Specify auto-renew account and period (or expiration time) for newly deployed and updatable contracts
  • Enable and/or perform HBAR transfers to your existing and future contracts (via SDK crypto transfer, payable function, or receive/fallback functions)

Continue Learning about Hedera