In the future, we can adopt a lease model: the owner needs to pay rent periodically to extend the life of his contract. If there is no renewal, the contract will be destroyed automatically.
_posted by @erikzhang in https://github.com/neo-project/neo/pull/1480#issuecomment-599966583_
What do you think @neo-project/core
In fact, each dapp has its own life cycle, which represents an application or service, and our blockchain looks like a PaaS(Platform as a Service). A common way is to pay on demand.
_The lease model, which also adopted in EOS, I'll introduce it later._
Of course, such mechanism to rent the space of memory can be introduced to neo blockchain.
But we should keep the way to deploy permanent contracts.
Permanent contracts is really attractive for blockchain users.
For example, if you pay 1 GAS to rent a unit of space for deploying the contract for 1 year, then you can pay 100 GAS to deploy the contract permanently because if I deposit $100 in a bank and I will get $1 interest per year to pay the rent.
If it's cheaper a temporal contract, i am agree. As @vang1ong7ang said, we should keep the permanent contract, and also a way for change from temporal to permanent.
Combining the above points, I think we can do this:
Two types of contract
Lease contract: there is a period of existence, if the lease is not renewed after it expires, it will be automatically deleted, data is not retained, and deployment costs are cheap.
Perpetual contract: can only be manually deleted, expensive deployment costs.
Deployment method
deploy nef manifest <-r | d>
Interoper Service
System.Contract.Recent Creates a lease contract.
System.Contract.Renew Renews the lease, extends the service life of the contract, and extends
the fixed period value
Principle
What's happend with the neo and gas inside the contract if expire and the contract has NEO and GAS?
We can associate it with the payableattribute
Regarding the lease contract, if it is not restricted, it will be transferred to gas or neo. After expiration, it will cause permanent loss of global assets. This is unacceptable, so I want to design it like this: If a contract is transferred to gas or neo, it must be a perpetual contract, otherwise the transfer will fail to execute,.It only needs to add a check logic and it is not complicated.
@shargon
We could set the owner address in Abi, in order to send the funds before destroy.
I think so. Let's start to implement this?
If all of us are agree I can implement the owner inside Abi (for destroy), and you can implement the rent contracts.
I will create a issue for the owner idea
We could set the owner address in Abi, in order to send the funds before destroy.
I prefer to add an Owner field in ContractState, when we create contract. And default is the sender, but can also be specified. I think Owner is business information and should not be placed in the ABI.
Perhaps we can implement it later. It is not in the NEO3 roadmap.
Most helpful comment
Perhaps we can implement it later. It is not in the NEO3 roadmap.