An Ethereum API for Android App Developers

The time we first laid eyes upon the Ethereum project we were absolutely hyped because we imagined all the possibilities the Blockchain could hold for Android app development especially in terms of a fast and secure billing alternative for in-app purchases.

As we got in touch with the technology and started working on Dapps ourselves we noticed not only the lack in Android support for Ethereum applications but the few existing Ethereum wallets were either scams or cross-platform apps not optimized for Android and with centralized nodes on 3rd-party servers. You might ask yourself now: “Wait... but Ethereum on Android without connecting to a 3rd-party server? With a Full Node? That would take up way too much space on the device.” That is correct. While there are ways to get a Full Node running directly on an Android device, it would take Gigabytes of space even in this early stage of the Ethereum Blockchain and until light clients are a thing we need alternatives.

So we thought “necessity is the mother of invention” and started developing our own solution: Ethereum Android.

Ethereum Android as a mobile portal to Ethereum

As Java developers we had a number of goals in mind: our solution should be a native Android application, offer a pleasant user-experience, and offer the user a simple way to connect to an Ethereum Full Node on a personal server. We wanted to build an Ethereum toolbox for Java developers, with all the tools developers are used to work with.

Ethereum Android consists of three parts:

  • the Server Node which is based on ethereumj,
  • the wallet app which offers the similar functionality to the Mist Browser of Ethereum,
  • and most importantly for developers: an API to access the Ethereum Virtual Machine

The Server Node

Since we critisized the fact that other wallet apps only let you connect to a Full Node on a centralized server of a 3rd party, we wanted to improve that. We developed Ethereum Android in a way so that a user can easily set up his own Full Node of the Ethereum Blockchain on a server of his choice (for example on a Raspberry Pi) and securely connect our app to it. By default the app connects to a Full Node on one of our servers end-to-end encrypted. In case a user wants to set up his own Full Node of the Ethereum Blockchain, we provide a Docker Image which he can use to run a Container with a Full Node on his server and connect our app to it. As well the connection will be end-to-end encrypted through our crypto-library.

This way we not only give the user more freedom in usage but we also align to the mindset of the blockchain.

Easy switching between server nodes. The connections will be end-to-end secured.

The wallet app

In the simplest manner of speaking the app can be seen as an Ethereum wallet app, which will offer the same functionality as the Mist Browser:

  • signing transactions (e.g. sending Ether)
  • querying the Blockchain (e.g. checking your Ether balance)
  • interacting with Smart Contracts

Our main goal here is to design the app in a way that makes interacting with the Blockchain feel like using any other Android app, so that users who are curious of Ethereum won’t be scared off right from the start.

The API

This is going to be the heart of Ethereum Android and should be especially interesting for other Android developers. We will build a library for Android with the Blockchain protocol so that Android developers can use the methods of it in their code to work with the Ethereum Blockchain.

The architecture is similar to that of Google Play Services: an app that wants to use the Blockchain can use our library to do so, just like the client library from Google Play Services. The app then has access to the Ethereum Blockchain and is able to read the state of adresses on the Blockchain, get transaction logs, read the state of Smart Contracts and so on.

Our app Ethereum Android then works as an access portal which means a user can monitor every app that accesses the Blockchain on his behalf on the one hand and on the other hand set specific permissions for each app. Reading the Blockchain will be enabled for every app but the user can also allow an app to interact with Smart Contracts or send Ether.

You can set permissions for each connected app, whether it can only read transactions from the Blockchain or can interact with Smart Contracts and send Ether.

We want to provide a platform where developers have the freedom to create amazing Android based solutions for the Ethereum Blockchain and where users can keep track of the activity of any app using the Blockchain.

Status quo

We are still in closed Alpha, nonetheless, we wanted to present what we currently have and are eager for your feedback and maybe proposals on how to improve our idea.

At this time we have a first version of the Server Node, which you can download here if you wish to let the container run on your preferred server.

We have also released two repositories: a first version of our library and a sample application.

Though we are pretty far with the wallet app it is not yet ready to be let out in the wild, but if you are interested we would love to make you one of our Alpha testers. :) Just visit the project site ethereum-android.com and write us a quick message.

If this article caught your interest, you can keep reading to see how fast you can set up your own Full Node (at this point for testing purposes) and connect our app to it.

Setting up your own Server Node for testing and connecting Ethereum Android to it

To set up a running Full Node from a Docker Container just run our ethereum-node-test Docker Image:

docker run --rm pacs/ethereum-node-test:0.0.5 --privatenet

The flag privatenet sets up a new private Blockchain and starts mining on it.

Running the Docker Container of the Server Node for testing

We use the secure tunneling service ngrok to make the container accessible.

When you access the Server Node in a Browser you will see its Fingerprint, which you can use to connect to it via Ethereum Android

In Ethereum Android we can pair the app with our newly created Ethereum Node simply by entering its URL.

Type in the URL of the Ethereum Node to pair it with the app

After connecting to the Node the app shows you the Fingerprint of the server which you have to verify either by comparing or by scanning the QR-Code from the Browser.

After pairing with a Node Ethereum Android shows the Fingerprint of the server which you have to verify to assure a secured connection

After you successfully paired Ethereum Android with a Server Node, you are already able to receive Ether because the app generated a new account directly at startup. But you can also import an account by entering its private key or by using your private key generated with MyEtherWallet.com.

The menu shows the Identicon of your account as well as its Ether balance

As soon as you have Ether you can spend it.

Sending Ether
Show your support

Clapping shows how much you appreciated P-ACS’s story.