Smart Contract Rent on Hedera is Coming: What You Need to Know
Headshot
Jul 29, 2022
by Ed Marquez
Developer Evangelist

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 new blog post explains Hedera's pricing structure and renewal windows for contract rent payments.

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 fees are an economically and technically viable approach to manage smart contract state storage.

Bottom Line on Top

  • Smart contract rent on Hedera will start once a total of 100 million key-value pairs are stored cumulatively across the network

  • Once rent payments start on Hedera:
    • 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 rent. Note that valid renewal windows are between ~30 and ~92 days (see HIP-372)

  • 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

The Model: Rent with an Initial Promotional Offer

The Hedera network does not collect any rent today. This will change once the network reaches 100 million key-value pairs cumulatively across the network. Based on current usage patterns, we don’t anticipate rent logic reaching the threshold for starting rent collection in the next quarter. In addition, 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 rents.

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 rent. However, if a contract exceeds 100 key-value pairs of storage, then it must pay rent for every key-value pair. The expectation is that Hedera Coin Economics Committee will set this rent rate of $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 rent 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.

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 present; 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 ideas to help you prepare and plan ahead for rent going live on Hedera in the future:

  • 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