-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass 5.txt
238 lines (110 loc) · 4.36 KB
/
class 5.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
https://etherscan.io/address/0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0#code
https://trufflesuite.com/truffle/
https://trufflesuite.com/docs/truffle/how-to/create-a-project/
mkdir MetaCoin
cd MetaCoin
truffle unbox metacoin
touch addnum.sol (create empty file)
nano addnum.sol (edit the file)
copy the code from remix and paste into the addnum.sol file
CTRL + X
save the file
1. Remix --- browser based IDE
2. Truffle --- command line inteface for more developer options
3. Ganache --- desktop app for running local blockahin instance
test just the solidity code ---->> remix
deployments, test case frameworks --- truffle or hardhat (most preferred) or foundry
https://sepolia.etherscan.io/
miner1 :
[1, 2, 3, 4, 5]
miner2
[2, 3, 4, 6] ---- X
[1,2,3,4,5] ---->
1 ----> usea to useb ---> balance check ---->
2 3 4 5 ------> user a ----> balane check --->
b1 - [12345]
miner wll have transaction fee as reward----> [1000 ETH] --- 1% ---> 10 ETH
State transition:
-----------------
1. which transits the data from one state to another after succssful execution of transaction
state: Alice
--------
v1 - 1024 timstamp - 11.25.2022 --- previous state in ledger
v2 - 1014 timestamp - 11.26.2022 --- current state in ledger <<<<-----
chain 1: B1, B2, B3, B4, B5, B7, B8, B9, B11, B12 ------ 50 miners
They will wait for the longest chain in the network by most miners being followed
while confirming trnx it shoudl get approval of next 7 blocks from the miners
chain 2: B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12 ----75 miners
a. orphan blocks in BTC
b. uncle blocks in ETH
Simple txn:
------------
transfer of funds from alice to bob
1. unique number call nonce(random number per txn)
2. data fileds
3. recepient and sender signtures
4. gas price, gas limit,
5. value of the txn
[ orginal txn 1 ----> 50 eth to userb --- usera --- 768768767
orginal txn 1 ----> 50 eth to userb --- usera --- 987809709 ]
POS: 21 nodes of miners are running
----
m1 - 32 eth
m2 - 23 eth
m3 - 19 eth
....
round 1 - M1
round 2 - M3
round 7 - M16
execution which is involved in signature validation (user spcifc key) is called as TXN
execution which is NOT involved in signature validation (user specific key) is called as Message
two diff smart contracts running in the network:
------------------------------------------------
1. CBDC token contract - CTOKEN - 09JKJJKBKJ907098709789 --- 200 USD TO 100 ETH (txn)
Makes a call to next contract which is below
2. Payment token contract - PTOKEN - 98-098BVJHBJHBHJBJBBJK --- 200 USD and delivers 100 ETH to this payment contract
IPFS: metadata details on decentralized applications
------
{
contract : 989jhkjjkjkn
nanem : token contract - erc20
date of deployment :
address :
}
unique content id ---- 756567bjbhbjhbjhbhjbjkhszdf9809809
FTP: Swarm
-----------
250mb to user1 --> bee
signature/identity valdiations ---- > clef
10 15 20 10 15 20 ------- 8789787
user1: 10 15 20 10 15 20
hash - 8789787
valid and stored in the node
Whisper protocol: how nodes talk to each other
----------------------------------------------
CAP Theorem:
--------------
consistency, availabilty and partiontioning
availability, partioning ----> consistecy --->> latency
write ---> compile ---> deploy ---> run uni tests
txn fee is involved for each n every txn we perform on ethereum
1. fund transfer
2. deploying smart contracts --- we need to pay some gas fee
pseudo code(high level) for additon on two numbers:
a. pragma
b. contract
c. declare 2 nums
d. add func to accept nums from user input (uint256 x)
d. function to add nums
public --- it is access to everyone
private --- it is access to only owner/func within the contract
view -- it does perform only read only operations on the state value
1. write code
2. identifiers
3. gas optimizations
Project folder:
---------------
1. Contracts - in whicn we write .sol/ solidytty code
2. Deployment - write deployment scripts to deploy to diff test/production networks
3. test --- write unit tests for coverage
4. configurations ---- we create config files required for project