Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,180 --> 00:00:05,070
In his lecture, I gave you some additional information about the Ethereum blockchain and design will
2
00:00:05,070 --> 00:00:07,170
continue its own practical stuff.
3
00:00:07,710 --> 00:00:10,740
So what about to create a smart contract?
4
00:00:11,640 --> 00:00:12,150
OK, let's do it.
5
00:00:12,150 --> 00:00:13,320
Let's go to our browsers.
6
00:00:14,300 --> 00:00:22,130
And the president will create a smart contract in a remix IED, so let's open it up and let Sergio for
7
00:00:22,130 --> 00:00:28,040
a remix ethereal remix if he so remix is.
8
00:00:30,260 --> 00:00:32,600
Interactive a development environment.
9
00:00:32,750 --> 00:00:33,230
All right.
10
00:00:33,470 --> 00:00:34,880
And you can access it here.
11
00:00:35,180 --> 00:00:38,090
Remix dot Etherium dot org.
12
00:00:38,840 --> 00:00:39,650
Let's access it.
13
00:00:40,880 --> 00:00:44,960
And with the right mix, if they can do powerful stuff, we can kill a smart contract, we can deploy
14
00:00:44,960 --> 00:00:46,670
them also to Maine, that's to the test.
15
00:00:46,670 --> 00:00:50,540
That's and we can test the smart contracts we can.
16
00:00:51,050 --> 00:00:55,400
And also we can deploy, as I mentioned, we can also create a smart contract and deploy today to the
17
00:00:55,400 --> 00:01:00,050
Maine, but we'll be using it mainly for testing purposes to show you some basic stuff.
18
00:01:01,250 --> 00:01:05,710
OK, so there's that remix I.D. and we'll go.
19
00:01:05,720 --> 00:01:07,580
You shall have the air of some folders on the left side.
20
00:01:07,590 --> 00:01:10,280
I hope it's visible and they can zoom within, I guess.
21
00:01:11,460 --> 00:01:14,520
All right, so on the left hand side, you have a you there.
22
00:01:14,700 --> 00:01:17,630
What we are interested in is only contracts folder.
23
00:01:17,640 --> 00:01:23,610
I was going to create any contractual decorating contracts later in our coding editor and now they can
24
00:01:23,700 --> 00:01:28,050
because here is some contact that are already created here for us.
25
00:01:28,230 --> 00:01:32,310
In some cases, something has to change and you don't see how these contracts don't don't worry, you
26
00:01:32,310 --> 00:01:33,930
don't need to do actually anything here.
27
00:01:34,140 --> 00:01:39,810
You don't see this contract because of what my screen and see what I will be doing later will be coding
28
00:01:39,810 --> 00:01:40,290
the contract.
29
00:01:40,290 --> 00:01:41,520
You are coding ed.
30
00:01:42,480 --> 00:01:48,180
OK, so this is here a very simple smart contract called cloud storage.
31
00:01:48,840 --> 00:01:55,500
OK, so as some maybe some similarity with JavaScript or also other programming languages here are getting
32
00:01:55,500 --> 00:01:56,520
usually classes right.
33
00:01:56,730 --> 00:01:58,860
And in a smart contract, you are creating contracts.
34
00:01:59,160 --> 00:02:02,340
OK, so that your main JavaScript, you would see maybe something like this class storage.
35
00:02:02,400 --> 00:02:04,380
Here you see that contract storage.
36
00:02:05,460 --> 00:02:09,720
Here you see the structure called into 256.
37
00:02:09,720 --> 00:02:16,410
This means unsigned integer 256, which is the integer of two hundred fifty of bits length.
38
00:02:17,250 --> 00:02:18,260
OK, that's a number.
39
00:02:18,270 --> 00:02:19,410
So we'll be starting some number here.
40
00:02:19,410 --> 00:02:20,370
You have here two functions.
41
00:02:20,630 --> 00:02:22,760
You don't need to know any details about them.
42
00:02:22,770 --> 00:02:24,760
You just need to know that their functions.
43
00:02:24,780 --> 00:02:27,120
One function is to starring in numbers.
44
00:02:27,150 --> 00:02:30,000
You are showing the number there is getting into the number here.
45
00:02:30,000 --> 00:02:34,130
On the storage level, function is used for retrieving this number from here.
46
00:02:34,140 --> 00:02:35,190
So very, very, very simple.
47
00:02:35,190 --> 00:02:40,680
Smart contract, just just serving us just as simple storage of numbers and doesn't have any really
48
00:02:41,280 --> 00:02:43,020
very practical usage.
49
00:02:43,170 --> 00:02:48,090
You know, big, big, big scales, but it's very good for it, for testing and just to show you some
50
00:02:48,480 --> 00:02:49,080
basics.
51
00:02:50,680 --> 00:02:55,420
All right, so that's not a smart contract, but 21 to interact with a small smart contract they any
52
00:02:55,420 --> 00:02:58,280
to deployed to the network.
53
00:02:58,280 --> 00:02:59,410
OK, but how can we do it?
54
00:03:00,070 --> 00:03:03,370
Actually, first thing we need to compile it, we need to compete in the bytecode.
55
00:03:03,370 --> 00:03:07,270
As I was mentioning, we need to create a better representation of the smart contract.
56
00:03:07,280 --> 00:03:12,160
So if we get a smart contract to, we need to transform it into bytecode.
57
00:03:12,490 --> 00:03:14,110
Also, the bytecode in much detail.
58
00:03:14,110 --> 00:03:15,970
So we're talking in the Olander lecture.
59
00:03:17,170 --> 00:03:19,750
OK, so compile this smart contract.
60
00:03:20,880 --> 00:03:24,980
I think we can explain it here on the left hand side, and also I didn't tell you here this program
61
00:03:25,380 --> 00:03:29,190
is just specifying a version of the compiler for this so solidly to file.
62
00:03:29,820 --> 00:03:36,600
OK, so it has to be larger than zero point seven zero and smaller than zero point nine zero.
63
00:03:36,630 --> 00:03:37,410
The compiler?
64
00:03:38,360 --> 00:03:43,550
OK, so now let's go to the left hand side here, too, that is solidly decompile that are here.
65
00:03:43,880 --> 00:03:46,790
They are specified in a version of the compiler we have here multiple versions.
66
00:03:47,120 --> 00:03:50,270
I'm going to go with the zero point eight point four version.
67
00:03:50,300 --> 00:03:51,980
You can also click at the same Brigida.
68
00:03:52,760 --> 00:03:54,940
And what we'll do is we'll compile storage.
69
00:03:54,950 --> 00:03:58,010
Dot solemn gave going to change your anything.
70
00:03:58,010 --> 00:03:58,880
Language will stay.
71
00:03:58,880 --> 00:04:01,070
Same EMV variant will stay the same.
72
00:04:01,580 --> 00:04:02,600
It's a composite file.
73
00:04:02,610 --> 00:04:07,800
The ADF will also what's what's very important about the bill be we'll handle it later.
74
00:04:07,830 --> 00:04:09,380
I'll be talking about that even later.
75
00:04:10,100 --> 00:04:17,660
OK, so let's compile this storage dot sol into bytecode essence and click Compile Storage.
76
00:04:17,899 --> 00:04:19,120
Actually, I got here earlier.
77
00:04:19,130 --> 00:04:26,570
I was expecting to see here a result of this compilation process located here, but no worries our contacts
78
00:04:26,570 --> 00:04:27,500
will be complete anyway.
79
00:04:27,500 --> 00:04:29,450
You can see here this a green checkmark.
80
00:04:29,450 --> 00:04:31,880
Everything went good, so that's that's actually all right.
81
00:04:32,840 --> 00:04:37,610
OK, so code was compiled and we can see here compilation details just yet.
82
00:04:37,640 --> 00:04:41,780
If you don't say much to you right now, but I want to show you that a quick compilation details you
83
00:04:41,780 --> 00:04:48,680
can see the bytecode of your code, and here is the the code, which will be deployed to Etherium blockchain,
84
00:04:48,680 --> 00:04:49,380
basically.
85
00:04:49,430 --> 00:04:56,680
OK, so you can see the sequence of hexadecimal the hexadecimal characters, and that's it.
86
00:04:56,900 --> 00:04:59,110
That's the code you see here.
87
00:04:59,120 --> 00:05:06,930
The storage in this, a high level of programming language compiled into this is bottom line.
88
00:05:06,960 --> 00:05:08,880
The bottom level, this a base level.
89
00:05:09,350 --> 00:05:16,400
OK, so into bytes, into segments of the bytes in each bytes that you can reference as the up code
90
00:05:16,400 --> 00:05:18,530
or operation code mean something else?
91
00:05:19,010 --> 00:05:23,210
But how about this, like our guys, I just want to show you that this called what you see.
92
00:05:23,210 --> 00:05:30,610
It's compiled into this up code six zero eight zero six zero four four zero and so on.
93
00:05:30,620 --> 00:05:33,020
This will be deployed to ethereal.
94
00:05:33,950 --> 00:05:35,620
OK, now we want to deploy the smart contracts.
95
00:05:35,630 --> 00:05:41,030
When you want to deploy the whole goal here onto this menu here or deploy and run transactions as the
96
00:05:41,030 --> 00:05:43,510
environment people choose their JavaScript or machine.
97
00:05:43,520 --> 00:05:48,740
So this means this smart contract, there'll be no there are deployed into any any blockchain to any
98
00:05:48,740 --> 00:05:52,190
network, but it'll be around here locally in the JavaScript.
99
00:05:52,310 --> 00:05:53,990
So there will be some kind of simulation.
100
00:05:53,990 --> 00:05:56,600
It also accounts created for us.
101
00:05:56,600 --> 00:06:01,880
We have a couple of times we can we can use and each account has 100 Ether.
102
00:06:02,510 --> 00:06:02,990
All right.
103
00:06:02,990 --> 00:06:07,270
And then we have some guys limit about gas limits and we'll be talking a lot there because that's for
104
00:06:07,310 --> 00:06:11,780
a separate lecture to what I can tell you now, because Limits serves as their way to pay for their
105
00:06:11,790 --> 00:06:16,070
transactions because in Ethereum network going to pay for that transaction.
106
00:06:16,070 --> 00:06:20,030
So then you want to create a transaction or you want to deploy smart contracts only to pay for it,
107
00:06:20,300 --> 00:06:23,900
and you are using this gas units here for it.
108
00:06:24,020 --> 00:06:28,070
But about this, OK, I'm saying all those later, but you need to be patient.
109
00:06:28,190 --> 00:06:29,020
You need to get through that.
110
00:06:29,060 --> 00:06:29,810
All of the lectures.
111
00:06:30,860 --> 00:06:35,450
OK, so then we are happy with the settings, which are the default settings should be completely fine.
112
00:06:35,450 --> 00:06:38,420
We can click here, deploy and it will be deployed to the network.
113
00:06:39,500 --> 00:06:41,690
Of course, everything went fine because it was a simulation.
114
00:06:41,690 --> 00:06:45,050
And but you can see here when you click on the right side that the transaction has to be made.
115
00:06:45,920 --> 00:06:48,890
OK, so you can see it through transaction amount and execution success.
116
00:06:48,950 --> 00:06:50,510
Here you have a transaction hash.
117
00:06:50,930 --> 00:06:52,250
What does it mean also?
118
00:06:52,280 --> 00:06:58,610
Well, actually that are very important part of the of the of the crypto network so that these will
119
00:06:58,610 --> 00:06:59,660
handle in a separate lecture.
120
00:07:00,320 --> 00:07:04,310
What's important here is that the transaction was made from this account you can sit here from and that's
121
00:07:04,310 --> 00:07:05,270
the account here.
122
00:07:05,900 --> 00:07:10,910
This is 0x five the traders account the transaction has been made from and you can see we have paid
123
00:07:10,910 --> 00:07:15,900
for a transaction because we don't have any longer at 134, but we have ninety nine point ninety nine
124
00:07:15,910 --> 00:07:16,800
point ninety nine.
125
00:07:16,850 --> 00:07:17,180
OK.
126
00:07:18,050 --> 00:07:22,640
And there's also gas we have to paid for before and execution costs.
127
00:07:22,730 --> 00:07:27,320
That's not really important, but what's important here is that from and the two and a two here you
128
00:07:27,320 --> 00:07:31,640
can see there is no other us because then you are deploying smart contracts.
129
00:07:32,660 --> 00:07:34,730
The recipient of the of the.
130
00:07:36,080 --> 00:07:40,880
Typekit Alvarez is basically zero other, so this will be not any of this, but this will be zero and
131
00:07:40,880 --> 00:07:49,760
that 32 or 64 zeroes in the case of 64 by the 40 zeros because that addresses to 20 bytes.
132
00:07:50,990 --> 00:07:54,440
OK, so when you are creating smart contract, I can actually drive it here.
133
00:07:54,440 --> 00:07:57,200
When you're creating smart contract Ebola shows here, then your paper?
134
00:07:57,650 --> 00:07:58,070
OK?
135
00:08:00,020 --> 00:08:04,610
So and you're getting smart contract, you're getting transactions, rights are getting transaction
136
00:08:04,610 --> 00:08:11,930
and you need to provide from front is your address from which you are creating transactions from.
137
00:08:11,960 --> 00:08:15,620
So this will be your user, otherwise too many bytes here.
138
00:08:16,460 --> 00:08:17,420
OK, 20 bytes.
139
00:08:18,920 --> 00:08:25,250
But too many are deploying smart contract will be empty, others zero and zero zero zero zero zero zero.
140
00:08:25,520 --> 00:08:31,300
And will have a 20 of these characters because we had actually forty of these characters because it's
141
00:08:31,400 --> 00:08:33,409
so small, it's a little bit in total 20 bytes.
142
00:08:34,970 --> 00:08:37,730
OK, so that's how it's basically is.
143
00:08:38,850 --> 00:08:44,340
OK, and the other parameters to talk about right now, what what's important to the contract is they
144
00:08:44,340 --> 00:08:47,100
put another can interact with the contract.
145
00:08:47,760 --> 00:08:51,680
So on the left side, now you can see here, you can see the storage contract.
146
00:08:51,690 --> 00:08:54,300
Now it's residing at this address of a new venue.
147
00:08:54,450 --> 00:08:55,200
That's my contract.
148
00:08:55,230 --> 00:08:58,200
It's the contracts assigned some specific address here.
149
00:08:58,470 --> 00:09:01,920
You can see zero, except the 91 and so on.
150
00:09:01,920 --> 00:09:04,020
That's the contract is residing.
151
00:09:04,530 --> 00:09:07,890
What we can now use here is this two functions store and there are three.
152
00:09:08,490 --> 00:09:10,490
Those are two functions here a store.
153
00:09:11,410 --> 00:09:15,310
And the retreat will start again, so no, I wasn't there to become the editor of the No.
154
00:09:16,220 --> 00:09:19,910
So let's start here, some number, let's click here to have a little more this year.
155
00:09:20,060 --> 00:09:21,530
Clear it out, screen and story here.
156
00:09:21,560 --> 00:09:23,720
Number 10, let's say, and I will click here on Start.
157
00:09:23,730 --> 00:09:24,530
I just click on this.
158
00:09:25,100 --> 00:09:29,600
And as I told you, when you want to interact with the Etherium, what are those changes in a state
159
00:09:29,600 --> 00:09:32,060
you need to send a transaction and transaction has to be mined.
160
00:09:32,330 --> 00:09:34,760
So essence, I will click here to start a new transaction.
161
00:09:34,760 --> 00:09:35,450
It will be sent.
162
00:09:35,900 --> 00:09:40,130
You can see here is transaction through transaction amount and executed on succeed.
163
00:09:40,490 --> 00:09:40,970
OK.
164
00:09:41,360 --> 00:09:43,970
And then, yeah, the execution of a successful.
165
00:09:44,860 --> 00:09:47,080
You have here from that's my account here.
166
00:09:47,680 --> 00:09:52,780
This will be the second I showed you before this account here that's bothered by the people selected
167
00:09:53,050 --> 00:09:59,050
and the thought now actually, this story is that is the address of some of our smart contract, so
168
00:09:59,050 --> 00:10:04,360
it can see zero exit the nine or nine one four.
169
00:10:04,360 --> 00:10:05,560
And that's that others.
170
00:10:05,560 --> 00:10:08,710
Here are those of a smart contract that can sign up left the bottom side.
171
00:10:10,090 --> 00:10:13,120
You have paid some gas for a transaction as a as the input.
172
00:10:13,460 --> 00:10:20,080
Here is this hexadecimal sequence of the bytes your this input is basically the function you want to
173
00:10:20,080 --> 00:10:25,450
execute if you will transfer it, if you will transfer it into Ramallah, no electricity, it would
174
00:10:25,450 --> 00:10:29,130
be this sort of function you want to basically call here or function.
175
00:10:30,160 --> 00:10:31,000
This is input.
176
00:10:32,100 --> 00:10:36,570
OK, and here we can see how that input, that's their value are sending value of 10 and they're calling
177
00:10:36,570 --> 00:10:39,780
sort of function with the standard so that this is start.
178
00:10:41,890 --> 00:10:46,600
OK, so distance is 30, and we can verify with certainty we'll get to the transaction, OK, maybe
179
00:10:46,600 --> 00:10:47,410
we'll get some value.
180
00:10:47,680 --> 00:10:52,610
OK, so let's clear that out, OK, and we can retrieve the value as well.
181
00:10:52,660 --> 00:10:55,450
Let's get retrieve as it looks like he'll retrieve.
182
00:10:55,600 --> 00:10:58,390
You can notice here a very interesting thing here.
183
00:10:58,870 --> 00:11:03,910
Now, I don't see any transaction I can see here something called call.
184
00:11:04,210 --> 00:11:09,580
And you can see no transaction has been mined now, but we have been clicking here star.
185
00:11:09,580 --> 00:11:10,300
We have been storing.
186
00:11:10,300 --> 00:11:11,970
We have been changing Ethereum's state.
187
00:11:11,980 --> 00:11:13,390
We have to create a transaction.
188
00:11:13,750 --> 00:11:16,990
They have to pay for that transaction to do the changes in Ethereum's state.
189
00:11:17,230 --> 00:11:20,580
But in the case of the reprieve, we didn't have to do this.
190
00:11:20,610 --> 00:11:22,360
We just simply got the number 10 back.
191
00:11:22,630 --> 00:11:26,890
You can see here it goes back number 10 here and elsewhere, but I'll get here.
192
00:11:26,890 --> 00:11:27,460
I should get here.
193
00:11:27,490 --> 00:11:31,480
Then, who can see the output below the output of 10 does a thing.
194
00:11:31,480 --> 00:11:36,810
Then you want to do changes in the Imperium network in your theorem, state your networks and the transactions
195
00:11:36,820 --> 00:11:37,710
and it's paid for them.
196
00:11:38,470 --> 00:11:42,880
But when you want to get a data back from Ethereum network, you don't need to pay for them because
197
00:11:42,880 --> 00:11:43,930
they simply they'll get them.
198
00:11:44,680 --> 00:11:48,040
OK, so for a while, you need two transactions for the other one.
199
00:11:48,190 --> 00:11:53,380
It's called usually different as a message call when you are getting some values and usually these functions
200
00:11:53,860 --> 00:11:55,360
that are required to pay for them.
201
00:11:56,230 --> 00:11:58,300
That's not required to create a transaction for them.
202
00:11:58,660 --> 00:12:00,820
They are marked here as the view functions.
203
00:12:01,510 --> 00:12:05,980
View function means that you are not doing any changes to Ethereum's Ethereum's state.
204
00:12:07,860 --> 00:12:12,420
OK, but that was just a basic overview about a smart contract to have a smart contract.
205
00:12:12,450 --> 00:12:16,020
Now it's residing on the Ethereum network, but they want to interact with that contract.
206
00:12:16,290 --> 00:12:19,820
We need to, of course, was deployed and then need to send the transactions to a contract.
207
00:12:19,830 --> 00:12:21,870
I've been to specify what functions we want to call.
208
00:12:22,260 --> 00:12:26,220
In this case, we have been calling a function and we have been sending in the value value.
209
00:12:26,220 --> 00:12:26,550
10.
210
00:12:27,300 --> 00:12:33,270
This story is number 10 to the number assigned to the storage here and with the directory functions
211
00:12:33,380 --> 00:12:36,930
and then they call directory function to be didn't have to send the transaction, but this was the message
212
00:12:36,930 --> 00:12:37,290
call.
213
00:12:37,860 --> 00:12:40,020
Got back the number of back from the storage.
214
00:12:40,800 --> 00:12:44,130
And that's a simple, the simplest example of smart contract.
215
00:12:44,460 --> 00:12:49,200
I think the best way to learn is by creating and buy practical examples of internet like tools that
216
00:12:49,200 --> 00:12:54,210
will initialize our private network in our local computers and will be creating a of smart contracts.
217
00:12:54,480 --> 00:12:56,140
And we will learn a lot about them.
218
00:12:56,170 --> 00:12:59,490
So guys, that's going to be it and see you in the next two years.
21555
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.