Skip to content

Commit e85dd74

Browse files
author
Luka Kurnjek
committed
Adding anchors for chapter 8
1 parent 56daa36 commit e85dd74

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

chapters/chapter-08-writing-smart-contracts-plutusv3.adoc

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
[[writing-smart-contracts]]
55
== Writing smart contracts
66

7+
[[chapter8-prefaces]]
78
=== Prefaces
89

10+
[[chapter8-plutus-preface]]
911
==== Plutus preface
1012

1113
_Prof Philip Wadler(((Wadler, Philip))), FRS_ +
@@ -93,6 +95,7 @@ experience – it's not often that you can suggest a practical
9395
application of a fifty-year-old theory and have people take you
9496
seriously!
9597

98+
[[chapter8-marlowe-preface]]
9699
==== Marlowe preface
97100

98101
_Prof Simon Thompson(((Thompson, Simon)))_ +
@@ -183,7 +186,7 @@ refine the core language evolution to better support its aim of
183186
providing a high-level, chain-agnostic language for blockchain financial
184187
smart contracts. Please join us on this journey!
185188

186-
189+
[[chapter8-smart-contract-programming-languages]]
187190
=== Smart contract programming languages
188191

189192
Cardano(((Cardano))) smart contract languages can be grouped into three categories:
@@ -192,6 +195,7 @@ Cardano(((Cardano))) smart contract languages can be grouped into three categori
192195
* Compiled languages(((language, compiled))) that can be compiled to a native language
193196
* Interpreted languages(((language, interpreted))) that are interpreted by a compiled language.
194197

198+
[[chapter8-native-languages]]
195199
==== Native languages
196200

197201
The Cardano node can only process native languages. Currently, there are
@@ -225,6 +229,7 @@ Solidity(((Solidity))) languages is presented in section
225229
The security advantages of Cardano's EUTXO model over Ethereum's account-based
226230
model are discussed in section <<Cardano security>>.
227231

232+
[[chapter8-compiled-languages]]
228233
==== Compiled languages
229234

230235
Smart contract developers do not write code directly in Plutus. Instead,
@@ -343,6 +348,7 @@ with links to the official page and a white paper.
343348
showcase] page: tags projects by groups
344349
and adds a short description to each.
345350

351+
[[chapter8-interpreted-languages]]
346352
==== Interpreted languages
347353

348354
The third category of smart contract languages in Cardano consists of
@@ -376,6 +382,7 @@ following domains:
376382
Section <<Marlowe security and best practices>> explores the security
377383
and best practices of Marlowe in more detail.
378384

385+
[[chapter8-on-chain-and-off-chain-code]]
379386
==== On-chain and off-chain code
380387

381388
Sometimes, smart contract code is referred to as on-chain code(((on-chain, code))) because
@@ -431,8 +438,10 @@ showcases how to write off-chain code for smart contracts in subsections
431438
We provide a link to a repository that contains the presented MeshJS code
432439
examples and also contains Lucid Evolution code examples.
433440

441+
[[chapter8-smart-contract-case-studies]]
434442
=== Smart contract case studies
435443

444+
[[chapter8-world-mobile-token-smart-contracts]]
436445
==== World Mobile Token smart contracts
437446

438447
The https://worldmobile.io/en[World Mobile] company offers an
@@ -528,6 +537,7 @@ encryption(((encryption, private/public))) provided by Cardano
528537
and restricts spending to only unspent transaction outputs(((transaction, output))),
529538
making the reward system more deterministic.
530539

540+
[[chapter8-cardano-addresses]]
531541
=== Cardano addresses
532542

533543
A blockchain address serves as a communication link between the
@@ -576,6 +586,7 @@ _bootstrap addresses_ and _script addresses_. The
576586
https://docs.cardano.org/learn/cardano-addresses/[Cardano addresses]
577587
documentation page provides more information about address categories.
578588

589+
[[chapter8-binary-format]]
579590
==== Binary format
580591

581592
Under the hood, a Cardano address is a sequence of bytes that conforms
@@ -649,8 +660,10 @@ https://cips.cardano.org/cips/cip19/#binaryformat[Cardano Improvement Proposal 1
649660
(CIP-19), which defines the technical details of Cardano
650661
addresses.
651662

663+
[[chapter8-marlowe-smart-contracts]]
652664
=== Marlowe smart contracts
653665

666+
[[chapter8-about-marlowe]]
654667
==== About Marlowe
655668

656669
Marlowe(((Marlowe))) is a domain-specific language (DSL) for building
@@ -741,6 +754,7 @@ ecosystem as a community-based project. The Marlowe repositories will be
741754
transferred to the https://github.com/marlowe-lang[marlowe-lang]
742755
GitHub, and continued development will take place there.
743756

757+
[[chapter8-developer-tools-and-services]]
744758
==== Developer tools and services
745759

746760
Marlowe provides a set of open-source tools that help create, test, and
@@ -934,6 +948,7 @@ documentation] provides extensive explanations, links to learning
934948
resources, and access to tutorials and community resources from the top
935949
bar.
936950

951+
[[chapter8-marlowe-runtime-architecture]]
937952
==== Marlowe Runtime architecture
938953

939954
Below is the Marlowe Runtime(((Marlowe, runtime))) architecture:
@@ -973,6 +988,7 @@ Please note that the Marlowe Runtime architecture may evolve. Refer to
973988
the https://docs.marlowe-lang.org/docs/platform-and-architecture/architecture[Marlowe
974989
documentation] for the latest version.
975990

991+
[[chapter8-contract-examples]]
976992
==== Contract examples
977993

978994
Marlowe is designed to create the following building blocks of financial
@@ -1345,6 +1361,7 @@ Swap Prototype] – a decentralized platform for users to list tokens for
13451361
swap, specifying the desired return. Interested parties can accept
13461362
offers, resulting in a token swap.
13471363

1364+
[[chapter8-integrating-with-plinth]]
13481365
==== Integrating with Plinth
13491366

13501367
Marlowe contracts can be integrated with Plinth smart contracts or other
@@ -1379,6 +1396,7 @@ Plinth script does not interfere with Marlowe validation
13791396
* The Marlowe validators do not need to be modified to run alongside a
13801397
Plinth script that holds the role token.
13811398

1399+
[[chapter8-future-of-marlowe]]
13821400
==== Future of Marlowe
13831401

13841402
The Marlowe Foundation(((Marlowe, Foundation))) will continue supporting
@@ -1421,6 +1439,7 @@ businesses, developers, infrastructure providers, and stake pool operators(((SPO
14211439
* Marlowe oracle protocol
14221440
* Outreach
14231441

1442+
[[chapter8-marlowe-dapp-starter-kit]]
14241443
===== Marlowe DApp starter kit
14251444

14261445
The Marlowe DApp starter kit(((DSK))) (DSK) will consolidate the documentation,
@@ -1432,6 +1451,7 @@ pre-built binaries to ensure ease of implementation. The initial DSK
14321451
will be delivered early in the project, with incremental enhancements
14331452
added as new technologies are developed.
14341453

1454+
[[chapter8-validator-enhancements]]
14351455
===== Validator enhancements
14361456

14371457
Targeted changes will be implemented to the current validator to
@@ -1446,6 +1466,7 @@ their real-world application potential, will be demonstrated through
14461466
DApp prototypes, fully documented and accessible via the marlowe-ts-sdk
14471467
for developers to build upon.
14481468

1469+
[[chapter8-configurable-runtime-fee-mechanism]]
14491470
===== Configurable runtime fee mechanism
14501471

14511472
To encourage infrastructure providers and SPOs to adopt Marlowe, a
@@ -1456,6 +1477,7 @@ validation layer in the TypeScript client library. This layer will
14561477
ensure secure interactions, even with untrusted backends, facilitating a
14571478
wider distribution and adoption of Marlowe technology.
14581479

1480+
[[chapter8-marlowe-oracle-protocol]]
14591481
===== Marlowe oracle protocol
14601482

14611483
The Marlowe oracle protocol will be formalized and expanded with a
@@ -1470,6 +1492,7 @@ Aiken or Plinth, allowing scripts to efficiently manage oracle data.
14701492
This enhancement will not only ensure compatibility with current
14711493
technologies but also open up numerous new applications on Cardano.
14721494

1495+
[[chapter8-outreach]]
14731496
===== Outreach
14741497

14751498
The Marlowe 2025 project aims to enhance community engagement through a
@@ -1489,6 +1512,7 @@ conceptual track aimed at fundamental language modifications. This track
14891512
will be organized through the creation of Marlowe improvement proposals
14901513
(MIPs), in collaboration with the wider community.
14911514

1515+
[[chapter8-impact-of-marlowe]]
14921516
==== Impact of Marlowe
14931517

14941518
Marlowe has the potential to evolve into a smart contract technology
@@ -1515,6 +1539,7 @@ the initial onboarding process to a single npm(((npm))) install command, a surge
15151539
in Marlowe's usage is anticipated. In doing this, it will benefit a
15161540
range of different stakeholders in different ways.
15171541

1542+
[[chapter8-stakeholder-beneficiaries]]
15181543
===== Stakeholder beneficiaries
15191544

15201545
Marlowe is essential for the Cardano infrastructure. The addition of
@@ -1543,8 +1568,10 @@ the Marlowe special interest group and existing forums, will help forge
15431568
a vibrant and sustainable ecosystem, positioning Marlowe as a
15441569
cornerstone of the Cardano economy.
15451570

1571+
[[chapter8-plutus-smart-contracts]]
15461572
=== Plutus smart contracts
15471573

1574+
[[chapter8-overview-and-learning-resources]]
15481575
==== Overview and learning resources
15491576

15501577
The _Plutus smart contracts(((smart contract)))_ section presents the rules
@@ -1644,7 +1671,7 @@ under an open-source license.
16441671
course, that teaches the basics of blockchain and Cardano.
16451672

16461673
Cardano's hard fork combinator(((HFC))) technology, briefly introduced in section
1647-
<<cardano-node-layers, Cardano node layers>>, subsection *Consensus and storage layer*,
1674+
<<cardano-node-layers, Cardano node layers>>, subsection _Consensus and storage layer_,
16481675
enables the Cardano node(((Cardano node))) to continue processing scripts written in earlier
16491676
versions of Plutus even after a hard fork introduces a new Plutus version.
16501677
If you encounter smart contract code examples written in PlutusV1(((PlutusV1)))
@@ -1654,6 +1681,7 @@ previous Plutus Pioneer program iterations:
16541681
* https://github.com/input-output-hk/plutus-pioneer-program/tree/third-iteration[third-iteration] - PlutusV1 examples
16551682
* https://github.com/input-output-hk/plutus-pioneer-program/tree/fourth-iteration[fourth-iteration] - PlutusV2 examples.
16561683

1684+
[[chapter8-plutus-in-comparison-to-bitcoin-script-and-solidity]]
16571685
==== Plutus in comparison to Bitcoin Script and Solidity
16581686

16591687
This section compares the basic characteristics of smart contracts in
@@ -1782,6 +1810,7 @@ resources. The https://github.com/IntersectMBO/plutus[Plutus]
17821810
GitHub repository also provides links to specifications, design documents,
17831811
academic papers, and talks.
17841812

1813+
[[chapter8-plinth-in-comparison-to-aiken]]
17851814
==== Plinth in comparison to Aiken
17861815

17871816
Plinth(((Plinth))) enables developers to write and compile their on-chain
@@ -1890,6 +1919,7 @@ For those who prefer to learn from a book, the
18901919
https://book.io/book/i-can-aiken/[I can Aiken] book, written by John
18911920
Greene provides comprehensive information and learning examples.
18921921

1922+
[[chapter8-setting-up-a-plinth-development-environment]]
18931923
==== Setting up a Plinth development environment
18941924

18951925
For your development environment, you can use one of the following
@@ -1953,6 +1983,7 @@ Additionally, the Plinth libraries are not hosted on Hackage, which means the on
19531983
to query Plinth types from a REPL is to build it with a Cabal file that imports
19541984
those libraries.
19551985

1986+
[[chapter8-simple-validation-scripts]]
19561987
==== Simple validation scripts
19571988

19581989
In this section, we will look at basic Plinth validation scripts. All
@@ -2821,6 +2852,7 @@ chapter, including blueprint and cabal configuration files, can be found at the
28212852
https://github.com/input-output-hk/plutus-pioneer-program/tree/plinth-plutusV3[plinth-plutusV3]
28222853
branch of the Plutus pioneer program.
28232854

2855+
[[chapter8-script-context-explained]]
28242856
==== Script context explained
28252857

28262858
In this section, we will examine the [purple]#ScriptContext# data type in more detail.
@@ -2848,6 +2880,7 @@ In the previous code examples, the validation logic did not use the transaction
28482880
information. However, in most validator scripts, they are
28492881
used. First, we look at the script information data type.
28502882

2883+
[[chapter8-script-information]]
28512884
===== Script information
28522885

28532886
The [purple]#ScriptInfo# data type is defined as:
@@ -2986,6 +3019,7 @@ following script purposes:
29863019
In the <<Plutus smart contracts>> section, we will focus on the spending
29873020
and minting script purposes.
29883021

3022+
[[chapter8-decoding-the-script-information-in-untyped-form]]
29893023
===== Decoding the script information in untyped form
29903024

29913025
Before we move on to explaining the transaction information data type we look
@@ -3059,6 +3093,7 @@ in smart contracts:
30593093
* Representing the current state of the UTXO
30603094
* Defining metadata and/or configurations.
30613095

3096+
[[chapter8-transaction-information]]
30623097
===== Transaction information
30633098

30643099
Let us look at the transaction information(((transaction, information)))
@@ -3405,6 +3440,7 @@ donation. Both are of type [purple]#Maybe V2.Lovelace#. Learn more about
34053440
governance features, including the topics of voting and proposal submission
34063441
in chapter <<Cardano governance>>.
34073442

3443+
[[chapter8-time-dependent-and-parameterized-validators]]
34083444
==== Time-dependent and parameterized validators
34093445

34103446
This section demonstrates a smart contract representing a vesting
@@ -3656,6 +3692,7 @@ function to the vesting parameter in order to wrap the validator before compilin
36563692
This concludes the procedure of writing a parameterized contract. Next, we look at
36573693
off-chain code that interacts with the validators presented in this section.
36583694

3695+
[[chapter8-off-chain-code-with-meshjs]]
36593696
==== Off-chain code with MeshJS
36603697

36613698
The blockchain is passive – it only acts when a user interacts with it.
@@ -4335,6 +4372,7 @@ More information about MeshJS is available at:
43354372
In the next section, we show how to write a minting policy and off-chain code
43364373
that interacts with the policy.
43374374

4375+
[[chapter8-minting-policies-and-native-tokens]]
43384376
==== Minting policies and native tokens
43394377

43404378
In Plutus, a minting policy(((minting policy))) or minting script defines the
@@ -4926,6 +4964,7 @@ explanations] page, which also covers native tokens
49264964
* https://iohk.io/en/research/library/papers/native-custom-tokens-in-the-extended-utxo-model/[Native
49274965
Custom Tokens in the Extended UTXO Model] scientific paper.
49284966

4967+
[[chapter8-plutusv3-features]]
49294968
==== PlutusV3 features
49304969

49314970
PlutusV3(((PlutusV3))) focuses on performance throughput, smart contract size,
@@ -4995,8 +5034,10 @@ allows for better code optimization. This is discussed further in section
49955034
<<Simple validation scripts>>. The
49965035
https://plutus.cardano.intersectmbo.org/docs/working-with-scripts/optimizing-scripts-with-asData[Plinth user guide] also provides information on that.
49975036

5037+
[[chapter8-smart-contract-security]]
49985038
=== Smart contract security
49995039

5040+
[[chapter8-cardano-security]]
50005041
==== Cardano security
50015042

50025043
The security of smart contracts is an important topic, since these programs
@@ -5279,7 +5320,7 @@ smooth transitions during hard forks. If a hard fork upgrades the Plutus
52795320
language to a new major version, smart contracts using an older version
52805321
of Plutus can still be processed. You can read more about the HFC in
52815322
<<cardano-node-layers, Cardano node layers>> section, subsection
5282-
**Consensus and storage layer**.
5323+
_Consensus and storage layer_.
52835324

52845325
Cardano smart contracts see a predictable number of inputs and can only
52855326
produce a set number of outputs that are always the same given the same
@@ -5307,6 +5348,7 @@ security features of the Plutus and Marlowe smart contract languages are
53075348
further discussed in the remaining sections of the <<Smart contract security>>
53085349
section.
53095350

5351+
[[chapter8-plutus security]]
53105352
==== Plutus security
53115353

53125354
Cardano offers Plinth(((Plinth))), previously called PlutusTx, which is a
@@ -5631,7 +5673,7 @@ made some of their audit reports freely available to the public:
56315673
Other auditing companies that might not have their auditing reports grouped
56325674
into a single repository, are also worth exploring.
56335675

5634-
[[marlowe-security]]
5676+
[[chapter8-marlowe-security]]
56355677
==== Marlowe security and best practices
56365678

56375679
*Marlowe security*

0 commit comments

Comments
 (0)