This proposal does not require Virtual Machine modifications. It only requires to add one new download syscall. This Syscall accepts two parameters: URL and xpath filter.
Thus, we reduce stored content in DownloadExecutionCache to the mĂnimum needed for Smart Contract.
As an example, only the filtered content is agreed and stored, optimizing storage space, meaning 1 MB JSON will not be stored into the chain but just the values the smart contracts needs.
XPATH filter also helps to achieve determinism in webs/APIs that have variations in each request and these variations are outside the data that Smart Contract needs.
As an example, the following API’s response {“name”:”NEO”,”time”:213123123213} where time varies in each request, but the Smart Contract only needs “name”, this non determinism problem won’t exist during Oracle negotiation.
(_Note: Maximum content size and total TBD_).
During a Smart Contract execution it will check if the result exits in the DownloadExecutionCache every time Oracle’s syscall is used.
If the node represents an authorized Oracle or a client building his/her transactions, it will download the content, apply the filter and generate DownloadExecutionCache.
In case the client is building the transaction, it will include results hash in OracleExpectedResult before signing and broadcasting the transaction.
During execution, the virtual machine (syscall) will return “Failure” if there is no total or partial DownloadExecutionCache, or if the final OracleAgreement is false.

Good design.But as my comment in economic model,I think we should do a little change.
We must avoid free request. @belane
https://github.com/neo-project/neo/issues/1279#issuecomment-560986245
@doubiliu free request it's a second request with the same values? (because it's cached)
No.Free request means paid less than the actual number of executions
Such as:
User only pay fee for 3 request.But in Script it invoke 4 times Oracle Service
@shargon
I think that if the execution requires 4 but the user has only paid for 3, the transaction should enter into the block as failed and thus charge the fee to the user anyway.
It is also possible to return the execution failure, but we should understand that the Oracle node cannot know the actual number of calls in advance. So the purpose of OracleFee is to make it the basis for evaluating the number of calls when the Oracle node executes the script. @belane
If there are fee, he should try to get the result, because he need to know the response in order to know how much fee he need it. It should be on the price.
Normally, this is correct. But if I try to attack, then I can only pay once but call the service multiple times in the code, I don't care about the result of the request, I just want the oracle to do useless work
The oracle needs a mechanism to verify the number of calls
If you pay, and it's not enought for 1 byte, you will be FAULT. It's the same with regular TX
Calling a service will incur a fee and pay once? @shargon
@shargon I think we can start with the first implementation of Syscall (or draft) as it has been decided which are the first filters, protocols and responses to be implemented.
It has also been decided:
@belane what about when the contract is expecting variations, in future is it feasible to support non-deterministic requests?
I think that filters are very important, but also, it should be deterministic, so this is my proposal.
Download(url, filter)
Where filter is a nef script (like an eval), after download, we will create a new ApplicationEngine with this script without storage access and with the result of the Oracle as an argument.
The cost of this execution will not be added as the cost of the main execution (because it will be executed only in wallets and oracles), But oracles will add this quantity in his desired amount in order to process the transaction.
Another idea is the filter as a Pointer (https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/Types/Pointer.cs) we can obtain the same behaiviour, but it should be isolated, without storage access, and it could produce undesired results if the developer use static vars that was altered before the execution of the filter (with storage access).
The filter template should be like this
```csharp
public class MyFilter :SmartContract
{
public byte[] Main(byte[] result, bool isError)
{
return result;
}
}
````
Most helpful comment
@shargon I think we can start with the first implementation of Syscall (or draft) as it has been decided which are the first filters, protocols and responses to be implemented.
It has also been decided: