-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
algorand-school-english.txt
4022 lines (3295 loc) · 74 KB
/
algorand-school-english.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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Algorand School
2023
Open Source: github.com/cusma/algorand-school
Our journey today:
understanding Algorand Consensus and Algorand Networks, how to use Algorand Dev Tools, how to develop decentralized applications on the Algorand Virtual Machine
Agenda
Blockchain as an infrastructure
Analog properties for Digital things
Algorand Consensus
Algorand Sustainability
Algorand Networks
Algorand Interoperability
Algorand Transactions
Algorand Accounts
Algorand Standard Assets & ARCs
Algorand Virtual Machine
Algorand Smart Contracts on Layer-1
Smart Signatures & Smart Contracts
TEAL
PyTEAL
Algorand ABI
Beaker
4
Introduction to Algorand
An efficient public infrastructure for digital value
Cosimo Bassi
Solutions Architect at Algorand
cosimo.bassi@algorand.com
Blockchain is a digital infrastructure for value
6
"The ability to create something which is not duplicable in the digital world has enormous value."
Eric Schmidt
The infrastructure trilemma
7
TRILEMMA
2
3
1
SECURITY (INT/EXT)
ACCESSIBILITY
EFFICIENCY
Public or private? Who has the control? Duty and responsibility? Aligned incentives?
The problem of native digital value
8
In the digital age
everything can be represented in bits
as a string of 0 and 1
Strings of 0 and 1 are useful
because you can
duplicate them easily
Value is therefore difficult to represent in the digital age:
SCARCITY, AUTHENTICITY, UNICITY
How to build such infrastructure? Protocol is the answer
9
Just like TCP/IP is the foundational protocol for the modern Internet infrastructure, we will solve the problem through an protocol.
This is not just an information technology problem
10
DISTRIBUTED SYSTEMS
CRYPTOGRAPHY
GAME THEORY
PUBLIC
TAMPER-PROOF
TRANSPARENT
TRUSTLESS
LEDGER
Distributed systems and cryptography are elements of the communication infrastructure. We need a third element: game theory.
Who controls the system? Nobody… everybody!
11
PAST
FUTURE
DISTRIBUTED SYSTEMS
No absolute power, no single point of failure.
Don’t trust, verify!
12
Nobody can break the rules…
and
…everybody can verify.
CRYPTOGRAPHY
Align incentives: collective self-protecting system
13
GAME THEORY
Equilibrium in which attacking the system is less convenient than protecting it.
Cost of the attack: make malicious behaviours expensive.
14
ANALOG PROPERTIES
FOR DIGITAL THINGS
Consensus as “law of Physics” for digital world
Who owns what? Let’s write it down!
15
A blockchain is a public ledger of transactional data.
World's first writing — cuneiform — traces its beginnings back to an ancient system of accounting.
WHO
OWNS
WHAT
Writing systems: from prehistory to history of humankind.
More copies are better than one!
16
Distributed and replicated across a system of multiple nodes in a network.
All “ledger keepers” should work together, using the same set rules, to verify the transactions to add to each copy of the finalized ledger.
17
Atoms can’t be copy & pasted and are obliged to follow the arrow of time!
Bits can be copy & pasted and are not obliged to follow the arrow of time!
Entropy, irreversibility and the arrow of time
In a distributed system is hard to ensure that the information follows a consequential time. Also, the arrow of time could bypassed reverting transactions. The ledger of information must respect a precise history and must not allow arbitrary creation, duplication or deletion of information.
A chain of transactions organized in blocks
18
The “block” refers to a set of transactions that are proposed and verified by the other nodes and eventually added to the ledger (no copy & paste).
The “chain” refers to the fact that each block of transactions contains proof (a cryptographic hash) of what was in the previous block (arrow of time).
Can transactions be reverted or modified ex-post? No! Dura lex, sed lex!
A distributed state machine
19
A machine
The evolution of the states of the system is determined…
SYSTEM STATE
S0
SYSTEM STATE
Sn
SYSTEM STATE
S1
BLOCK N
SMART CONTRACT
TRANSACTION
The evolution of the states of the system is determined…
…acting on atoms, through the inviolable laws of Physics!
…acting on bits, through what?
BLOCK 1
SMART CONTRACT
TRANSACTION
The more complex the state transition the more power I consume: adding 1 transaction per month is easy, executing thousands of smart contracts on the AVM is complicated.
The responsibility of correct information
20
Margaret Hamilton in 1969, standing next to listings of the software she and her MIT team produced for the Apollo project.
BLOCK PROPOSER
GENESIS BLOCK
BLOCK 1
BLOCK N
BLOCK N+1
How should we replace the role played by the law of Physics in evolving the state of a machine?
With a set of software rules, called Consensus Protocol that evolves the state of the system.
Paleo-computing: no IDE, no syntax highlighting, handwritten code (value of conciseness).
The architecture of consensus
21
Temple of Concordia
Valley of Temples (Agrigento), 440-430 B.C.
How to choose the proposer for the next block for a public and permissionless blockchain?
How to ensure that there is no ambiguity in the choice of the next block?
How to ensure that the blockchain stays unique and has no forks?
How to ensure that consensus mechanism itself can evolve over time while the blockchain is an immutable ledger?
It is the largest and best-preserved Doric temple in Sicily[5] and one of the best-preserved Greek temples in general,[1] especially of the Doric order. Named after Concordia.
In ancient Roman religion, Concordia is the goddess who embodies agreement in society. Her Greek equivalent is usually regarded as Harmonia, with musical harmony a metaphor for an ideal of social concord.
This tells us a lot about the value of such a civilization!
Proof of Work consensus mechanism
22
Miners compete with each other to append the next block and earn a reward for the effort, fighting to win an expensive computational battle.
The more computational power, the higher the probability of being elected as block proposer.
PoW
Proof of Work limits
23
Huge electrical consumption
Concentration of governance in few mining farms
Soft-forking of the blockchain
Proof of Stake consensus mechanism
24
Network participants show their commitment and interest in keeping the ledger safe and secure proving the ownership of value stored on the ledger itself.
The higher the skin in the game the higher the probability of being elected as block proposer.
Proof of Stake limits
25
CRITICAL ISSUES
BONDED PROOF OF STAKE
Validators bind their stake, to show their commitment in validating and appending a new block. Misbehaviors are punished.
Participating in the consensus protocol makes users’ stakes illiquid
Risk of economic barrier to entry
DELEGATED PROOF OF STAKE
Users delegate the validation of new blocks to a fixed committee, through weighted voting based on their stakes.
Known delegate nodes, therefore exposed to DDoS attacks
Centralization of governance
BPoS
DPoS
It’s like playing Battleship knowing the coordinates of adversary in advance.
Is the Blockchain Trilemma unsolvable?
26
TRILEMMA
2
3
1
SECURITY
SCALABILITY
DECENTRALIZATION
27
ALGORAND CONSENSUSPure Proof of Stake (PPoS)
Scalable 6000 TPS, billions of users
Fast < 3.9 s per block
Secure 0 downtime for over 23M blocks
Low fees 0.001 ALGO per txn
No Soft Forks prob. < 10-18
Instant Transaction Finality
Carbon neutral
Minimal hardware node requirements
No delegation or binding of the stake
No minimum stake
Secure with respect DDoS
Network Partitioning resilience
Algorand PPoS Consensus
28
Silvio Micali Algorand Founder
Professor MIT, Turing Award, Gödel Prize
Digital Signatures, Probabilistic Encryption, Zero-Knowledge Proofs,
Verifiable Random Functions and other primitives of modern cryptography.
Flat fee is very powerful for business models: given a users base, an estimation of users activity (tx/day) a business team can foresee the costs and hedge the on-chain resources.
Tamper-proof, unique and verifiable dices
29
VRF
Dices are perfectly balanced and equiprobable, nobody could tamper their result!
Keep observing dice rolls by no means increases the chance of guessing the next result!
Each dice is uniquely signed by its owner, nobody can roll someone else dices!
Dices are publicly verifiable, everybody can read the results of a roll!
Who chose the next block?
30
VRF
VRF
VRF
VRF
WIN!
Each ALGO could be assimilated to a tamper-proof dice participating in a safe and secret cryptographic dice roll. More ALGOs more dices to roll.
For each new block, dice rolls are performed in a distributed, parallel and secret and manner, directly on online accounts’ hardware (in microseconds).
The winner is revealed in a safe and verifiable way only after winning the dice roll, proposing the next block.
A glimpse on “simplified” VRF sortition
31
A secret key (SK) / public verification key (VK) pair is associated with each ALGO in the account
For each new round r of the consensus protocol a threshold L(r) is defined
Each ALGO in the account performs a VRF, using its own secret key (SK), to generate:
a pseudo-random number: Y = VRFSK(seed)
the verifiable associated proof: ⍴SK(seed)
If Y = VRFSK(seed) < L(r), that specific ALGO “wins the lottery” and viraly propagates the proof of its victory ⍴SK(seed) to other network’s nodes, through “gossiping” mechanism
Others node can use the public verification key (VK) to verify, through ⍴SK(seed), that the number Y was generated by that specific ALGO, owned by the winner of the lottery
Pure Proof of Stake, in short
32
Through the cryptographic lottery, an online account is elected with probability directly proportional to its stake: each ALGO corresponds to an attempt to win the lottery!
An account is elected to propose the next block
A committee is elected to filter and vote on the block proposals
A new committee is elected to reach a quorum and certify the block
The new block is appended to the blockchain
Each round of the consensus protocol appends a new block in the blockchain:
Ok, but… how long does it take?
33
Less than 3.9 seconds!
34
Pure Proof of Stake security
35
Algorand’s decentralized Byzantine consensus protocol can tolerate an arbitrary number of malicious users as long as honest users hold a super majority of the total stake in the system.
The adversary does not know which users he should corrupt.
The adversary realizes which users are selected too late to benefit from attacking them.
Each new set of users will be privately and individually elected.
During a network partition in Algorand, the adversary is never able to convince two honest users to accept two different blocks for the same round.
Algorand is able to recover shortly after network partition is resolved and guarantees that new blocks will be generated at the same speed as before the partition.
Pure Proof of Stake: the output pre-upgrade!
36
BLOCKS
> 32M with 0 downtime
BLOCKCHAIN SIZE
~ 1 TB
ADDRESSES
> 32M with ~ 1M monthly active addresses
AVG. BLOCK FINALIZATION
~ 3.5 sec per block
TXNS WEEKLY VOLUME
~ 5M transactions (September 2023)
TPS WEEKLY PEAK
~ 6000 transactions per second
* up to August 2022
This is the output that such a complex machine has produced so far… We still have to answer to the opening question: “is this machine good at consuming input resources to produce the desired output for which it has been designed for?”
Algorand Layer-1 primitives
37
Algorand Standard Assets (ASA)
Atomic Transfers
(AT)
Algorand Virtual Machine (AVM)
Algorand State Proof (ASP)
TRUSTLESS
INTEROPERABLE
POST-QUANTUM SECURE
What does execution on Layer-1 mean?
38
B1
B2
...
Br
ASC1 CALL
ASC1 CALL
ASC1 CALL
TXN 1
ASC1 CALL
L-1 CONSENSUS COMMITTEE
3.8 sec
L-1 CONSENSUS COMMITTEE
3.8 sec
L-1 CONSENSUS COMMITTEE
3.8 sec
EXECUTION ON PPoS CONSENSUS LEVEL
up to 25000 txn/block
up to 25000 txn/block
AVM execution does not slow down the whole blocks production!
up to 25000 txn/block
up to 25000 txn/block
Each complex system is characterised by a “natural pulsation”. For electrical networks is the grid’s frequency, for automated assembly lines is the production tack-time. We, humans, are complex systems, our natural pulsations is the heartbeat. Block time is Algorand’s heartbeat!
What does execution on Layer-1 mean?
39
Smart Contracts are executed “at consensus level”
Benefit from network's speed, security, and scalability
Fast trustless execution (~3.8 seconds per block)
Low cost execution (0.001 ALGO regardless SC’s complexity)
Instant Finality of Smart Contracts’ effects
Native interoperability with Layer-1 primitives
Safe high level languages (PyTeal, Reach, Clarity)
Low energy consumption
40
ALGORAND SUSTAINABILITY“Permission-less” is not “Responsibility-less”
Full paper: “Proof of Stake Blockchain Efficiency Framework”
“Permission-less” is not “Responsibility-less”
41
Algorand is a permission-less network 🕸, so no centralized authority can know or impose how node runners should power their nodes 💻.
As decentralized infrastructure, Algorand is responsible for its impact on Planet Earth 🌏, although no centralized authority controls it.
Algorand should acts proactively (not hiding behind the “permission-less excuse”) and set blockchains’ sustainability bar high 🌱.
Proof of unsustainable Work
42
Proof of Work is a planetary wasteful computational battle, in which miners MUST burn energy to secure the blockchain.
Showing off personal commitment in the ecosystem through the consumption of computational and energetic resources is at the core of PoW consensus mechanism.
Our planet Earth can no longer afford unsustainable technologies.
43
A matter of orders of magnitude (PoW vs PPoS)
Eiffel Tower
Paper sheet thickness
2x Burj Khalifa
103
102
10-5
Full paper: “Proof of Stake Blockchain Efficiency Framework”
44
You like to win easy!
What about others Proof of Stake?
When the going gets tough, the tough get going (PoS vs PPoS)
45
Blockchain sustainability must consider scalable end-user transactions (uTPS) finality (f), nodes hardware (N), and secure network decentralization (d).
Being sustainable while centralized, insecure or not scalable
is worthless!
DECENTRALIZED
SECURE
NETWORK
(running on Consensus Protocol)
(f, N, d)
INPUT
OUTPUT
POWER
(Pval)
END-USER
FINALIZED
TRANSACTIONS
(uTPS)
Reframing the question
46
Is Algorand blockchain efficient
at consuming energy
to finalize end user useful transactions
in a secure, scalable and decentralized way?
Algorand solves blockchain trilemma sustainably
47
Algorand transactions are 100% available to end-users
(other PoS blockchains consume their own transactions for consensus)
Algorand transactions are 100% instantly final
(other PoS must consume the energy of several blocks to ensure transactions’ finality)
Algorand transactions are secured by a very decentralized network
(some PoS blockchain have only few validators)
Algorand security is a feature of its own efficiency
(Algorand never experienced downtime since the genesis block)
Full paper: “Proof of Stake Blockchain Efficiency Framework”
48
ALGORAND NETWORKSNodes, Indexer and APIs
Algorand Node configurations
49
Non-Relay Nodes
Participate in the PPoS consensus (if hosting participation keys)
Connect only to Relay Nodes
Light Configuration: store just the lastest 1000 blocks (Fast Catch-Up)
Archival Configuration: store all the chain since the genesis block
Relay Nodes
Communication routing to a set of connected Non-Relay Nodes
Connect both with Non-Relay Nodes and Relay Nodes
Route blocks to all connected Non-Relay Nodes
Highly efficient communication paths, reducing communication hops
Example of Algorand Network topology
50
Node Metrics
Non-Relay Nodes: > 1100
Relay Nodes: > 120
51
Access to Algorand Network
The Algorand blockchain is a distributed system of nodes each maintaining their local state based on validating the history of blocks and the transactions therein. Blockchain state integrity is maintained by the consensus protocol which is implemented within the Algod daemon (often referred to as the node software).
An application connects to the Algorand blockchain through an Algod client, requiring:
a valid Algod REST API endpoint IP address
an Algod token from an Algorand node connected to the network you plan to interact with
These two pieces of information can be provided by your local node or by a third party node aaS.
52
How to get an Algod Client?
There are three ways to get a REST API Algod endpoint IP address / access token, each with their respective pros and cons depending on development goals.
53
Algorand Networks
54
Algorand Node - Writing on the blockchain
Install (Linux, MacOS, Windows)
Choose a network (MainNet, TestNet, BetaNet, PrivateNet)
Start & Sync with the network, Fast Catchup
genesis.json (mainnet)
{
"alloc": [
{
"addr": "7377777777777777...77777777UFEJ2CI",
"comment": "RewardsPool",
"state": {
"algo": 10000000000000,
"onl": 2
}
},
{
"addr": "Y76M3MSY6DKBRHBL7C3...F2QWNPL226CA",
"comment": "FeeSink",
"state": {
"algo": 1000000,
"onl": 2
}
},
...
],
"fees": "Y76M3MSY6DKBRHBL7C3NNDX...F2QWNPL226CA",
"id": "v1.0",
"network": "mainnet",
"proto": "https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0",
"rwd": "737777777777777777777...77777777UFEJ2CI",
"timestamp": 1560211200
}
Interacting with Algorand Nodes
CLI utilities: goal, kmd and algokey
REST API interface: algod V2, kmd, indexer
Algorand SDKs: JavaScript, Python, Java o Go
55
Algorand Indexer - Reading from the blockchain
The Indexer provides a REST API interface of API calls to query the Algorand blockchain. The Indexer REST APIs retrieves blockchain data from a PostgreSQL database, populated using the Indexer instance connected to an Archival Algorand node that reads blocks’ data. As with the Nodes, the Indexer can be used as a third-party service.
Which node configuration do I need?
56
I want to participate in consensus and help secure the Algorand network.
➥ non-relay non-archival participation node.
I want to send transactions and read current state of smart contracts/applications:
➥ non-relay non-archival non-participation node.
I want full access to historical data (blocks, transactions) with advanced querying:
➥ non-relay archival non-participation node, together with an indexer.
I want to get state proofs for any block:
➥ non-relay archival non-participation node.
I want just to have access to non self hosted Algod and Indexer end-points for your Web3 project:
➥ use a third-party Algorand API-aaS (e.g. AlgoNode).
57
How to interact with Algorand Node and Indexer
58
AlgoKit: Algorand’s dev one-stop-shop
59
Algorand Community SDKs
Java
JavaScript
Python
Go
C#
Rust
Dart
PHP
Algorand SDKs
Swift
60
Algorand Developer Portal
61
Awesome Algorand
62
Algorand Wallets
Pera Wallet + Wallet Connect
MetaMask
DeflyApp
63
Algorand Explorers
Dappflow
64
ALGORAND INTEROPERABILITYState Proofs and Post-Quantum Security
Credits to Noah Grossman for contents
Trustless interoperability
65
Algorand approach to interoperability:
cross-chain transactions should rely just on
Trust in departing consensus protocol
Trust in arrival consensus protocol
without centralized bridges or validator networks, to handle the assets.
Algorand State Proofs remove trusted centralized operators becoming the first trustless post-quantum secure L1 interoperability standard.
Post-Quantum Secure Algorand State Proofs
66
Post-Quantum secure and immutable proofs, attesting blockchain state, generated by Pure Proof of Stake consensus protocol.
67
ALGORAND TRANSACTIONS
Core element of blocks
Changing blockchain state
68
Transactions are the core element of blocks, which define the evolution of distributed ledger state. There are six transaction types in the Algorand Protocol:
Payment
Key Registration
Asset Configuration
Asset Freeze
Asset Transfer
Application Call
These six transaction types can be specified in particular ways that result in more granular perceived transaction types.
Signature, fees and round validity
69
In order to be approved, Algorand’s transactions must comply with:
Signatures: transactions must be correctly signed by its sender, either a Single Signature, a Multi Signature or a Smart Signature / Smart Contract
Fees: in Algorand transactions fees are a way to protect the network from DDoS. In Algorand Pure PoS fees are not meant to pay “validation” (as it happens in PoW blockchains). In Algorand you can delegate fees.
Round validity: to handle transactions’ idempotency, letting Non-Archival nodes participate in Algorand Consensus, transactions have an intrinsic validity of 1000 blocks (at most).
Browse through a transaction
70
Transactions are characterized by two kind of fields (codec):
common (header)
specific (type)
Payment Transaction example
71
Here is a transaction that sends 5 ALGO from one account to another on MainNet.
72
ALGORAND ACCOUNTS
Transactions’ Authorization
Signatures
73
SECRET KEY
32 bytes
PUBLIC KEY
32 bytes
Ed25519
GENERATOR
Algorand uses Ed25519 high-speed, high-security elliptic-curve signatures.
ALGORAND ADDRESS
58 characters
MNEMONIC PHRASE
25 words
RANDOM SEED
ADDRESS: the public key is transformed into an Algorand Address, by adding a 4-byte checksum to the end of the public key and then encoding it in base32.
MNEMONIC: the 25-word mnemonic is generated by converting the private key bytes into 11-bit integers and then mapping those integers to the bip-0039 English word list.
Algorand Accounts
74
Accounts are entities on the Algorand blockchain associated with specific on-chain local sate. An Algorand Address is the unique identifier for an Algorand Account.
All the potential keys pairs “already exists” mathematically, we just keep discovering them.
Transactions Authorization and Rekey-To
75
PUBLIC ADDRESS
MULTI SIGNATURE ACCOUNT
LOCAL STATE
SECRET KEY [1/N]
PUBLIC ADDRESS
STANDARD ACCOUNT
LOCAL STATE
SECRET KEY
CONTRACT ACCOUNT
SECRET KEY [k/N]
SECRET KEY [N/N]
Algorand Rekeying: powerful Layer-1 protocol feature which enables an Algorand account to maintain a static public address while dynamically rotating the authoritative private spending key(s). Any Account can Rekey either to a Standard Account, MultiSig Account or LogicSig Contract Account.
PUBLIC ADDRESS
SMART SIG
LOCAL STATE
Account State Minimum Balance
76
77
ASAAlgorand Standard Assets on Layer-1
Algorand Standard Assets
78
Algorand Standard Asset (ASA) is the native L1 Algorand tokenization framework.
ASAs do not require writing Smart Contracts!
ASAs can be minted and configured with simple transactions (SDKs / CLI).
ASAs are suitable to tokenize different assets, like:
Fungible assets;
NFT;
Stablecoins;
Loyalty points;
Etc.
Base Params (Immutable)
79
Parameter
Description
Required
Creator
Any Algorand Account: SingleSig / MultiSig / SmartSig / App
YES
Asset Name
Extended Asset name
NO
Unit Name
Asset Unit short name
NO
MetaData Hash
Hash of asset’s metadata.
NO
URL
Link to external data attached to the asset.
NO
Example 1: I want to link the PDF containing the asset’s prospectus and terms of usage to the ASA.
➥ Set the asset URL to PDF hosting URL and the asset metadata hash to the SHA-512/256 of the linked PDF (to guarantee attachment immutability).
Example 2: I want to link an image to an NFT.
➥ Set the asset URL to IPFS CID of the image (see ARC standards sections).
Quantitative Params (Immutable)
80
Parameter
Description
Required
Total
Integer supply of least significant units
YES
Decimals
Client-side interpretation of asset’s decimals positions.
YES
Example 1: I want to be able to increase the asset supply over time (e.g. a stablecoin).
➥ Set the asset total to the maximum allowed by the ledger (264 - 1) and place the total supply in the Reserve (not accounted as circulating supply), then transfer from Reserve to other accounts releasing the circulating supply over time.
Example 2: I want to mint a Non-Fractional NFT.
➥ Set the asset total to 1 and decimals to 0.
Example 3: I want to mint a Fractional NFT, divisible up to 0.01.
➥ Set the asset total to 100 and decimals to 2.
Example 4: I want to mint a stablecoin with a total supply of 10B and divisible up to 3 decimals positions.
➥ Set the asset total to 10B * 103 and decimals to 3.
Whitelisted (Immutable)
81
Parameter
Description
Required
DefaultFrozen
Set True to enable asset whitelisting.
YES
Example 1: I want to mint a whitelisted asset and whitelist users.
➥ Set the asset default frozen to True then use the Freeze Address to add (or remove) users to the asset’s whitelist. See RBAC section.
Role-based Access Control (RBAC)
82
Parameter
Description
Manager Address
The only account that can re-configure any RBAC address (if active) or destroy an asset.
Reserve Address
Non-minted supply reserve (has no special administrative powers). Default: Creator Account. Assets transferred from Reserve Account are minted and accounted as circulating supply.
Freeze Address
If active, the Freeze Address is allowed to whitelist or blacklist users freezing (or unfreezing) asset holdings for a specific accounts. When an account is frozen it cannot send or receive the frozen asset (but could still close-out the asset to the Creator Address).
Clawback Address
If active, the Clawback Account is allowed to transfer assets from and to any asset holder. Clawback Address is usually adopted to revoke assets from users (if active).
Built-in role based access control governance (regulatory frameworks compliance).
Control roles could be re-configured or irreversibly deactivated.
ARC-3
Algorand Standard Asset Parameters Conventions for Fungible and Non-Fungible Tokens
83
Status: Final
Defines Fungible Tokens, Pure NFT, Fractional NFTs
Very comprehensive definition of NFT’s metadata (e.g. images, videos, audio tracks, etc.) and traits as JSON structure
Binding between the ASA and the JSON structure uploaded on external storage (e.g. IPFS, Arweave, etc.)
Circulating tokens: ~ 42,000
Generators: https://arc3.xyz/, https://app.algodesk.io/
Example: https://www.nftexplorer.app/asset/429087615
ARC-69
Community Algorand Standard Asset Parameters Conventions for Digital Media Tokens
84
Status: Living
Adopted both in art and games (https://algoseas.io/)
Simple and succinct definition of NFT’s metadata and traits as JSON structure. Allows tratits configuration after minting
Binding between the ASA and the JSON structure uploaded directly on-chain as transaction notefield
Circulating tokens: ~ 565,000 (most popular standard)
Generators: https://app.algodesk.io/
Example: https://www.nftexplorer.app/asset/420625533
ARC-19
Templating of NFT ASA URLs for mutability
85
Status: Final
Has been adopted as building block of non-fungible-domain standard proposed by NFDomains
Makes use of ASA Reserve Address to update the NFT metadata binding over time.
Circulating tokens: ~ 26,000
Generators: https://app.nf.domains/
Example: https://app.nf.domains/name/john.algo
ARC-20 / ARC-18
Smart ASA / Royalty Enforcement Specification
86
Status: ARC-18 (Draft), ARC-20 (Draft)
Binds a native ASA with a Smart Contract creating a “Smart ASA”, useful whenever a decentralized transferability policy must be enforced on-chain (e.g. royalties, vesting, limited amount per day, etc.)
Allows ASA programmable full reconfigurability on the AVM (e.g. enforcing a rule to upgrade a trait of a NFT character in game, etc.)
ARC-20 Reference Implementation
ARC-18 Reference Implementation (using Beaker)
87
Algorand Virtual Machine
Programming on Algorand
Cosimo Bassi
Solutions Architect at Algorand
cosimo.bassi@algorand.com
What’s a Smart Contract ?
89
Smart Contracts are deterministic programs through which complex decentralized trustless applications can be executed on the AVM.
The Algorand Virtual Machine is a Turing-complete secure execution environment that runs on Algorand consensus layer.
What’s the AVM ?
Algorand Virtual Machine purpose: approving or rejecting transactions’ effects on the blockchain according to Smart Contracts’ logic.
What the AVM actually does?
90
AVM approves transactions’ effects if and only if:
There is a single non-zero value on top of AVM’s stack;
AVM rejects transactions’ effects if and only if:
There is a single zero value on top of AVM’s stack;
There are multiple values on the AVM’s stack;
There is no value on the AVM’s stack;
[...]
[...]
[...]
[...]
[...]
STACK MACHINE
How the AVM works?
91
Suppose we want the AVM to check the following assertion:
1 + 2 = 3
[...]
[...]
[...]
[...]
[...]
STACK MACHINE
How the AVM works?
92
Suppose we want the AVM to check the following assertion:
1 + 2 = 3
1
[...]
[...]
[...]
[...]
STACK MACHINE
pushing first operand
How the AVM works?
93
Suppose we want the AVM to check the following assertion:
1 + 2 = 3
2
1
[...]
[...]
[...]
STACK MACHINE