Skip to content

Commit

Permalink
Enhancing The Starknet Book for a Seamless Learning Experience (#1004)
Browse files Browse the repository at this point in the history
* Update starknet-book.adoc

The current documentation for The Starknet Book provides valuable insights into the Starknet and Cairo ecosystem. However, to improve user experience and accessibility,I  propose enhancing the document's in points , readability and structure.

* Fix the issue Add Table

* fix small issue

* Enhance and Simplify Contract Class Documentation

* Delete .vscode/settings.json

* Apply suggestions from code review

* Update starknet-book.adoc

* Update starknet-book.adoc

* Update starknet-book.adoc

---------

Co-authored-by: Steve Goodman <39279277+stoobie@users.noreply.github.com>
  • Loading branch information
hardiktheprogrammer and stoobie authored Dec 11, 2023
1 parent 63c5c84 commit 062b770
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
[id="contract_classes"]
= Contract classes

As in object-oriented programming, Starknet distinguishes between a contract and its implementation by separating contracts into classes and instances.

A _contract class_ is the definition of the contract: Cairo byte code, hint information, entry point names, and everything that defines its semantics unambiguously.
== Contract Classes

A _contract class_ is the definition of a contract. It inlcudes Cairo byte code, hint information, entry point names, and everything that defines its semantics.

Each class is uniquely identified by its _class hash_, comparable to a class name in traditional object-oriented programming languages.

Each class is identified by its class hash, which is analogous to a class name in an object-oriented programming language.
== Contract Instances

A _contract instance_ is a deployed contract corresponding to a class. Only contract instances behave as contracts, in that they have their own storage and can be called by transactions or other contracts.
A _contract instance_ is a deployed contract that corresponds to a class. Only contract instances act as true contracts, in that they have their own storage and can be called by transactions or other contracts.

A contract class does not necessarily have a deployed instance in Starknet.

[id="using_classes"]
== Using Classes
It's essential to note that a contract class doesn't necessarily require a deployed instance in Starknet.

To add new classes to the state of Starknet, use the `DECLARE` transaction.
== Working with Classes

To deploy new instances of a previously declared class, use the `deploy` system call.
[horizontal,labelwidth=20,role="stripes-odd"]
Adding new classes:: To introduce new classes to Starknet's state, use the `DECLARE` transaction.

To use the functionality of a declared class, without deploying an instance of that class, you can use the `library_call` system call.
This system call is an analogue of Ethereum's low-level `delegatecall` function in the world of classes. The `library_call` system call enables you to use class code directly, instead of having a placeholder contract deployed, which is used only for its code.
Deploying instances:: To deploy a new instance of a previously declared class, use the `deploy` system call.

== Additional resources
Using class functionality:: To use the functionality of a declared class without deploying an instance, use the `library_call` system call. Analogous to Ethereum's `delegatecall`, it enables you to use code in an existing class without deploying a contract instance.

== Additional Resources

* xref:architecture_and_concepts:Smart_Contracts/class-hash.adoc[Class hash]
* xref:architecture_and_concepts:Network_Architecture/transactions.adoc#declare-transaction[`DECLARE` transaction]
* xref:architecture_and_concepts:Smart_Contracts/system-calls-cairo1.adoc#deploy[`deploy` system call]
* xref:architecture_and_concepts:Smart_Contracts/system-calls-cairo1.adoc#library_call[`library_call` system call]

42 changes: 35 additions & 7 deletions components/Starknet/modules/tools/pages/starknet-book.adoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
[id="starknet_book"]
= The Starknet Book
= About the Starknet Book

The link:https://book.starknet.io[Starknet Book] serves as a comprehensive walkthrough, providing valuable insights into the
world of Starknet and Cairo. Designed to cater to various objectives and interests, this resource offers a curated selection of paths to guide your exploration.
The link:https://book.starknet.io[Starknet Book] serves as a comprehensive guide to understanding Starknet, Cairo, and introduces you to the Starknet ecosystem.

Whether you are a complete beginner starting from scratch or an experienced developer looking for specific insights, the Starknet Book has you covered.
The Starknet Book caters to various objectives and interests. Mix and match these chapters to customize your learning experience based on your unique interests and requirements. Whether you're exploring smart contract development, frontend integration, or learning about the core architecture, The Starknet Book is your trusted companion on the journey of deepening your understanding of Starknet.

From smart contract development to frontend integration, node operation to security analysis, and
even delving into the underlying architecture and cryptography, each chapter presents a focused and informative journey. Mix and match these paths to tailor your learning experience based on your unique interests and requirements.
== Table of Contents

The Starknet Book is your trusted companion on the quest for deepening your understanding of the Starknet ecosystem.
[cols="1,3"]
|===
| Chapter | Description

| Chapter 1
|*Introduction to Starknet and Cairo*

An overview of the Starknet ecosystem and the Cairo programming language.
| Chapter 2
|*Smart Contract Development*

Learn how to develop smart contracts on the Starknet platform with this in-depth guide.
| Chapter 3
|*Frontend Integration*

Discover techniques for integrating Starknet with frontend applications seamlessly.

| chapter 4
| *Node Operation*

Practical insights into operating nodes on the Starknet network.

| Chapter 5
| *Security Analysis*

Comprehensive analysis of security considerations within the Starknet ecosystem.
| Chapter 6
| *Underlying Architecture and Cryptography*

Delve into the foundational architecture and cryptographic principles of Starknet.
|===

0 comments on commit 062b770

Please sign in to comment.