Blockchain stack #1: Installing Ethereum Geth and your very first wise contract

Technologist and Entrepreneur on an venture to see how Blockchain and AI will switch the world!

Published

May 13, 2018

Ian Monk ter Blockchain, Blockchain stack, Ethereum, Wise Contracts, Solidity, Web Three.0 | May 13, 2018

I’m writing a series of posts on the Blockchain Stack, providing plain but fully coded, step by step examples of how each of the factor work both independently and collaboratively. This is the 2nd postbode ter the series (1st: Blockchain stack #0: Distributed stack vs Verlichtingstoestel) and will display you how to install Ethereum, mine some Ether and create your very first contract.

There’s three key things I’d say to beginners about Ethereum out of the blocks:

  1. It’s truly indeed rapid moving. This means a loterijlot of the tutorials you will attempt and go after will not fairly work. A self-help-first attitude will indeed help you knock down those barriers, but given that you are here, you already have that!
  2. There are some amazing people out there providing their time up to help. I’ve bot particularly inspired by people on the gitter.com channels like Chris Hafey. Fairly a few companies have slack channels and there’s usually a loterijlot of help provided on them e.g. Griff Green (Griff Green) on Giveth.
  3. The open and asynchronous nature of Blockchain means that security is a key challenge. This makes things joy and titillating spil it requires an extra layer onto the more typical hacking mindset. Manuel Araoz has some good examples of this.

Use Linux

I think Ethereum and the surplus of the stack is best being run from Linux (I use Ubuntu) because a loterijlot of the examples I see out there are for this set up. This should make it lighter to hunt for solutions and get advice and help. If you haven’t used Linux before, don’t worry, you’ll use the guideline line and only need to know a few guidelines.

It’s free and pretty effortless to setup an Oracle VM using Ubuntu on Windows. When you do it, make sure you allocate at least 150GB of virtual hard drive because the Ethereum knot will take a lotsbestemming of this. Also install the guest additions. If you already have VM installed, you are very likely like mij and didn’t give it enough space so you’ll you need to resize the virtual drive.

All of the examples te this series of posts build on top of each other and embarked with the base Ubuntu 64bit install with Guest Additions.

Installing a Geth knot

There are various client knots that can be used, I went for Geth spil this seems to be one of the most supported and, along with Parity, is recommended by the Ethereum Foundation.

Go after instructions here or just open your linux Terminal and run thesis directions:

Check your install works:

Use Ctrl+C to uitgang.

The Networks

You can run the Geth client on various networks. A quick overview:

Let’s set up Testnet to sync and ter the meantime wij can set up Dev network to work on our very first contract.

Setting up Testnet to sync

Open a fresh terminal:

This will begin Geth up ter quick sync mode and it will embark downloading the Blockchain. It has finished the sync when it has downloaded the latest header. You can check the latest header on the testnet here and then run this directive te the geth console:

Once it has finished downloading to the latest header (about Four hours for mij), wij can commence mining, but wij will come back to that zometeen.

There’s a good article here about the prompt sync mode for Geth.

Setting up and mining ter Dev

So that you can crack on, let’s setup a Dev network.

You’ll see there are no blocks syncing:

That’s it, Dev network is set up :-).

Wij now need to create an account and mine. Wij are going to use Geth’s Javascript Console using the functions defined here. Geth provides a wrapper for Ethereum’s web3 JavaScript Dapp API and the admin API.

Now let’s embark mining!

minethreads : how many CPU cores to use

etherbase : which account to send the Ether too (0 being very first te the list from individual.listAccounts)

You can leave that running and you should commence eyeing Ether being mined.

Voorstelling mij the money!

Leave that terminal running so that you keep mining Ether to use. Open a fresh terminal window. Wij are now going to connect to the client that is running through the miner.

Check how much Ether you have.

Unlock the account so that you can use it to make your very first contract.

At anytime you can zekering the miner and then reconnect to Geth using the console flag. This starts both the knot and the client.

Your very first contract

Ok, now you’re rich, let’s make a contract.

Wij will use the Greeter from Ethereum. There has bot a lotsbestemming of switches and improvements since their tutorial wasgoed created so a number of the steps do not work, hopefully this will get you going fairly painlessly. No doubt that some point ter the future someone will say the same about this one!

Wij will not use the directive line compiler spil it did not work at the time of writing this for the Greeter contract. I think more effort is going into maintaining the Ethereum browser compiler and it’s also got more features — so using that is a win win.

Copy this into the Ethereum browser compiler spil shown here on the left.

Copy the text from the right titled ‘Web3 deploy’ to a text verkeersopstopping (making sure you have word wrap turned off). You need to specify the text to use ter the _greeting variable and Geth didn’t like the “untitled:” additions the editor added. Therefore te the text verkeersopstopping, switch the following lines:

Copy and paste the text opstopping to Geth and run it. Do the same for both the mortal and greeter code. You should see something like this (it can take up to a minute for the ‘mined’ response).

You can now test if your very first contract works:

Anyone else on your Dev network can interact with your contract using this API:

Where ABI is the ‘Interface’ field from the browser compiler and Address is the address of the contract you have just created (greeter.address).

Attempt opening a fresh terminal and doing the following, switching the address ter the at(…) to the address of your contract:

That’s it. You’re done with your very first contract. Congratulations!

Ether on testnet

Before you go, if testnet has finished its sync, why don’t you now go ahead and repeat all of this on that network? You can mine for Ether like wij have done above or you can get it from a faucet provided by the lovely folks at ropsten.be. Don’t leave behind to set yourself up with a fresh account on your testnet (individual.newAccount()).

You can check the transaction, its block details and when it has bot mined on the etherscan webstek. Come in the account number te the search opbergruimte and you should see something like this:

Where to go for help related to part 1

Next te the Blockchain stack series

Ziggify Blockchain

There’s a team of us that have come together at Ziggify to work on a Blockchain play. Wij are te the exploration phase, so if you want to get involved or have an idea please get te touch. I’m based te London and love chewing the Blockchain fat overheen a cuppa or a fecali.

Related movie: Bitcoin Generator – A 2018 Method To Get Free Bitcoins


Leave a Reply

Your email address will not be published. Required fields are marked *