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.
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
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.
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.
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.
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.
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.
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.
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