bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 73쪽 중 71쪽
ctionality of the contract
* A key-value mapping (where the key and values are field elements), which comprises the contract's storage
* A nonce, which tracks the number of transactions sent from this contract
### Special addresses
Starknet uses special contract addresses to provide distinct capabilities beyond regular contract deployment.
Two such addresses are `0x0` and `0x1`. These addresses are reserved for specific purposes and are characterized by their unique behavior in comparison to traditional contract addresses.
#### Address `0x0`
Address `0x0` functions as the default `caller_address` for external calls, including interactions with the L1 handler or deprecated Deploy transactions. Unlike regular contracts, address `0x0` does not possess a storage structure and does not accommodate storage mapping.
#### Address `0x1`
Address `0x1` is another special contract address within Starknet's architecture. It functions as a storage space for mapping block numbers to their corresponding block hashes. The storage structure at this address is organized as follows:
| | |
| - | - |
| Keys | Block numbers between $\texttt{first\_v0\_12\_0\_block}$ and $\texttt{current\_block} - 10$. |
| Values | Corresponding block hashes for the specified blocks. |
| Default Values | For all other block numbers, the values are set to `0`. |
The storage organization of address `0x1` supports the efficient retrieval of block hashes based on block numbers within a defined range and is also used by the [`get_block_hash`](https://book.cairo-lang.org/appendix-08-system-calls.html#get_block_hash) system call.
## State transition
A transaction $t x$ transitions the system from state $S$ to state $S^{'}$ if:
* $t x$ is an `INVOKE` transaction, and the storage of $S^{'}$ is the result of executing the target contract code with respect to the previous state $S$. The arguments, contract instance's address, and the specific function entry point are part of the transaction.
* $t x$ is a `DEPLOY_ACCOUNT` transaction, and $S^{'}$ contains the new contract instance's state at the contract instance's address. Additionally, the storage of $S$ is updated according to the execution of the contract instance's constructor.
* $t x$ is a `DECLARE` transaction, and $S^{'}$ contains the class hash and definition in the contract class's mapping
## State commitment
The state commitment is a digest that represents the state.
In Starknet, the state commitment combines the roots of two binary [Merkle-Patricia tries](#merkle_patricia_trie) of height 251 in the following manner:
```txt theme={null}
state_commitment = hPos(
"STARKNET_STATE_V0",
contract_trie_root,
class_trie_root
)
```
Where:
* `hPos` is the [Poseidon](/learn/protocol/cryptography/#poseidon_hash) hash function.
* `STARKNET_STATE_V0` is a constant prefix string encoded in ASCII (and represented as a field element).
* `contract_trie_root` is the root of the [*contract trie*](#contracts_trie), a Merkle-Patricia trie whose leaves are the contracts' states.
* `class_trie_root` is the root of the [*class trie*](#classes_trie), a Merkle-Patricia trie whose leaves are the compiled class hashes.
### The contract trie
As with Ethereum, this trie is a two-level structure, whose leaves correspond to distinct contracts. The address of each contract determines the path from the trie's root to its corresponding leaf, whose content encodes the contract's state.
The information stored in the leaf is as follows:
```
hPed(
hPed(
hPed(
class_hash,
storage_root
),
nonce
),
0
)
```
Where:
* `hPed` is the [Pedersen](/learn/protocol/cryptography/#hash-functions#pedersen_hash) hash function.
* `class_hash` is the hash of [the contract's definition](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).
* `storage_root` is the root of another Merkle-Patricia trie of height 251 that is constructed from the contract's storage.
* `nonce` is the current nonce of the contract.
### The class trie
The class trie encodes the information about all existing [classes](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html) in Starknet's state. This trie maps [class hashes](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html) to their compiled class hashes. The information stored in a leaf at a path corresponding to some class hash is as follows:
```text theme={null}
hPos(
CONTRACT_CLASS_LEAF_V0,
compiled_class_hash
)
```
Where:
* `hPos` is the [Poseidon](/learn/protocol/cryptography/#poseidon_hash) hash function
* `CONTRACT_CLASS_LEAF_V0` is a constant prefix string encoded in ASCII (and represented as a field element).
* `compiled_class_hash` is the hash of the Cairo assembly resulting from compiling the given class via the Sierra-to-Casm compiler.
<Note>
*Compiled class hash*
The compiled class hash identifies the output of a specific Casm compilation as unique.
Cairo classes that are part of the state commitment are defined with Sierra, an intermediate representation between Cairo and Cairo assembly (Casm). However, the prover only works with Casm.
So in order to prevent needing to compile from Sierra to Casm in every block in which the class is used, the state commitment must have some information about the corresponding Cairo assembly. The compiled class hash provides this information.
For more information, see [the Cairo Book](https://book.cairo-lang.org/appendix-09-sierra.html).
The party that declares the contract signs the compiled class hash, which they obtain using an SDK, as part of the [`DECLARE`](/learn/protocol/transactions/#transaction_types) transaction. If the transaction is included in a block, then the compiled class hash becomes part of the state commitment.
In the future, when Sierra-to-Casm compilation becomes part of the Starknet OS, this value might be updated via a proof of the Sierra-to-Casm compiler execution, showing that compiling the same class with a newer compiler version results in some new compiled class hash.
</Note>
### Merkle-Patricia trie
The state commitment scheme uses a binary Merkle-Patricia trie with the Pedersen hash function.
#### About nodes
Each node in the trie is represented by a triplet $\left(\right. l e n g t h , p a t h , v a l u e \left.\right)$, where:
| | |
| - | - |
| $l e n g t h$ | is the length of the path, measured in nodes. |
| $p a t h$ | is the path from the current node to its unique non-empty subtrie.<br /><br />$p a t h$ is an integer in the set $\{0, \ldots, 2^{\mathit{length}} - 1\}$, and the binary expansion of $p a t h$ indicates how to proceed along the trie, as follows:<br /><br />1. Expand $p a t h$ to its binary representation.<br /><br />2. Starting with the most significant bit, representing the root of the trie, traverse the tree node by node, where the bit values $0$ and $1$ indicate left and right, respectively. |
| $v a l u e$ | is the value of the node, which can be either data, or the hash of two non-empty child nodes. |
An empty node is one whose triplet values are $\left(\right. 0 , 0 , 0 \left.\right)$. Leaf nodes and internal nodes can be empty. A subtrie rooted at a node $\left(\right. l e n g t h , p a t h , v a l u e \left.\right)$ has a single non-empty subtrie, rooted at the node obtained by following the path specified by $p a t h$.
<Note>
Length is specified, and cannot be deduced from $p a t h$, because the numbers in the triplet $\left(\right. l e n g t h , p a t h , v a l u e \left.\right)$ are field elements of fixed size, 251 bits each.For a node where $l e n g t h > 0$, $p a t h$ leads to the highest node whose left and right children are not empty.
</Note>
#### Trie construction
The following rules specify how the trie is constructed from a given set of leaves:
The hash of a node $N = \left(\right. l e n g t h , p a t h , v a l u e \left.\right)$, denoted by $H \left(\right. N \left.\right)$, is:
$$
H(N) = \begin{cases}
\mathit{value}, & \text{if } \mathit{length} = 0 \\
h_{\mathit{red}}(\mathit{value}, \mathit{path}) + \mathit{length}, & \text{otherwise}
\end{cases}
$$
<Note>
All arithmetic operations in the above description of $H$ are done in the STARK field, as described in [The STARK field](/learn/protocol/cryptography/#stark-field).
</Note>
#### Mathematical definition of the nodes in the trie
The triplet representing the parent of the nodes $l e f t = \left(\right. ℓ_{L} , p_{L} , v_{L} \left.\right)$, $r i g h t = \left(\right. ℓ_{R} , p_{R} , v_{R} \left.\right)$ is defined as follows:
$$
\mathit{parent} =
\begin{cases}
(0, 0, 0), & \text{if } \mathit{left} = \mathit{right} = (0, 0, 0) \\
(\ell_L + 1, p_L, v_L), & \text{if } \mathit{right} = (0, 0, 0) \text{ and } \mathit{left} \neq (0, 0, 0) \\
(\ell_R + 1, p_R + 2^{\ell_R}, v_R), & \text{if } \mathit{right} \neq (0, 0, 0) \text{ and } \mathit{left} = (0, 0, 0) \\
(0, 0, h_{\mathit{red}}(H(\mathit{left}), H(\mathit{right}))), & \text{otherwise}
\end{cases}
$$
#### Example trie
The diagram [A three-level Merkle-Patricia trie](#3-level_trie) illustrates the construction of a three-level-high Merkle-Patricia trie from the leaves whose values are $\left(\right. 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 \left.\right)$:
<Frame>
<img />
</Frame>
Where $r = h_{P e d} \left(\right. H \left(\right. 2 , 2 , 1 \left.\right) , H \left(\right. \left(\right. 2 , 1 , 1 \left.\right) \left.\right)$. Notice that the example does not skip from the root, whose length is zero, so the final state commitment to the trie is $H \left(\right. \left(\right. 0 , 0 , r \left.\right) \left.\right) = r$.
Suppose that you want to prove, with respect to the state commitment just computed, that the value of the leaf whose path is given by $101$ is $1$. In a standard Merkle trie, the proof would consist of data from three nodes, which are siblings along the path to the root.
In a Merkle-Patricia trie, because the trie is sparse, you only need to send the two children of the root, which are $\left(\right. 2 , 2 , 1 \left.\right)$ and $\left(\right. 2 , 1 , 1 \left.\right)$. These two children are enough to reproduce the state commitment $r$, and because you know that the height of the trie is three, and that it is fixed, you know that the path $01$ of length $2$ specified by the right-hand child, $\left(\right. 2 , 1 , 1 \left.\right)$, leads to the desired leaf.
# STRK
Source: https://docs.starknet.io/learn/protocol/strk
## Overview
[Similar to other blockchains](#background), Starknet uses the STRK token for [paying fees to enable operation of the network, maintaining and securing the network by enabling staking for consensus, and deciding on Starknet's values and technology goals by voting for governance proposals](#purposes), of which [ten billion tokens are planned to or have already been distributed](#supply_and_distribution), as well as, further tokens minted through an inflation mechanism.
<Warning>
The primary purpose of the Starknet token, STRK, is to facilitate operations and activities on Starknet and it is not intended to serve as an investment.
</Warning>
Major economic mechanisms of STRK, also known as *tokenomics*, [are subject to change based on governance decisions made by the larger community of Starknet and are described here for informational purposes only](#risks_and_disclaimers).
<Tip>
For more details on Starknet's governance processes, see the [Starknet Governance Hub](https://governance.starknet.io/).
</Tip>
## Background
Blockchains are valuable because they are data structures maintained by diverse and, ideally, large groups of otherwise unaffiliated persons. This gives them resilience: Any one participant can disappear, but the data structure is preserved. This also gives them censorship resistance: No single person can unilaterally decide to forbid certain persons from using the network.
To achieve this, blockchains work through a combination of cryptography and economic incentives: Cryptography limits what actors in the system can do (for example, transactions must be validly signed to be included in the chain) and economic incentives encourage actors to voluntarily perform actions that maintain the network's capabilities when spending their own resources (for example, miners or stakers actively publish new blocks to the chain because they can receive fees and new tokens as a reward).
Starknet achieves secure low-cost transactions by using the STARK cryptographic proof system to reduce the size of transaction data while preserving and verifying the integrity of that data. To achieve resilience and censorship resistance, Starknet uses the STRK token to incentivize network participants to sequence transactions for users of the network and to ensure that there is a provably fair proof-of-stake mechanism to determine who should sequence and submit a proof for the network blocks.
## Purposes
* **Transaction fees:** Originally, fees in Starknet were paid only in Ether (ETH), which was followed by the functionality of paying fees for transactions on the network using both STRK, as well as ETH. As of the release of v.0.14.0 on September 1, 2025, transaction fees on Starknet can only be paid with STRK.\
A portion of the fees paid in STRK may be converted to ETH by the receiving sequencer, in order to cover Ethereum L1 gas costs, which, due to the specifications of the Ethereum protocol, must be paid in ETH.
* **Staking:** Certain services that are critical to the liveness and security of Starknet may require the staking of Starknet tokens. These services might be offered by multiple providers, and could include sequencing, reaching temporary L2 consensus before L1 finality is reached, STARK-proving services, and data availability provisioning, to name a few examples. Some of these [protocol changes](https://starkware.co/resource/starknet-decentralization-a-roadmap-in-broad-strokes/) are still under discussion within the larger governance community and are targeted for [2025 -2026](https://starkware.co/resource/starknet-decentralization-a-roadmap-in-broad-strokes/). As of the last update of this paper, staking is live and validators are required to attest blocks to ensure the network’s stability and security - for more information on Starknet staking, see [<u>here</u>](https://www.starknet.io/staking/).
* **Governance:** Proposals for improving Starknet might require a minimal token support threshold. Voting, either directly or via delegation, will be required for changes to the protocol that are essential to Starknet's liveness, security, and maintenance. Today, for example, major updates to the Starknet Operating System require the approval of token holders. For more information about Governance see the [Starknet Governance Hub](https://governance.starknet.io/)
<Warning>
As discussed above, the Starknet tokens are digital assets intended to support the operation and usage of Starknet and are not offered as an investment. As such, the Starknet tokens do not represent any equity in StarkWare or the Starknet Foundation, nor do they provide any participation right in StarkWare or grant any right of claim from StarkWare or the Starknet Foundation.
</Warning>
## Supply and distribution
Ten billion Starknet tokens were initially created by StarkWare in May 2022 and minted onchain on November 30, 2022.
The existing ten billion tokens have been or are planned to be distributed according to the following:
| | |
| - | - |
| **20.04%: Early Contributors** | Tokens allocated for StarkWare's team members and early contributors. These tokens are subject to a lock-up schedule, as further detailed below. |
| **18.17%: Investors** | Tokens allocated for StarkWare's investors. These tokens are subject to a lock-up schedule, as further detailed below. |
| **10.76%: StarkWare** | Tokens allocated for StarkWare for operation services such as to pay fees, provide other services on Starknet, and engage other service providers. |
| **12.93%: Grants including Development Partners (aka DPs)** | Tokens allocated for grants for research or work done to develop, test, deploy and maintain the Starknet protocol. The process for applications and allocations related to Starknet Foundation Grants will be outlined in a post at a later date. |
| **9.00%: Community Provisions** | Tokens distributed to those who contributed to Starknet and powered or developed its underlying technology. |
| **9.00%: Community Rebates** | Tokens allocated for rebates in Starknet tokens to partially cover the costs of onboarding to Starknet from Ethereum. |
| **10.00%: Foundation Strategic Reserves** | Tokens allocated for the Starknet Foundation to fund ecosystem activities that are aligned with the [Foundation's mission](https://www.starknet.io/en/content/introducing-the-starknet-foundation). |
| **8.10%: Foundation Treasury** | Token allocated for the Starknet Foundation's treasury available for operations and other future initiatives by the Starknet Foundation. |
| **2.00%: Donations** | Tokens reserved for donations to institutions and organizations, such as universities, NGOs, etc, as decided by the Starknet Foundation. |
<Frame>
<img alt="" />
</Frame>
To align long-term incentives of the Investors and Early Contributors with the interests of the Starknet community, and following common practice in decentralized ecosystems, all tokens allocated to Investors and Early Contributors is subject to the following lock-up schedule, where percentages are based on the total token supply:
* Up to 0.64% (64 million tokens) have been unlocked on the 15th of each month, starting April 15, 2024, and going through March 15, 2025, for a total of 7.68% (768 million tokens) unlocked by March 15, 2025.
* Up to 1.27% (127 million tokens) have been and will be unlocked on the 15th of each month, starting April 15, 2025, and going through March 15, 2027, for a total of 30.48% (3.048 billion tokens) unlocked by March 15, 2027.
<Frame>
<img alt="" />
</Frame>
<Note>
The above graph excludes newly circulating tokens resulting from inflation or staking (see below).Token allotments currently retained by the Starknet Foundation, while contractually unlocked, are not considered circulating unless granted, donated, or otherwise allocated out of originating wallets through future grants, provisions, donations, developer initiatives, or other programs.
</Note>
Through this lock-up period, token holders cannot transfer, sell, or pledge their STRK tokens. Delegation of voting is permitted with locked tokens. As of the last date of update of this paper, staking with locked tokens is not permitted.
The total supply of tokens increases over time with the minting of new tokens by the protocol, as staking rewards, block rewards, or other rewards associated with the staking process. Such minting is made pursuant to a schedule determined with the community (for further reading: [<u>here</u>](https://governance.starknet.io/voting-proposals/5) and [<u>here</u>](https://community.starknet.io/t/snip-18-staking-s-first-stage-on-starknet/114334)). The supply in circulation, therefore, does not remain fixed. However, as long as StarkWare is the sole operator of the Starknet sequencer, there will be no issuance of new tokens for the purpose of block rewards. For more information, see [*A token-minting proposal to manage inflation*](https://starkware.co/resource/a-token-minting-proposal-to-manage-inflation/).
## Risks and disclaimers
Starknet is a developing decentralized protocol and the economic mechanisms described herein are subject to change based on decisions made by the larger community of Starknet builders and users. Starknet relies upon third parties to adopt and implement software and protocols as users and contributors of Starknet. It also relies, in whole or partly, on third parties to develop, supply and otherwise support it. There is no assurance or guarantee that such third parties will continue to par프로젝트로 돌아가기