[neo-project/neo] Remove APPCALL and invoke contracts through SYSCALL (#301)

Currently, the contract invocation is done through the appcall instruction (and the corresponding stack isolation instruction), and NeoVM will directly look for the target contract. This is very unreasonable for NeoVM, because the list of smart contracts on the blockchain should not be directly visible to NeoVM.
We need to create a new SYSCALL API to invoke contracts and discard the original APPCALL instructions.
If we do this, there will be two additional benefits:
— We do not need to do extra work to implement stack isolation, because invoking a new contract in SYSCALL will start a new virtual machine.
— We can easily implement a new type of smart contract: native contracts. The native contract is not run in a virtual machine, it is a contract built into the block chain code. But they can expose their scripthash to other contracts so that other contracts can invoke them. In a SYSCALL it is easy to determine whether the contract being invoked is a normal contract or a native contract, and use the right environment to start it. This is not done with the original APPCALL.
One scenario for native contracts is that in the future we can use the native contract to implement **neo** and **gas** (or all global assets) so that we can use a unified approach to sending and receiving assets in smart contracts.

Добавить комментарий