1

I was wondering why smart contracts have to be deterministic. As I understand it, to deploy a smart contract you just send it as the payload of a transaction without specifying a recipient. It's then compiled to bytecode to be run on the EVM. All miners have some dataset derived from the full chain (down to the genesis block) which they use as the basis to solve some complex math problem that can only be done through brute force. The miner that solves this problem gets the block reward (until ETH switches to PoS).

I don't understand why consensus can't be reached if the contract is non-deterministic. Does it have to do with the way that transactions generated by the contract are validated and not the validation of the contract itself? Thanks.

1

2 Answers 2

0

That is correct. It is important that the transaction execution can be validated by an impartial party. This means that anyone has to be able to "process" the transaction and get the same result. If the smart contract deployment transactions were indeterministic, then we wouldn't be able to trust that the EVM, and the smart contracts within, will behave as expected.

0

To deploy smart contract on blockchain, you have to make a transaction with payload as byte code of smart contract and recipient as 0 address (burn address). If you have to change any state (variable, array etc) in smart contract, you have to pay gas as payload is given to the smart contract to change the state. Could you be more specific on determination part?

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.