Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An On-chain Pseudo Timer #1469

Closed
doubiliu opened this issue Mar 10, 2020 · 1 comment
Closed

An On-chain Pseudo Timer #1469

doubiliu opened this issue Mar 10, 2020 · 1 comment
Labels
Discussion Initial issue state - proposed but not yet accepted

Comments

@doubiliu
Copy link
Contributor

doubiliu commented Mar 10, 2020

Summary or problem description
At present, smart contracts use a passive trigger mode. By monitoring the update of the data on the chain and using external programs to build a transactions to invoke contract.

E.g. We want to do some clearing operations. Now we need to use the trading robot to trigger the call of the smart contract clearing function interface at some time. If the trading robot is down at this time, we can only wait for the project party to repair it or deploy a new one.If we have a timer on the chain, the operation can be done automatically.This can make smart contracts more flexible, and the reliability of the project will be stronger.

Do you have any solution you want to propose?

Aim

Designing a pseudo-timer, the basic functions include:

  1. Automatically trigger execution
  2. Turn the timer on / off
  3. Set timing time
  4. Authorized execution

Principle

The current consensus mechanism is difficult to implement the timer function in the true sense, but we can integrate external monitoring programs into NEO through a plugin and then combine some interoperation service to implement an on-chain pseudo timer.

We first set the functions that need to be executed automatically and the time interval (the number of blocks) in the contract.At the same time, the consensus node needs to install a monitoring plugin. Its role is to monitor which contracts have timed tasks enabled, add these calling tasks to the work task queue, and execute these calling tasks at the corresponding time (the execution interval set by the contract).It will construct a contract call transaction, this transaction will be broadcast to all consensus nodes, and the consensus node will multi-sign the transaction.When the number of signatures is sufficient, the transaction will be put into the block and executed on the chain.

New Interoperable Services

New interoperation services can be included into three parts: timing time setting, turning on / off timer, setting the function to be executed.

A. Timing time setting: set the execution interval (the number of blocks)

B. On / off timer: whether to start the timer

C. Set the function to be executed: Set the name of the function that the timer needs to execute periodically

Monitoring plugin

The monitoring plugin contains three functions: monitoring, constructing transactions, and signing transactions

a. Monitoring: Monitor the timing tasks of all contracts and add them to the work task queue

b. Constructing transactions: constructing transactions according to the work task queue at certain intervals

c. Signature transactions: Multi-sign the transaction and add it to the proposal block if the number of signatures is sufficient

Risk point

A. The problem of calling fee payment
B. Call permission problem

Scenes

1.Automatic settlement, airdrop and other operations
Settlement of auction results, airdrops of tokens, and other actions that need to be triggered off-chain can be triggered on the chain. NEO becomes a distributed computer.

2.Cross-chain (cooperating with Oracle can eliminate the need for alliance chain)
By combining timers with Oracle, NEO can realize the function of automatic handling, and there is every reason to become an intermediary, which can increase the value of NEO .

Neo Version

  • Neo 3

Where in the software does this update applies to?

  • Other:
@doubiliu doubiliu added the Discussion Initial issue state - proposed but not yet accepted label Mar 10, 2020
@shargon
Copy link
Member

shargon commented Mar 10, 2020

Take a look to this proposal #672

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Initial issue state - proposed but not yet accepted
Projects
None yet
Development

No branches or pull requests

2 participants