doublethinkco @ Ethereum Homestead

Earlier today the Ethereum main network successfully hard-forked into a new phase of development.   This was the Homestead Release which @obscuren announced a few weeks ago.

jeffrey
We’re taking the opportunity to have a tidy up here at doublethinkco too.

We we have a new logo and new Github repository name – cpp-ethereum-cross.

256

The renaming matches the forthcoming repo consolidation for the main cpp-ethereum project which we have been talking about for quite some time.   That reorganization will see the code for eth return to the cpp-ethereum repo which was its home from its inception until October 2015.


Screen Shot 2016-04-12 at 10.05.21 AM

You can read all about the reboot and repo shuffles at the brand new Ethereum C++ Homepage which I’ve been working on for the last week or so.

Get your cross-build Homestead binaries here -> crosseth-v1.2.2

RELEASED – Cross-build eth binaries for Homestead (UPDATED to 1.2.2)

pi-pie

Are you looking forward for the Homestead transition on Pi Day?

So are we, and if you have any ARM devices (SBCs, Linux mobile, etc) and would like something to play around with this week, here’s a fresh round of Homestead-friendly cross-built eth-v1.2.2 binaries for you to try out.

If you don’t know any much about ARM ABIs then you are not alone.

There is a big table in the README for the cpp-ethereum-cross repo which has details on which of these releases you will need for a very broad range of ARM devices.   If you’re still having issues getting it going, please tweet to @doublethink_co, or raise a GitHub issue and we’ll try to get you unstuck.

 

ARMv7, hard-float crosseth-armhf-apt-v1.2.2
ARMv7, soft-float crosseth-armel-apt-v1.2.2
ARMv5, hard-float crosseth-armhf-v1.2.2
ARMv5, soft-float crosseth-armel-v1.2.2

Just unzip the content onto your device and do something like the following (dependent on your actual unzip directory):

export LD_LIBRARY_PATH=~/eth/lib
~/eth/bin/eth

We aim to produce matching cross-builds for every official cpp-ethereum release moving forward.

We have BlockGrantX funding!

I am delighted to report that we have emerged victorious in our application for BlockGrantX #2 from Wanxiang Blockchain Labs with our “Ethereum for Resource Constrained Devices”.

This means that our ongoing work on C++ cross-builds and subsequent and long-planned C++ Light Client work will be funded.   Hurrah 🙂

Thank you, Wanxiang Blockchain Labs, for your generous contribution to the eco-system!

 

Wanxiang

An extract from the funding application

“Bringing Ethereum to the resource-constrained devices which are likely to dominate Edge Computing in the coming era of IoT”

We have seen prototypes in this area from Project ADEPT and Slock.it, but they have all been running full nodes on devices which are near-desktop capability in terms of CPU, storage and network specifications. I want to build the real thing – starting with the Gear S2 smartwatch as a flagship device.

The approach is to cross-compile the C++ client, minimize its dependencies and footprint, and then to add support for the LES light client protocol.

The project has been ongoing since July 2015 … We hit our first major milestone in late November – with working cross-builds for a large variety of devices.

A tale of two ABIs

Want to know anything about ARM ABIs?   Neither did I, but in the process of trying to get these cross-compiled Eth binaries working across a wide-range of mobile, wearable and SBC devices I have learnt more than I ever wanted to know.    I did it for you.   And for the children.

o-HEAD-HURTING-facebook

And it isn’t over!   No sir, it is not.   I still haven’t actually got it working on my flagship target device, the Samsung Gear S2 smartwatch.   Because the S2 ships with GCC 4.6 runtime libraries.   From GCC 4.6.1.  Which was released in June 2011.   Of course it does.   So I will have to go down another rabbit-hole there, of building GCC against a non-default sysroot.

So, what are these “two ABIs”?   They are the armel and armhf calling conventions, which can respectively be boiled down to “software floating-point” and “hardware floating-point”.   Those form the two “kingdoms” of ARM, with armel dying, but not dead, with older hardware, Android 32-bit and Tizen still clinging onto the carcass.    Oh, and there is ARMv6 for the first generation of Raspberry Pi, where everything else in the universe is ARMv7.

You don’t want to hear anymore about this nonsense, and I don’t want to write anymore, but here is a handy table which contains my very hard-won knowledge of “what is what” for our main target platforms, and for the existing binaries which we are generating.    Click on the image for a readable version!

abi-table-small

There are new binaries available for all four build variants at our Github repo.

Happy New Year!    Here is the Happy Hat to cheer us into 2016.

HappyHat

Github documentation blitz

github-logo

I’ve spent a fair amount of time this week getting the Github documentation for webthree-umbrella-cross into a state which might actually be useful for other people.   Please do check it out 🙂

There are even some pre-releases available for download:

There is a very large test matrix of platforms we still need to get working and various other TODOs, but we’re certainly getting close to a complete end-to-end solution.

This week has also seen my first Ethereum commits, with the automated dependency graph being the largest so far.   Getting that graph generation correct was a large chunk of my work week, but I am very happy with the result.

I am off for a week’s vacation tomorrow and will be completely unplugged from the Internet.   Anthony is ramping down on the project now, but still has some work on his plate for the coming week.

When I return from vacation, I’ll keep working through the Open Issues, which include cloning the ETHDEV C++ team’s Jenkins instance, and adding automation to the same level for cross-builds, and bringing up my home mobile/wearable test farm.

20151120_083926

First working Ethereum C++ cross-builds

TL;DR

Ethereum C++ cross-builds were birthed into the world on Saturday 28th November 2015.   This is a really important milestone, because it opens the door to near-universal portability of Ethereum.

PiZero

A cross-built eth running on a Raspberry Pi Zero, courtesy of Martin Brook

As George was kind enough to say recently:

The work that @doublethink_co are doing on Ethereum is important and you should check it out! – George Hallam

George

I have time to read more details …

The Light Client (LES) sub-protocol is still being refined.   When we have working LES implementations the flood-gates will really open on the range of devices which can run Ethereum nodes.

Getting to Light Client on mobile/wearable is the ultimate goal of all the work which doublethinkco is doing, with the Samsung Gear S2 smartwatch as the flagship target device.

Zsolt Felfoldi gave a very interesting presentation on his Light Client progress at the recent devcon1 conference.   The YouTube video of his presentation is unavailable at the moment, but will likely be available again in an edited form soon.

LightClientDevcon

To my knowledge there is no C++ implementation of LES underway yet.  That was an intentional decision.  No doubt the C++ implementation will get underway as soon as the details of the sub-protocol are settled, and the go implementation has been given a decent workout.

Bob Summerwill and Anthony Cros have been working on Ethereum C++ cross builds since September, after the ETHDEV team came to the conclusion that the work-in-progress on Light Client needed to be rebooted as a sub-protocol, rather than as extensions to the existing ETH protocol.

That change of plan left us with no real way to contribute directly to Light Client development. We needed to get ourselves out of the way while that design work was brewing and to do something else which was useful and would help the ultimate end-goal.

So we took a detour, and focused on porting the existing C++ client code to as many mobile and wearable devices as we could, with a primary focus on Linux over Android and iOS.

02 hotel porter_std

Having the existing full client available in as many places as possible means that we can just “turn on” Light Client on numerous devices as-and-when the C++ implementation of the new sub-protocol is available.

Perhaps we can even help with that Light Client work directly ourselves?

That was our original intention, but we were just too early for that to be practical.   Maybe it makes sense now?

Our detour has gone very much as we expected. That earlier article also talks about what cross-builds are and why they are important.

We realized quite early that our needs were massively aligned with John Gerryts (EthEmbedded), who needed to cross-builds for the final phase of his Devgrant for embedded devices.   So we’ve been working closely together most of the time, and especially in the last week or so, as we have had binaries to share.

Martin Brook has just joined the party too.  He’s one of the main Sailfish OS porters, and his input and testing has been very useful.

Martin

So why is the C++ client so important?

We’ve been working with both the go and C++ development teams, but because of Péter Szilágyi‘s excellent work with xgo, there has been close to no need for us to do any work there.

peter

Why not just leave things to the go team?

It’s because C/C++ is the foundation of all systems programming and performance critical applications, and it has been that way since the very first UNIX releases, and will likely be that way for many years to come. C/C++ is always the first language on any new platform so code written in C/C++ has universal reach, all the way down to the very smallest of devices.

We are finally starting to get some innovation and competition in the systems programming space with go and rust, but it is exceedingly unlikely that those languages will ever make a significant dent in the wearable, embedded and IoT space.

With the renaissance of Modern C++, it is possible to write C++ which is maintainable and understandable as long as you are disciplined and stick to best practices.   It isn’t easy, and elements of C++ like the pre-processor, compilation model, lack of cross-platform build system and lack of cross-platform packaging system make C++ “not fun” to work with.  Bob has been doing it for nearly 20 years though.  Not a problem.

Doesn’t Moore’s Law mean that this kind of “close to the metal” performance doesn’t matter anymore?

Nope, because we’re running into Amdahl’s Law, which essentially states that the potential speedups for a given application are ultimately limited by the work which can only happen in a serial manner.   Having 16 or 32 cores doesn’t help if your application isn’t of a type which can benefit from massive parallelism.

In addition, raw performance is going to be critical for the resource-constrained devices which are going to be spawning in their billions in the next few years with the growth of IoT and smart devices.

 

Why the focus on mobile Linux, not Android?

Isn’t Android an open source platform, and shouldn’t that be the primary focus?

Android is really not as open as Google would like you to think (excellent article on that a few years back), and Google are obviously a nefarious data-farming corporation in general.   Replicant are trying to “free” Android, but it’s a losing battle.   All mobile devices have serious privacy and security issues.

Everybody already knows about Apple’s control-freak nature.  Ethereum may or may not ever be allowed into the App Store.   They have got form.  Don’t be surprised if they ban iOS and watchOS applications which use Ethereum.  It is a mortal threat to their monopolistic control of all commerce and applications on THEIR platform.   We’ll port to iOS and watchOS, but it might never be shippable.

Anyway, to get to the point, we’re nearly done. We’ve got our first running C++ code-compiled builds working now, and will extend that across the rest of the test matrix in the coming days and weeks (months? I hope not!)

So what have you built?

Dockerfiles which let you cross-build ARM binaries which are already known to be working on Raspberry Pi 2, Raspberry Pi Zero, Odroid XU3 and Wandboard Quad. We are working towards working binaries for a very significant range of devices.

docker

Everything is there for whoever wants to use it the
doublethinkco/cpp-ethereum-cross repo on Github, which includes the full test matrix in the README.

What is left to do?

“Just work”, namely …

… then Bob will get automated builds and automated testing running on the mobile/wearable home test farm he has been building.

20151120_083926

Following the go team’s lead, we are likely to start publishing cross-build binaries too, as soon as they are in a stable enough state for that to be worthwhile. It would be very useful to have matching cross-build binaries for the forthcoming eth-1.2.0 release, for example.

If you have further mobile/wearable/embedded devices which you think need some Ethereum love, please tweet us and we’ll see what we can do!

Bob Summerwill, 30th November 2015