Nothing helps understand blockchains better than building one yourself. And that's exactly the goal we set out to achieve, during a 1-day workshop at TechHub Swansea.
"Building A Blockchain Product," presented by Sam Mathias of Empyrean Digital Limited, sought to provide a hands-on, live experience of creating a private blockchain network; transacting and mining on the chain and then running Smart Contracts - all in a days work!
Our master class presenter, Sam, hails from a wealth of experience and interest in understanding blockchains and the most commonly associated, cryptocurrencies. "I was quick to realise the rise of digital currencies, as too the importance of the technology that powers them — blockchains; I believe these are primed to change business as we know it."
With this knowledge in hand, TechHub in association with Empyrean Digital, were well placed to host an exploratory workshop with budding blockchain enthusiasts, from a vast range of professional backgrounds. Here’s the download from Sam, on the day we mined Ethereum!
So, what exactly is a blockchain?
"A blockchain is a decentralised, immutable open ledger of data, authenticated by a number of untrusted nodes across a network," explains Sam.
If you're lost already, don't worry! As with any evolving technology, documentation and explanations can be really confusing, blockchain is no exception to this. Here's a handy infographic that will go further to help visualise this process, explaining the technology -as too its relationship with digital currencies.
So, let’s dive a little deeper into the key concepts and processes. We followed 4 stages in order to create the distributed ledger chain;
Stage 1: Getting started - setting up a development environment Lets recap on our mission: “to create our own blockchain network to be able to run Smart Contracts in an isolated manner, without the associated fees of the main Ethereum network.”
Stage 2: Setting up a private Chain
To be able to run our own network, we needed somewhere to start, this is where our genesis file came in. A genesis file is a description of the network, and has the ability to pre-allocate funds to pre-existing accounts, this in turn creates the first ‘block’ in the ‘blockchain.’ On aligning the group to the identical, initial block, we were able to get our nodes to communicate with each other by adding each nodes unique address as a peer to other nodes.
Stage 3: Transacting and mining on the chain
On completion of steps 1 and 2, the group were in a position to start mining Ethereum on our very own private network - sending variable amounts to each other across the classroom! As we continued to connect our nodes, we were able to start running miners on the network. The outcome: “Performing transactions for the miners to confirm and add to the next block in the chain.”
Stage 4: Running Smart Contracts
Now that we'd grasped the fundamentals of mining and sending transactions, we moved forward to understanding Smart Contracts. These contracts were written in solidity and compiled using the remix online compiler, which provided the code to deploy on the network.
As we started running contracts on our own node, we were able to use the address and ABI (Application Binary Interface - this describes the contract so the node could understand what exists at the address) to run contracts that had been run on other nodes. These ranged from number incrementers, to simple storage of data on the blockchain.
So, we'd achieved our mission and all within a day! Plus we were on our way to making millions. Well not quite! It's worth remembering that we were transacting with 'fake Ether,' which we used to test our functions of the blockchain.
This simplified, snippet of the days activities sets out to show you that the test environment is out there and available to you, should you wish to gain first-hand experience of building a blockchain product. But if it still feels a little overwhelming or you'd like to learn in the company of likeminded individuals, why not join us to hear more at our next event?
Follow us on social media to hear more...