Ethereum Contracts

Let's consider a few simple design choices that need to be considered in the Ethereum paradigm.

There is a time gap between when you sign a transaction, and when it gets included in a block in Ethereum. During this time, the state of the contract may have changed. For example, say you send out an order to market sell 10 shares, but after sending it you find out someone sold 250 shares and wiped out the liquidity.

Once the transaction leaves your hands, it can't be clawed back. If the transaction passes the validity checks of the contract, it will be executed and change the on-chain state. Otherwise it will be reverted with some message.

The first obvious step is to include a deadline in the function call parameters. A block with an inaccurate timestamp will be flagged and discarded by Ethereum validator nodes. So it is a reliable primitive to use. If I set a 10-second deadline I run a risk that the stochastic block-finding process isn't fast enough, and my deadline will already be passed by the time the outcome gets locked in.

The other step is to require a minimum outcome from the execution. So along with your order to do a market sell, you say "cancel the whole thing if I get less than $10".

Last updated