Exploring Ethereum with Raspberry Pi – Part 1: Getting Commenced

Installing and running an Ethereum blockchain client on a Pi Three Prototype B.

Blockchain is an exceptionally hot topic right now and has bot for some time, due ter no petite part to the wealth that cryptocurrencies &mdash, mostly notably Bitcoin &mdash, have seemingly generated overnight for their early adopters, together also with the fresh economic possibilities that they open up.

However, blockchain can be used for much more than cryptocurrencies and spil Greig noted te his latest postbode, its distributed nature and capability to verify transactions for tamper-proof records, lends it to use ter IoT applications. What is titillating about the Ethereum toneel is that it goes beyond simply cryptocurrency and securing transactions, to providing a distributed computing podium.

Te this postbode wij&rsquo,ll take a quick look at the Ethereum architecture and attempt to voorkant some of the main concepts and components, before proceeding to install client software on a Raspberry Pi. Just to be clear: wij won&rsquo,t be mining any cryptocurrency, since you truly need a powerful GPU for this, but a Pi can be used to create a elementary sandbox for experimentation &mdash, and this also demonstrates that it is indeed possible to deploy blockchain technology with embedded platforms.

Ethereum 101

A n example Ethereum clever contract. Source: ethereum.org.

A blockchain is a distributed ledger that is typically managed via a peer-to-peer network and permanently growing te size spil more records, or blocks, are successively added to it. Blocks usually contain a timestamp along with transaction gegevens, and are cryptographically secured via hashing algorithms, such that once gegevens is committed it cannot be modified &mdash, it is immutable.

The Ethereum podium has its own cryptocurrency, called ether, but it also builds further on blockchain technology to create a decentralised verhoging for brainy contracts &mdash, objects which contain code functions and that live on the blockchain, and are able to interact with other contracts, make decisions, store gegevens, and send ether to others.

Brainy contracts are implemented ter a language called Solidity, which is based on JavaScript. The Solidity compiler is used to compile brainy contracts to bytecode &mdash, just spil is done with JavaScript or e.g. Python, Java and Android etc. code prior to execution &mdash, which is then executed via the Ethereum Virtual Machine (EVM). There is a cost associated with executing the transactions ter a wise contract and this is something that wij&rsquo,ll take a look at ter a future postbode.

There are a number of different client applications available for Ethereum, with the original reference implementation, geth, written ter Go. Some of thesis can mine ether and there is standalone mining software also. Plus GUI clients and an IDE for distributed applications.

Ter addition to the primary, public Ethereum blockchain network, mainnet, there are also test networks for experimentation, and you can create your own private networks, too.

Installing geth

Assuming wij have already installed Raspbian, if wij commence by updating the installed packaged software to the latest versions.

I ran out of memory the very first time I attempted to compile the Ethereum client and a good way of freeing up RAM for memory intensive tasks, is to reduce the amount allocated to the GPU. Also, if you don&rsquo,t actually need a graphical desktop, configure your system to simply boot to the instruction line.

Next if wij install the packaged dependencies.

Following which if wij grab the sources for geth, the official Go language implementation of an Ethereum knot, compile thesis and copy the executable to /usr/local/bin/.

Create an account and test

Very first if wij use geth to create a fresh account.

This will generate a fresh set of cryptographic keys and protect the private key with a password. Note that if you were using this account to mine cryptocurrency and meaningfully transact, you would want to make sure to backup your keys and to prevent your private key from being accessed.

Now on to beginning the knot.

If wij ran geth without any arguments, it would begin up a knot and attempt to sync the entire public mainnet blockchain. Which, at >,50GB te size and permanently growing, might not be a fine idea on an embedded rekentuig. So instead wij commence the knot te light synchronisation mode. This only fetches block headers spil they show up and other parts of the blockchain on-demand.

To force the knot to uitgang simply press CTRL-C. To run it spil a service at boot time:

(substitute “vi” with your favourite text editor)

Save the opstopping. Following which to have the Ethereum knot run spil the &ldquo,pi&rdquo, user:

With our Ethereum knot running spil a service wij can now link to it using:

This gives us an interactive JavaScript console. From here wij can call functions, such spil:

Which will list the current accounts.

Or to get information about the connected peers:

Note that the light client protocol is still ter development, somewhat experimental and does rely on utter peers/knots enabling support for it . Spil such, it may not be entirely practical at the time of writing to transact on the Ethereum mainnet blockchain using this. That said, things are moving swift and this situation could lightly switch ter the not too distant future.

Coming up

So far wij&rsquo,ve just installed the client software, created an account, began up a knot and observed a peer connection. Te the next postbode, wij&rsquo,ll take a look at actually executing transactions.

Open source (hardware and software!) advocate, Treasurer and Director of the Free and Open Source Silicon Foundation, organiser of Wuthering Bytes technology festival and founder of the Open Source Hardware User Group.

Related movie: BITCOIN CRASH COMING 2018?

Leave a Reply