I've read that ether is divisible to 1018.

Say you're writing a simple contract which takes deposits sent to it divides the deposit in 2 and sends it to 2 separate addresses. What happens if someone doesn't take into account the smallest possible amount being deposited? Will the contract simply not accept the deposit or will it accept it then fail?

1 Answer 1


Depends on the contract, but if it's just blindly dividing the deposit value by 2, it's likely using the DIVIDE OPCODE of the Ethereum Virtual Machine, which does integer division, which means all fractions get truncated.

So, if someone sent in one wei (smallest unit of Ether), 1/2 = 0, so both addresses would be sent zero wei, and the one deposited wei would end up owned by the contract (and would stay there unless the contract has some function to spend its own funds, or means to selfdestruct and send those funds to some owner).

This would also happen for any odd number of wei; sending in 1001 wei would result in: 1001/2 = 500. Each address would be sent 500 wei, leaving one remainder owned by the contract.

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.