Skip to content

Smart Contract Economics #539

@cmichi

Description

@cmichi

Problem

Substrate continuously charges a contract for rent. If the contract's balance exhausts these liabilities the contract is evicted and a tombstone (i.e. a hash of the code) is placed in its place.

This requires contracts who want to live for a long time to think about an economic model how they can sustain themselves. Currently it's not clear how they are supposed to do this and some necessary information is not yet exposed to ink! (like how much the costs are per block or the rent projection).

Open Questions

  • In ink!, how should contracts best charge more for calls in order to save up for their rent fee?
    • Mark as payable, check how much the call costs and require an additional amount? How should the "additional amount" be determined?
  • What constants need to exposed in ink!?
  • Is it possible to expose an estimate of how many blocks until the contract will be evicted in ink!?
  • Are there already best practices in related projects?

ToDo

  • Research how related projects solve this.
  • Implement a solid example demonstrating smart contract economics. Maybe a contract that just tries to live forever? The example should contain off-chain tests.
    The other ToDos will probably derive from that. For example, the off-chain environment contains a number of unimplemented!() for tombstone/eviction functionality, they need to be implemented.

Resources

Metadata

Metadata

Assignees

Labels

A-examples[examples] Work itemB-researchResearch task that has open questions that need to be resolved.C-discussionAn issue for discussion for a given topic.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions