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

[Oracles] Economic Model #1279

Closed
belane opened this issue Nov 25, 2019 · 25 comments
Closed

[Oracles] Economic Model #1279

belane opened this issue Nov 25, 2019 · 25 comments
Labels
discussion Initial issue state - proposed but not yet accepted oracles Oracle related issues

Comments

@belane
Copy link
Member

belane commented Nov 25, 2019

Discussion of the pricing and reward model for the Oracle system.
We must also cover possible penalties for malicious nodes.

This topic is closely linked to oracle policy #1277

@belane belane added the discussion Initial issue state - proposed but not yet accepted label Nov 25, 2019
@belane belane added this to the NEO 3.0 milestone Nov 25, 2019
@belane belane added the oracles Oracle related issues label Nov 25, 2019
@doubiliu
Copy link
Contributor

Cost model
Since the size of return data is limited,we can compute fee by the invoke counts.
Oracle Fee=Request count * perRequestFee

Incentive model
It is hard punish malicious nodes.Because there is not a effect way to prove oracle return a wrong
data when it access a URL. So penalties maybe is not necessary.

And Oracle Fee can be assigned to Oracle nodes on average if we do not consider Freeload problem .This can avoid evil Speaker.

@shargon
Copy link
Member

shargon commented Nov 29, 2019

Also we need to define the payment method. We need a new gas field?

@doubiliu
Copy link
Contributor

doubiliu commented Nov 29, 2019

A simple way is define a new field OracleFee in tx. And it will be a key paremter to limit the request count when VM executes a script. @shargon

@erikzhang
Copy link
Member

erikzhang commented Nov 29, 2019

Is Oracle fee fixed?

@doubiliu
Copy link
Contributor

doubiliu commented Nov 29, 2019

Oracle Fee=Request count * perRequestFee
perRequestFee is Fixed.
Request count is setted by user. If Request count<actual Request count,VM will return fault
@erikzhang

@erikzhang
Copy link
Member

erikzhang commented Nov 29, 2019

If perRequestFee is fixed, we don't need an extra field. We can calculate it easily and mix it with NetworkFee. In fact NetworkFee is already mixed with transaction size fee and verification fee.

@doubiliu
Copy link
Contributor

doubiliu commented Nov 29, 2019

If mix it with NetworkFee,all speaker should commit Oracle transaction preferentially.

@doubiliu
Copy link
Contributor

And if we use NetworkFee ,we can not limit request count in vm.

@erikzhang
Copy link
Member

Do you mean "retry"?

@Tommo-L
Copy link
Contributor

Tommo-L commented Nov 29, 2019

We can calculate it easily and mix it with NetworkFee

A precondition is required, consensus node's address is the oracle node's address.

Using OracleFee, it can help to limit the count of oracle requests in vm (as the oracle fee is not contained in sysfee), when the oracle tx executed on chain. And it's easier to calculate dividends.

@erikzhang
Copy link
Member

Do we allow multiple requests in a single transaction? Or do we only allow one request with multiple retrying?

@erikzhang
Copy link
Member

I think the easiest way is to add the fields to OracleRequest.

public abstract class OracleRequest

@shargon
Copy link
Member

shargon commented Nov 29, 2019

Do we allow multiple requests in a single transaction? Or do we only allow one request with multiple retrying?

Yes, but if it is to the same resource, it will take the cached result for the second request. Only one request will be done to internet.

@shargon
Copy link
Member

shargon commented Nov 29, 2019

I think that retry is more related to the own node policy, if he know that his network is unstable, maybe he need to retry the request, otherwise not.

@doubiliu
Copy link
Contributor

doubiliu commented Dec 2, 2019

I think it is necessary to allow multiple requests in a Oracle transaction.Since the logic of smart contract is flexible,user will have demand to multiple invoke Oracle service in one Oracle transaction.(Of course,contain 'retry').We should not limit these demand.

@doubiliu
Copy link
Contributor

doubiliu commented Dec 3, 2019

Well,let's do some summary:

Cost model
I think the size of return data will have a max value,so we can calculate costs based on the invoke counts.
Oracle Fee=Request count * perRequestFee.
perRequestFee. is a fixed value and will be setted in native contract.
Request count is a dynamic value and will be setted by user according to his demand.
And Oracle Fee maybe as a field in TX well.I don't know the logic of 'OracleRequest',so I can't confirm whether it is appropriate.

*Of course,we can limit that one TX can only have one request.But I think it will reduce the flexibility of smart contracts.

Incentive model
As mention above,it is hard punish malicious nodes.So designing a penalties model is difficult.
Distributed fee evenly to all Oracle nodes maybe is a simple and effective way if we can tolerate some little evil,such as freeload.

But we still need design some mechanism to avoid obvious attack.Oracle Fee is an important field.Since to system it is hard to know the actual request count before the script has been executed.To avoid free request,I think we need some limit.

We can use OracleFee to limit actual request count.We need a little change on VM code.
When VM load a script,it will record the max request count.And every time script invoke a Oracle Service, the value will minus one.If value==0,Oracle Service will not work and return fault directly.
This can avoid free request effectively.

image

@doubiliu
Copy link
Contributor

doubiliu commented Dec 3, 2019

@shargon @belane @erikzhang do you have some comments and suggestions?

@belane
Copy link
Member Author

belane commented Dec 9, 2019

It looks good. I agree with you, we should allow more than one request for smart contract/invocation.

We can talk about all the limits we need in #1260

@shargon
Copy link
Member

shargon commented Apr 18, 2020

Now that we decided the two TX model, we need to define the economic model. I made this proposal #1579

  • SysFee it's for oracles (request and response) goes to Oracle multisig if it has less than X otherwise it will be distributed for oracle nodes.
  • User will pay for the response extra cost.
  • User will pay for the filter cost.
  • It should have an additional extra cost (TBD)

@erikzhang
Copy link
Member

Do we have a native oracle contract? Maybe we should remove the SYSCALL and change it to a method of the contract. Then the fee can be sent directly to this contract. So there is no need to deduct from sysfee.

@shargon
Copy link
Member

shargon commented Apr 18, 2020

Do we have a native oracle contract?

Yes

Then the fee can be sent directly to this contract

you mean listening the notifications?

Maybe we should remove the SYSCALL and change it to a method of the contract

Agree

@erikzhang
Copy link
Member

Yes.

@erikzhang
Copy link
Member

Or even the oracle contract can transfer the fee from the sender's account automatically.

@shargon
Copy link
Member

shargon commented Apr 18, 2020

But the response it's persisted before the request, in the request it's located the fee, and for taking this fee we need the oracle multi signature.

@shargon
Copy link
Member

shargon commented Apr 18, 2020

If we check the notifications when user consume the downloaded data, if the user tx fault, oracles won't be rewarded.

@shargon shargon mentioned this issue Apr 18, 2020
@erikzhang erikzhang removed this from the NEO 3.0 milestone Sep 3, 2020
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 oracles Oracle related issues
Projects
None yet
Development

No branches or pull requests

5 participants