Neo: [Oracles] Economic Model

Created on 25 Nov 2019  ·  25Comments  ·  Source: neo-project/neo

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 https://github.com/neo-project/neo/issues/1277

discussion oracles

Most helpful comment

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

All 25 comments

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.

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

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

Is Oracle fee fixed?

Oracle Fee=Request count * perRequestFee
perRequestFee is Fixed.
Request count is setted by user. If Request count @erikzhang

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.

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

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

Do you mean "retry"?

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.

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

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.

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.

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.

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

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

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 https://github.com/neo-project/neo/issues/1260

Now that we decided the two TX model, we need to define the economic model. I made this proposal https://github.com/neo-project/neo/pull/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)

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.

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

Yes.

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

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

realloc picture realloc  ·  4Comments

vncoelho picture vncoelho  ·  3Comments

vncoelho picture vncoelho  ·  4Comments

lock9 picture lock9  ·  4Comments

shargon picture shargon  ·  4Comments