02 EthereumDevkit Environment Overview

Learn Ethereum by Examples Part 1 Hello Ethereum world
9 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
This is a free item
$0.00
د.إ0.00
Kz0.00
ARS$0.00
A$0.00
৳0.00
Лв0.00
Bs0.00
B$0.00
P0.00
CA$0.00
CHF 0.00
CLP$0.00
CN¥0.00
COP$0.00
₡0.00
Kč0.00
DKK kr0.00
RD$0.00
DA0.00
E£0.00
ብር0.00
€0.00
FJ$0.00
£0.00
Q0.00
GY$0.00
HK$0.00
L0.00
Ft0.00
₪0.00
₹0.00
ISK kr0.00
¥0.00
KSh0.00
₩0.00
DH0.00
L0.00
ден0.00
MOP$0.00
MX$0.00
RM0.00
N$0.00
₦0.00
C$0.00
NOK kr0.00
रु0.00
NZ$0.00
S/0.00
K0.00
₱0.00
₨0.00
zł0.00
₲0.00
L0.00
QR0.00
SAR0.00
SEK kr0.00
S$0.00
฿0.00
₺0.00
$U0.00
R0.00
ZK0.00
Already have an account? Log In

Transcript

Okay, so in our previous session, we created the VM and we got it connected. Now, here in this session, we will talk about the environment. So this virtual machine based on a boon to is having three things installed on it. One is the Visual Studio. You can see, this Visual Studio will help you develop the application as well as view the demo of the code for the demo. Next thing we have is something called as truffle.

Truffle is a JavaScript based framework on top of aetherium, solidity. So instead of you doing the development in solidity is not really where you need to learn the language. If you are comfortable with JavaScript, you can utilize this framework. Okay, so we have truffle installed on the virtual machine. And then to test the entire code, we have the test RPC. Test RPC is another framework.

You can see a module based on JavaScript. Test RPC helps you simulate the Ethereum blockchain. So as you guys might be aware that it cerium is a blockchain where you can run certain application based on the solidity language, right? And you can do certain types of transactions Okay, using that programming language right? So the whole blockchain is like a computer, distributed computer to your execute certain business logic on top of it, right. So the test RPC for what you simulation of Ethereum blockchain, wherein we can deploy and test our tedium, coke.

And the third thing we have over here is the sample demo. So on the desktop, you see, we have the tyrian folder with the material folder, you will have another folder for demos and within that you will have various tables. Okay. So these are the things which are installed on the virtual machine. Okay, now, so let's see the code first. Okay, so we want to look into the code and see how the code is organized.

So we will have one day work on here. Hello, world demo. So this is sort of a Hello World illustration of what aetherium is, what it can do and how that whole blockchain application can be deployed on and we can, you know, various ways we can do the transaction right? So in this HelloWorld application, what we have is we have some contracts. So in aetherium, we need to create contracts where we have the transaction logic built on top of it, okay? And then there are other folders which are specific to truffle framework, right?

So the framework uses this for its own internal deployment and other purposes. Okay? So what we can do is we can open this whole code base in our Visual Studio, okay, so what I'm going to do is I'm going to copy this location, open a terminal over here. And the command for Visual Studio code is Cod, okay? But before I need to CD to this location, I would you need to slash slash go Stop. And here, I just need to say code and the current directory to enter.

It will open the Visual Studio code on the Explorer. You will see hello world demo. It's part on that. Let's go to the contract. Okay, right here. These are the three solidity files, you can see dot sword.

Okay, that's the extension for solidity file. So let's start with this meta coin mate of mine basically, is, you know, declaring a contract, just like your object oriented programming, you need to have a class and then you can create instances of class. So say we are here a material we need to create a contract okay. So metaphor is kind of a contract and you can see this is the constructor function of this class and what is happening over here is we are assigning things 10,000 as a value to TX dot origin okay not here you know we are not going to get into too much technical details about what the code is all you need to understand is this meta coin basically represent a coin or they just like Bitcoin we have so as your this as a coin okay and the balances for this is stored over here okay.

And here what we are doing is we are assigning a 10,000 value, okay, two balances okay and this value will be assigned only In the constructor, so, what it means is whenever we are going to create an instance of this client that particular instance is going to have 10,000 Okay. So that account so, in materials term that account is going to have 10,000 as a balance then we have this function called send coin what it does is it accept two addresses So, here you can see there is this address okay which we initialize it to balances right. So, it will accept receiver and it will accept the amount and then it will return the balance okay. So, all it is doing is if the balance of the sender is less than the amount then it will return false okay. else it will return true okay and then it will deduct that amount from the sender and assign it to the receiver okay.

So, basically same coin operation will deduct some amount from the sender's address and add it to the receivers address and then we have the good balance function. So, this will return the balance in aetherium and only the function will return the actual value of the balance okay. So at this point all you need to understand is here we just have one coin where in 10,000 is assigned to the balances, it has a function to send some value to another address and a couple of functions to get the balance okay and then it utilizes other contracts Okay, which we are not going to get into details. Okay, so this is Main logic about this particular contract. Next thing you need to understand is this truffle.js. If I open this, you will see in this unit to provide the configuration details of your aetherium.

Network. Okay, the blockchain where this contract will be deployed. In our case, since we are going to utilize the test RPC. I provided the test RPC details. So by default test RPC runs at this particular port on our localhost. Currently test RPC is not started.

When we start with you will see that it starts on this port. Next thing you need to understand is this migration. So here we have the migration plan, which basically truffle uses to deploy your contracts on the virtual machine. Okay, so this is the overview of the virtual machine and the code we have on the virtual machine.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.