Hi guys, welcome to the first episode of
Eat The Blocks. Today we are going to set up our development environment for
developing Ethereum smart contract so before we go any further I'd like you to
make sure that you already have nodejs installed and if possible it'll be
better if you have installed the latest version which is at the time of this
recording is 8.9 . Oh and by the way this version is LTS which means Long
Time Support which mean that it's stable and good to use for production so if you
want to make sure that you won't have any problem with the next tutorials you
can just install this version or upgrade your current version to this version.
Next we need a programming language to compile our smart contract into bytecode
that the Ethereum virtual machine can understand.
There are different options
but by far the most popular is a programming language called solidity.
Solidity has a main implementation written in C++ but for our convenience
it's also embedded in different programming language including
going to jump to a console here okay and we're going to install the Solidity
compiler for nodejs so type npm install -g and then solc which is just
the name of the NPM package for the Solidity compiler. So I've already
installed it on my computer so you're not going to see anything spectacular. So
wait a bit… so one important thing to note here is that I specify to use the
global flag so that you can use the Solidity
compiler for different projects and you won't need to reinstall it for each
But if you want you can just install it locally. So to check that the
installation worked you just need to type solc I think is that js and I
just press ENTER and see what it does say wait a bit.. "Must provide a file" ok it
works so it means that I have it installed. So if you see something like
"this command cannot be found" it means that there is a problem with your
install and you need to figure that out.
Okay so now we've installed the Solidity
compiler so another thing we can do is set up syntax highlighting in your text
editor. So for the example I'm going to use Visual Studio code which is a modern
So..so first I'm going to click on the extension menu then I'm going to search
for the Solidity extension… okay so that's the first one.
So I've already installed it on my computer but if you haven't you will see
this green button here, install, so you just click it and it's going to install it
and after there will be another button which is reload and after you reload it
your text editor then you're going to enable the extension. So now that its
installed let's test it on a Solidity contract So I go here into file explorer
and click on this contract.
Lets enlarge this a little bit. Ok and so we can see
that my text editor recognized the syntax of Solidity so it worked yeah
and we also have some some…some suggestion here yeah okay it works. So
if you have other text editors such as Sublime text or Vim you can also find
some extension for Solidity syntax highlighting. Next you need an Ethereum
client to be able to communicate with the network so with Ethereum you have
many different options there are implementations in many different
languages. The main implementation is written in Go
the second most used one is written in Rust and they are also implementation
choose to connect either to the mainnet, which is the production network or you
can choose to connect to the testnet, which is as its name imply, a network
used for testing and for developing.
However I found that there is something
even better than actually a lot of people don't know. It's a sort of a blockchain
simulator written with nodejs, that mimic perfectly all the features of a normal Ethereum client. But it doesn't actually connect to a testnet. It just run a
blockchain in memory and when you launch the network it creates some test accounts
that you control and when you, mmm, when you stop the process then everything is
forgotten, and you can just restart the blockchain as many times as you
want so that's really the option that offer the most flexibility and I really
recommend to use this for your development.
For our tutorial on Eat The
Blocks it's what we're going to use. So let's jump to the console and install it.
There is an NPM package for it so npm install again we set the global ethereumjs-testrpc okay let's wait a bit. Again
I've already installed it before so it's just going to tell me that I already
have it but for you it's going probably going to take a bit more time and once
it has installed then we again going to check that it's working well. So if you
want to check that it's working well then this time the command-line is not
reading intuitive it's called testrpc so testrpc enter.
Okay cool it works so here we can see that it created some accounts for me here.
So I will be able to use all those accounts for my development and below we
can see that it also give me all the private keys.
So means that I control
those accounts yeah. And it's listening on localhost port 8545. Okay that's cool.
Great we have everything we need. First we have the Solidity compiler and
then we have an Ethereum testnet client. Both of them are NPM global
package so you can use them easily across different projects. So for our next
project we're going to create our obligatory HelloWorld smart contract. So
stay tuned if you want to learn about this. If you like this channel, please
subscribe. Thank you see you for the next episode. Bye bye!.