Decentralization: NEM vs Ethereum
Ethereum, miracle child of a blockchain, and its Ethereum Virtual Machine (EVM), is one of the prominent examples of blockchain use. Many ICOs have built their businesses on smart contract, one of which is DApps or decentralized application. Now we discuss: is Ethereum really decentralized? Are there different or “better” ways of writing blockchain applications?
First appeard on medium, by Tongokongo
With Bitcoin’s basic scripting language, users are able to create applications that perform some tasks on an automated basis. These applications run mostly on private servers and are managed by centralized entities. These are similar to NEM, a completely new blockchain, written from scratch and with much broader and easier-to-access functions than Bitcoin.
The main ammunition of people attacking NEM (the second most popular platform to create ICO on) is its lack of decentralized smart contracts. But is Ethereum really a decentralized platform as it advertises to be? Will it be worth the use to gain a glimpse of decentralization when trading for the rigidity and security of your application?
To create a contract on NEM, you need to relate to one or more of the API requests and group them in an offchain application. Technically, it is difficult to confirm if an open source code on the NEM platform is really the code that is running on the entity’s server. But does that mean it is less decentralized than Ethereum contracts?
The first counterargument in decentralization’s defense is of the compilation of Ethereum’s source code. Currently, most applications on the EVM is the solidity compiled byte code, with minority of serpent compiled code. Let’s take the example of the simple HelloWorld contract. Every time we want to check if we can trust a contract, we as users should take the open source code, compile it in exact compiler that was originally used, and then check if the bytecode we get from this operation equals the bytecode from the uploaded contract.
Bytecode:
“0x6060604052341561000f57600080fd5b6101578061001e6000396000f300606060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063942ae0a714610046575b600080fd5b341561005157600080fd5b6100596100d4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561009957808201518184015260208101905061007e565b50505050905090810190601f1680156100c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100dc610117565b6040805190810160405280600a81526020017f68656c6c6f576f726c6400000000000000000000000000000000000000000000815250905090565b6020604051908101604052806000815250905600a165627a7a72305820e417728d298add6f4e1210005cf05cb6f6f0f2bdfcf162e4e756e53e71d478660029”
(Ethereum Solidity contract and the same contract compiled to bytecode and ready to upload on EVM)
However, compiling and checking the bytecode of every contract we use isn’t the biggest problem. Currently, to make solidity contracts more robust and “upgradeable,” solidity developers use a special contract called Ownable.sol which allows the owner of the contract to modify some variables, kill the contract, or change the owner. It is very popular for contracts and is used by main contracts on Ethereum, making them centralized and much more robust at the same time. It allows the owner of the contract to write into external data storage without changing the contract logic. Also, most modern contracts are upgradeable through versioning system and/or detaching logic, which can be updateable from immutable data storage.
Using these techniques is considered good practice when writing a solidity code for Ethereum VM. But is it much different from scripting languages (historical Bitcoin and upcoming NEM) that are more contract-centralized but more secure on the code? At the end of the day, modern solidity contracts are decentralized only in the sense of storing timestamped data on the blockchain, while well-architected contracts are editable by owners. But if it isn’t different than non-turing complete blockchains, why learn another complicated language to access the blockchain data when you can simply use RestfulAPI-based NEM blockchain?
Bartłomiej Tony Sanak