Ethereum Development Tools – an Evaluation Matrix

Developing for the Ethereum World Computer – Revisited

When comparing development methods for and in the Ethereum space, it becomes obvious how brilliant the people involved actually are: as a developer, you have several choices of great development tools and environments, even though the development process for Dapps is quite difficult: it involves different “layers” (frontend with HTML/CSS/JavaScript and backend with the Ethereum blockchain), different languages (JavaScript for frontend dev, Solidity for backend dev), different contexts (public/private/proprietary blockchains).

Taking these different contexts into account, evaluating the different development environments is only possible by identifying the different aspects and value them according to the own preferred usage.

Aspects of Dapp Development

Ethereum-docs-intro (1)

  • Solidity Development / Solidity Environment
    User can edit Solidity content in a text editor, there should be at least syntax highlighting.
  • JavaScript/Web Environment
    User can edit JavaScript, HTML and CSS in a text editor and gets different levels of support like syntax highlighting, code completion, etc.
  • IDE
    User can not only edit code (Solidity and JavaScript), but can also compile, check into a versioning system, debug and deploy to some operating environment.
  • Versioning
    Versioning is supported, eg. by enabling the user to check edited content into a versioning system, show diffs, apply patches, etc.
  • Collaboration
    Modification of code by multiple users is supported, at minimum support of different versions of the code is possible to avoid conflicts.
  • Deployment
    Working code can be deployed to some environment which enables the user and other users to use the working program (a sandbox or real blockchain and a web application server for JavaScript like node.js and static content like HTML and CSS files)

A first Categorization and a Teaser

We will summarize in short the different aspects which are supported in these development environment: Solidity Browser / Ethereum Wallet, Truffle and Ethereum Studio.

This is also a teaser for the upcoming blog posts, which will explain the environments in detail.

Solidity Browser / Ethereum Wallet

In terms of architectural styles, both environments represent minimalism. They are slim and handy, easy to use and fast to learn, but lack some functionality if real development “in the large” is necessary.

Ethereum-docs-browser
Solidity Browser, only Solidity Development, no Environment, ie. not even save of file is possible

Ethereum-docs-wallet
Ethereum Wallet (Mist), only Solidity Environment, no save of file possible, but integrated compiler

Truffle (also: Embark, Dapple)

Truffle satisfies all aspects which a usual client application can offer, therefore you can think of Gothik, it is mighty, almost lavish, and well structured. If you come from web development in JavaScript with node.js, who should look no further, this environment is for you (at least if you don’t need support for online development, versioning and multi user directly in your environment, but use external tools like Git and testrpc for these aspects).

Ethereum-docs-truffle
Truffle, also Embark and Dapple: web development environments, usefully extended with Solidity support

Ethereum Studio, the all-in-one-solution

The Ethereum Studio, in our opinion, resembles Deconstructivism. Why’s that? Because here all aforementioned aspects of software development are taken apart and are reconstructed to fit perfectly to Dapp development. This is an all-in-one-solution which we can really recommend, with two limitation: you have to agree to a uncertain pricing model (it just doesn’t exist right now, you can still test the product) and a “closed” environment, which works seemless and smooth, but expects you to let in to this tool and the development process.

But no other tool lets you test your code this easy with manual and even unit testing built into the environment.

Ethereum-docs-studio
The all-in-one-solution, steep learning curve, but all you will ever need in multi user, versionized, unit tested Dapp development

Stay tuned for the detailed explanations of these great development tools.

Wir machen uns die Welt … wie sie uns gefällt

Nach der Entdeckung der neuen Welt und dem Überwinden der ersten Hindernisse wollen wir uns nun sesshaft machen und anfangen, Applikationen und Smart Contracts jenseits von “Hello World” zu entwickeln.

Aber wie fangen wir an? Die ersten Erfahrungen mit dem fantastischen Tool cosmo.to waren viel versprechend, leider ist das Tool mittlerweile online nicht mehr verfügbar. Der wahrscheinliche Grund ist die Tatsache, dass das Standard-Ethereum-Wallet von ethereum.org die gleiche Funktionalität und noch viel mehr bietet. Allerdings zu Lasten der Übersichtlichkeit.

Wir wollen deshalb hier einen Überblick der bekanntesten Entwicklungsumgebungen geben, mit einer subjektiven Einordnung in Architekturstile:

  • Minimalismus: minimal, übersichtlich, aber auch schlicht: der Solidity Browser. Super zum Erlernen der Sprache Solidity, aber das war’s dann auch schon. Persistierung? Versionierung? Alles nicht vorgesehen. Super für den Einstieg.
  • Bauhaus: funktional und praktisch: das Ethereum Wallet dient nicht nur als Wallet selbst, sondern ermöglicht die Erstellung und das Deployment von Smart Contracts und die Verwaltung von eigenen Tokens.
  • Gotik: opulent, gut strukturiert, mächtig: Truffle ist ein reines Javascript-Framework und verwendet alle Komponenten, die moderne Javascript-Entwicklung bietet: Gulp, Mocha, Chai, etc. Sehr gut dokumentiert, ebenfalls gut für den Einstieg geeignet, bietet darüber hinaus aber auch viel mehr.
  • Kubismus: ganz anders, aber erfolg- und einflussreich: die Entwicklungsumgebung von Microsoft, Visual Studio (Community) oder der neue Open Source Editor Visual Studio Code zusammen mit BlockApps STRATO, einer zentralisierten Blockchain. Leicht zu nutzen, mit automatischer Frontenderstellung. Etwas für den anderen, schnellen Einstieg in private Chains mit Microsoft Azure.
  • Dekonstruktivismus: das “new kid on the block”, das Ethereum Studio von <ether.camp> macht alles etwas anders, nach unserer Meinung auch besser: eine verteilte Entwicklungsumgebung auf Basis von cloud9, ein integrierter Sandbox-Ethereum-Node, eine Deploymentmöglichkeit in alle möglichen Umgebungen (die JSON-RPC verstehen). Leider auf Dauer nicht kostenlos, Preise sind noch nicht bekannt.

In den nächsten Wochen werden wir die hier erwähnten (es gibt noch zahlreiche andere!) Entwicklungsumgebungen genauer testen, immer mit dem gleichen Tokenbeispiel. Stay tuned!

Homestead … settling down

Having crossed frontiers in unknown and unsafe land, finally, we are settling down.

After having described last time how to create our own cryptocurrency in Ethereum Frontier – the description of which was way to complicated as we have learnt – we will repeat it, this time in Ethereum Homestead, and we assure you: this time it will be really easy.

In fact, creating a new cryptocurrency is even built into the new Ethereum wallet, so if you use the proposed “coin-interface“, your own currency is even supported with an own pocket in the wallet itself, besides your real Ether – this is just gorgeous and if you are still unsure about the world dominance about Ethereum, try this out and hopefully, just be astonished.

EtherumWallet

Ok, enough propaganga, let’s get down to the nitty-gritty.

Objective

Create you own cryptocurrency in Ethereum Homestead. You should be able to fund yourself with some amount of initial value (let’s say 10000 items) of your own currency and be able to send it around to any valid Ethereum address.
This currency should in no way be related or dependent on an existing crytocurrency like Bitcoins or Ether and creating it should cost you not one penny of your fiat or “real” crypto-money.

Setup

The easiest way to archieve the goal would be to just follow the instructions on the new ethereum.org Homestead site closely, you can then use your cryptocurrency in the real and in the Morden testnet.

However, this approach has two limitations:

  • It takes longer than five minutes, which is our definition of really easy (but afterwards you will know why it works)
  • It runs on the real Ethereum blockchain or on the Morden testnet, but we want to build this using own very own, local and/or private, Ethereum blockchain.

If these limitations do not apply for me, stop here and go ahead and read the official tutorial.

Ok, I want my local, private blockchain, really fast, so let’s go…

Ready, Set…

  • Start Geth with an own genesis file and an unique networkid (greater than 1), for details see this post.
    You can use this genesis file, just store it as /ethereum/genesis.json (always add the drive for Windows, eg. c:/ethereum/genesis.json)

    {
        "nonce": "0xdeadbeefdeadbeef",
        "timestamp": "0x0",
        "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "extraData": "0x0",
        "gasLimit": "0x8000000",
        "difficulty": "0x400",
        "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "coinbase": "0x3333333333333333333333333333333333333333",
        "alloc": {
        }
    }

    and create the empty directory /ethereum/data
    The start command then is

    geth --genesis /ethereum/genesis.json --datadir /ethereum/data --networkid 123 --nodiscover --maxpeers 0 console

    we need this initial start with the console to create our first account, which we need to start mining.
    In the console, type

    personal.newAccount()

    and create your “etherbase”-account. Subsequent accounts can be created in the Ethereum Wallet.
    Make sure that you exit geth afterwards.

    …Go

  • Now, start the Ethereum Wallet, make sure Geth is not running currently
    There will be several dialogs, it does not really matter what you type in there. You should choose testnet if asked for real or Morden testnet.
  • Afterwards, when all steps have been completed, you will see an empty account in the Morden testnet

    ethereum-morden

  • Quit the Wallet.
  • To start the Wallet using our local testnet, consult the readme.txt in the installation folder and make sure you set the ipcpath cli argument correctly. On Windows, you can skip this step.
  • Start geth with this parameters (plus the ipcpath, if on Linux)
    geth --genesis /ethereum/genesis.json --datadir /ethereum/data --networkid 123 --nodiscover --maxpeers 0 --mine

After restarting the Wallet, we should see our created account with some Ether in it (we are mining currently and the difficulty is really low and we have no peers, so we get all the money)

account-start

Choose Contracts and Copy & Paste the code from the tutorial…

created-my-token

…linked on the contracts page

build-token

Don’t forget to set the arguments for your token/currency (like display name, initial supply, etc.)

arguments-token

Choose the fastest possible deployment (we have enough Ether right now).

fastest-deploy

Here we go, congrats to your very own cryptocurrency with Wallet support.

etherbase-mouc

Please comment on this tutorial, does it work for you? Did you get stuck at some step? We want to improve out tutorials to make sure more people use this great technology.

Entering the World Computer

Ever wanted to create your own, individual cryptocurrency?
Read on, if you reach the end of this post and have followed all instructions in the hands-on guide, you will have created your own working cryptocurrency in less than 20 mins.

How’s that?
The magic-happens-here part is done by the revolutionary technology named Ethereum or Ethereum Virtual Machine (EVM).

What is it?
Summarizing this great explanation: “blockchains are peer-to-peer cloud computers that collectively enforce a set of rules on a historical record that they create together. Bitcoin’s rules define a currency: how are new tokens produced, how many are allowed, how they can be transferred from one person to another, etc.
Ethereum’s rules define a process for defining new rules.”

Feeling a little “meta” here? For sure. Let’s try another definition:

“If you think of Bitcoin as a decentralized version of Microsoft Excel, then Ethereum is a decentralized Excel where we’ve made the visual basic macros functional, […] with the Bitcoin blockchain, each cell on this hypothetical Excel table holds just a number; on the Ethereum blockchain, each cell is home to an entire computer program.”

Before reading on, make sure that you understand this new dimension Ethereum adds to existing blockchain technology.
Your Bitcoins are static data blobs (yes, we are oversimplifying here, Bitcoins can be scripted. But nobody does.)
Your Ethereum contract can be a static data blob as well. However, it might as well be a condition checking for the release of your home’s lock after you paid your rent or Skynet trying to take over the world.

In essence, the new dimension of Ethereum consists in each “coin” being a turing complete computer program running in a peer to peer cloud.

Not excited by now? Ok, let’s take another perspective.

Even if you don’t hack a new facebook or google at night, you should be able to read and understand this program

contract token {
 mapping (address => uint) public balanceOf; // [1]

 function token(uint supply) { // [2]
   if (supply == 0) supply = 10000;
   balanceOf[msg.sender] = supply;
 }

 function send(address receiver, uint amount) { // [3]
   if (balanceOf[msg.sender] < amount) return;
   balanceOf[msg.sender] -= amount;
   balanceOf[receiver] += amount;
 }
}

with a little help by this walk-through:

[1] We are assigning an address to an “amount” (in many languages a dictionary, in Java a Map, you name it. A simple Key/Value Store)
[2] A constructor (in many (OO-)languages a initializer for the new object). Here this initializer is called once during the whole lifecycle of a smart contract: when the contract is written in the ledger (deployed). msg.sender is the address of the creator of the contract. He gets all the money.
[3] A very simple function which makes sure that the storage status can be changed, otherwise the programm would be completely static. Changing the storage status means transfering/sending amounts from one key (address) of the dictionary to another key.

So, here we are. Maybe you got it already, this is your own, individual cryptocoin. It starts with an amount of 10000 “items” which can be subdivided and sent to other addresses. This is exactly the minimum functionality of a cryptocoin.

Before you go on, try hard to understand what happens here – we are facilitating the properties of a cryptocurrency blockchain (cryptography, consensus algorithms, peer to peer technology), everything eg. the Bitcoin blockchain has, for our own rules. These rules are just transfering a value from one address to another and storing the result. That’s exactly as usual cryptocurrencies do.

Our cryptocurrency is one app (also called dapp for decentralized app) inside the Ethereum blockchain. See it as one really smart Bitcoin simulating the whole Bitcoin system itself (we are going meta again).

Ok, enough head spinning, let’s try this out.

Hands-on Guide to your own Cryptocurrency

One word of warning: after this tutorial, you will have your running smart contract in the (local, private) Ethereum chain, but you will most certainly not have understood how this is working.

To understand the principles and technologies behind Ethereum, I strongly advise visiting these sites:

  1. The Ethereum Main site: your entry point to Ethereum
  2. The Ethereum Frontier Guide Gitbook
  3. The Ethereum Builder’s Guide Gitbook
  4. A 101 Noob Intro to Programming Smart Contracts on Ethereum
  5. (Hands-on) How to create a Private Ethereum Chain 

This tutorial mainly is just a very compressed rewrite of those sites.

Ok, to be clear about the 20 minutes: reset your stopwatch now, we are counting the time from now on.

What’s the tutorial about?

  1. Creating a  local, private Ethereum chain
  2. Setting the stage
  3. Deploying our cryptocurrency in cosmo.to

Creating a local, private Ethereum Chain

We will start with installing Geth, the Go implementation of the Ethereum protocol. We chose Geth because it runs in Linux as well as Windows without having to install any dependencies before and with a dead easy installation procedure. (Might be a good point for Golang)

All instructions are in the Ethereum Guide, however the Windows link is wrong currently, use this one.

Now, here’s the important part missing in the main guide for using specific Ethereum chains:

A Ethereum chain is defined by two factors, which are unique to each chain: the network id and the genesis block. The genesis block is the big bang of your own Ethereum universe and the values there are the cosmological constants of your universe. If you want to participate in a specific Ethereum chain, you will have to

  • have a network connection to a running node
  • know and use the network id (given as command line parameter)
  • use the identical genesis block

Our genesis block looks like this, save this as genesis.json to some directory. All parameters are explained in detail here.

{
 "nonce": "0xdeadbeefdeadbeef",
 "timestamp": "0x0",
 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "extraData": "0x0",
 "gasLimit": "0x8000000",
 "difficulty": "0x400",
 "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "coinbase": "0x3333333333333333333333333333333333333333",
 "alloc": {
 }
}

Now, if you start Geth with these parameters

geth --genesis genesis.json --datadir somedatadir --networkid 23 --rpc --rpcaddr="localhost" --rpcport="8080" --rpccorsdomain="*" --maxpeers=1 console

the most important part is already done. With genesis.json and network id 23 your chain is defined and whoever wants to play with it has to agree on the genesis and the network id. Or she could just start her own universe with different cosmological constants, just like in real life. If you believe in multiverse theory. And in real life.

Setting the stage

Actually, the node we started above does not do much, it just sits around and does not mine Ether. Therefore, our universe has no “time”, it is static. We have to create a primary, “etherbase” account, to facilitate mining which we need for deploying our contract.

We are in the console now, just type

personal.newAccount()

you will get back a address like ‘0x693309002d4fbb672c90df7063b75b42055f5449’, which is your primary account address. Do it a second time to have another account. You will feel lonely otherwise transfering your new currency between you and you.

Now exit the console and restart with

geth --genesis genesis.json --datadir somedatadir --networkid 23 --rpc --rpcaddr="localhost" --unlock="0x693309002d4fbb672c90df7063b75b42055f5449" --rpcport="8080" --rpccorsdomain="*" --maxpeers=0 --mine

At startup, you will be asked for the password, just type it in, even if the console is moving, your keystrokes will be recognized.

This time, our universe is ticking. We can go on.

Deploying our cryptocurrency in cosmo.to

Right now our operating system is running, but using it as a developer is quite complicated. You have to compile your contract to bytecode first, using a compiler like solc and afterwards have to deploy the contract.

Of course, using it is also not the most intuitive thing. Remember the first days of the internet, of Java Applets, mobile application development on Android – there you are.

However, for this early stage in the history of the “internet of value” there exist quite a lot tools which ease development, one (to me the most stunning) projects is cosmo.to

It is based on the solidity browser, but adds a lot of usibility, try it yourself. Open cosmo and follow the notes in the attached screenshot.

Choose “auto” compile, copy the sample token source code from above and deploy it. The last step is crucial, since this makes our application usable. It is like running your executable or, in more modern terms, deploying your application to Bluemix, Amazon AWS, the Google Cloud, whatever. But your application has guaranteed 100% availability, and noone can shut it down. If you deploy it to the real Ether chain that is.

For our local Ethereum chain, your contract has now been mined (by yourself) and added to the ledger.

cosmo

Congratulations! The logic can now be executed and cosmo helps you a lot in using it. Use “call” to query the state and “transact” to change the state. Send your new currency to your 2nd account. You will have to wait some time (depending on the speed of your somputer) till the transaction is executed, so don’t wonder if the call does not succeed for some time.

Now play around. Do you get it? Create new accounts, send your token/coins around. This really is a value-exchange (even a currency) if you want to and the others, who are using your contract, agree with you.

They do not have to trust you at all, anybody can easily deduct that the initial amount of your coins is fixed at 10000 and cannot be extended. This is written in the contract and really nobody can change this, as nobody can change the Bitcoin ledger.

When people will really understand this trustless system, which can now not only transfer static value, but also run any application you can think of, we are sure that great things will emerge. And now you can be part of the universal Dapp system development. Have fun!