I started reading about HydraChain and came across their concept of native contracts. This means that nodes can bypass the EVM and run contracts locally. I don't understand the point in having this facility. This is making the blockchain less secure and non-deterministic. How is consensus achieved in these native contracts?

It was also mentioned that native contracts can communicate with EVM based contracts. So, is this like an unsafe version of Oracle? Also, if I can somehow take hold of this native contract, I can send malicious/unexpected data to the EVM based smart contract and there's no one checking the correctness of this data, which is not desired. So, what's the use of having these native contracts?

1 Answer 1


Hydrachain is meant for private- (aka consortium-) networks. Unlike solidity code running on the EVM, native contracts allow programmers to write non-deterministic, infinitely running and sandbox escaping code. Non-deterministic code can indeed prevent the network from reaching consensus. On private networks these mistakes are meant to be prevented by having a stronger governance & quality management on smart-contracts. The upside of native contracts is that developers are not limited by gas and gas-limit (which don't make sense in a private network) and the code runs significantly faster than on the EVM.

Native contracts should not be confused with pre-compiled contracts. Pre-compiled contracts as described in the Ethereum yellow paper are reusable functions that run outside the EVM but can be invoked from the EVM. For instance SHA256, RIPEMD160, and ECRECOVER are implemented as pre-compiled contracts. Like native contracts the pre-compiled contracts run more efficiently then solidity-code on the EVM but unlike native contracts these pre-compiled contracts are strictly specified (in the yellow paper) and they do consume gas.

  • Is there any consensus based checking to verify if the native contracts are deterministic? Or do we have to make sure of that ourselves?
    – galahad
    Aug 11, 2016 at 14:25
  • 1
    make sure of it yourself or you may break consensus - if they result in different state roots, your network will split.
    – Ethan
    Aug 12, 2016 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.