Understanding Ethereum Smart Contracts
I've been programing my own Ethereum smart contract (virtual currency) for awhile now. Here's some gotchas off the top of my head:- You have about 500 lines of code to work with. This of course varies, but smart contracts have to be really small to fit in the max gas limit (6.7 million wei).- You can't pass strings between contracts (coming soon).- There are no floating point numbers. Since you're probably working with "money", this can make things tricky.- You can break up your code into multiple contracts, but the tradeoff is an increased attack area.- Dumb code is more secure than smart code.- The tooling is very immature. You'll probably use truffle, which just released version 4. It makes some things easier, some harder. It's version of web3 (1.0) may differ from what you were expecting (0.2).- The Ethereum testnet (Ropsten) has a different gas limit than the main net (4.7 million vs 6.7 million).