Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,330 --> 00:00:00,770
All right.
2
00:00:00,780 --> 00:00:04,030
Now, you have deployed your first smart contract.
3
00:00:04,050 --> 00:00:06,390
You know what is in the compile tab.
4
00:00:06,390 --> 00:00:10,150
You have the right compiler, which is the same as in the primer line.
5
00:00:10,170 --> 00:00:18,630
If auto compile on and we ran our transaction in the deploy and run transaction tab on the JavaScript
6
00:00:18,630 --> 00:00:19,350
VM.
7
00:00:20,640 --> 00:00:24,240
Now all of this is fine, but we didn't change anything.
8
00:00:24,410 --> 00:00:28,400
We didn't do anything with our smart contract, which is deployed a smart contract.
9
00:00:28,410 --> 00:00:38,580
And in this video I want to go and actually change that string to something we can input as a user after
10
00:00:38,580 --> 00:00:40,080
the Smart contract is deployed, of course.
11
00:00:40,080 --> 00:00:46,440
So I'm going to revert this to Helloworld and we are going to add an additional function over here.
12
00:00:47,010 --> 00:00:48,840
We make this a little bit bigger
13
00:00:51,570 --> 00:00:52,350
function.
14
00:00:52,770 --> 00:00:59,040
Every function starts with a keyword function and then we say, update our string.
15
00:00:59,520 --> 00:01:03,210
This one will get one argument that is another string.
16
00:01:03,210 --> 00:01:06,260
And in this case, it's important to add the memory location.
17
00:01:06,270 --> 00:01:08,760
More on that a little bit later.
18
00:01:08,760 --> 00:01:13,560
And we are having an updated string.
19
00:01:13,560 --> 00:01:20,430
I like to make this underscores there that you maybe have seen and some of the.
20
00:01:22,750 --> 00:01:24,520
Code that is out there.
21
00:01:24,520 --> 00:01:31,780
And the reason for that is if you are interacting with outside JavaScript, then it becomes a distinct
22
00:01:31,780 --> 00:01:38,530
difference between getting writing a variable or reading a variable from solidity to the outside world
23
00:01:38,530 --> 00:01:44,490
with the underscore, then directly inside JavaScript.
24
00:01:44,500 --> 00:01:46,000
That is just my style.
25
00:01:46,840 --> 00:01:52,840
I think there is that there is a style guide for this and I don't think it doesn't mention anything
26
00:01:52,840 --> 00:01:56,980
about underscores or so anyway.
27
00:01:56,980 --> 00:02:05,260
So you can name this variable you have of the type string, it's strictly typed and you even have to
28
00:02:05,260 --> 00:02:12,100
give it a location, which in this case is a memory location, which just means that it is our working
29
00:02:12,100 --> 00:02:19,270
horse cheap memory that this variable resides in.
30
00:02:19,300 --> 00:02:21,850
Now we also have to give it a visibility.
31
00:02:22,120 --> 00:02:26,850
More on that again later on when we are writing the first project.
32
00:02:26,860 --> 00:02:28,650
In this case, it is public.
33
00:02:28,660 --> 00:02:34,180
It is not going to return anything because inside solidity you cannot really return anything to the
34
00:02:34,180 --> 00:02:34,720
outside world.
35
00:02:34,720 --> 00:02:36,130
You need to events for that.
36
00:02:36,580 --> 00:02:41,410
Also, we are going to talk about this more in-depth and then we are ready to update our string.
37
00:02:41,920 --> 00:02:45,100
To update string.
38
00:02:45,850 --> 00:02:46,360
Great.
39
00:02:46,360 --> 00:02:52,930
You see, everything still compiles and when we hit deploy, then we can see.
40
00:02:52,930 --> 00:02:59,140
And here in our instance, we have now two different buttons.
41
00:02:59,140 --> 00:03:04,060
One is for the Helloworld and the other one is to update our string.
42
00:03:04,060 --> 00:03:07,300
That actually requires us an input field.
43
00:03:07,300 --> 00:03:12,220
So if you just hit update, it still does it, and then it will overwrite the string with an empty string.
44
00:03:12,400 --> 00:03:18,100
And if we can also make this a little bit bigger so it's more clear what is going on here.
45
00:03:18,250 --> 00:03:28,090
And then we can just say hello from earth and then hit transect and then our string is updated to hello
46
00:03:28,090 --> 00:03:28,810
from Earth.
47
00:03:29,620 --> 00:03:35,770
Now again, you can see everything here is with a call against a blockchain node.
48
00:03:35,770 --> 00:03:39,310
The blockchain or in this case is the JavaScript environment.
49
00:03:39,310 --> 00:03:40,810
So there is no real blockchain node.
50
00:03:40,810 --> 00:03:47,500
You're directly interacting with your browser here, and you can also see that there is one thing with
51
00:03:47,500 --> 00:03:50,040
a little check mark and the other one with a little call.
52
00:03:50,050 --> 00:03:55,810
That's a major difference between a writing transaction, something that would actually cost you money
53
00:03:55,810 --> 00:03:57,520
to get mined.
54
00:03:57,530 --> 00:03:59,290
It's to be sent to the transaction pool.
55
00:03:59,290 --> 00:04:03,430
Then a miner needs to pick it up and then it gets mined and it gets baked into the blockchain.
56
00:04:03,430 --> 00:04:06,100
And the call I call is a reading transaction.
57
00:04:06,100 --> 00:04:12,640
It is still a transaction, but it's virtually free because it's against your blockchain node.
58
00:04:12,640 --> 00:04:16,630
And every blockchain node that is participating in the network has the same information.
59
00:04:16,630 --> 00:04:22,330
It's basically the whole point of the decentralized part of this decentralized ledger.
60
00:04:22,330 --> 00:04:27,670
So everyone has the same kind of information running on this machine, and in your case, you don't
61
00:04:27,670 --> 00:04:30,460
need to query any other thing.
62
00:04:30,460 --> 00:04:34,990
You basically have a copy of the whole ledger and you can directly look into it, but it's still a transaction,
63
00:04:34,990 --> 00:04:38,170
it's just a free of charge, and that's called a call.
64
00:04:39,040 --> 00:04:43,110
If you open it up, you can see that this is from address.
65
00:04:43,120 --> 00:04:47,650
It goes to a specific address and has an execution cost.
66
00:04:47,650 --> 00:04:49,600
Doesn't really matter because it's a call.
67
00:04:49,600 --> 00:04:55,480
But over here with a transaction, you have an execution cost which is in gas, which is very much like
68
00:04:55,480 --> 00:04:59,710
like very much like kilowatt hours for electricity, which you then pay with money.
69
00:05:00,280 --> 00:05:02,200
The whole idea there is the same.
70
00:05:02,200 --> 00:05:03,310
It's an abstraction.
71
00:05:03,310 --> 00:05:04,720
More on that a little bit later.
72
00:05:04,720 --> 00:05:09,760
And you have data that goes in, data that goes out logs and so on and so forth.
73
00:05:10,500 --> 00:05:16,960
And that's the point of this this video here to tell you a little bit more about how you interact with
74
00:05:16,960 --> 00:05:24,520
your smart contracts, how you read and write to smart contracts, what is the difference between a
75
00:05:24,520 --> 00:05:26,620
reading and writing function?
76
00:05:26,620 --> 00:05:35,770
And with this, we can, yeah, conclude our solidity basics and remix and environment section and we
77
00:05:35,770 --> 00:05:38,710
are going into an actual project.
7697
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.