diff --git a/CHANGELOG.md b/CHANGELOG.md index ad71b88d0c..93491bfb00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,64 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.1.490](https://github.com/starknet-io/starknet-docs/compare/v0.1.489...v0.1.490) (2024-02-25) + +### [0.1.489](https://github.com/starknet-io/starknet-docs/compare/v0.1.488...v0.1.489) (2024-02-25) + +### [0.1.488](https://github.com/starknet-io/starknet-docs/compare/v0.1.487...v0.1.488) (2024-02-25) + +### [0.1.487](https://github.com/starknet-io/starknet-docs/compare/v0.1.486...v0.1.487) (2024-02-25) + +### [0.1.486](https://github.com/starknet-io/starknet-docs/compare/v0.1.485...v0.1.486) (2024-02-22) + +### [0.1.485](https://github.com/starknet-io/starknet-docs/compare/v0.1.484...v0.1.485) (2024-02-22) + +### [0.1.484](https://github.com/starknet-io/starknet-docs/compare/v0.1.483...v0.1.484) (2024-02-21) + +### [0.1.483](https://github.com/starknet-io/starknet-docs/compare/v0.1.482...v0.1.483) (2024-02-21) + +### [0.1.482](https://github.com/starknet-io/starknet-docs/compare/v0.1.481...v0.1.482) (2024-02-21) + +### [0.1.481](https://github.com/starknet-io/starknet-docs/compare/v0.1.480...v0.1.481) (2024-02-21) + +### [0.1.480](https://github.com/starknet-io/starknet-docs/compare/v0.1.479...v0.1.480) (2024-02-19) + +### [0.1.479](https://github.com/starknet-io/starknet-docs/compare/v0.1.478...v0.1.479) (2024-02-15) + +### [0.1.478](https://github.com/starknet-io/starknet-docs/compare/v0.1.477...v0.1.478) (2024-02-15) + +### [0.1.477](https://github.com/starknet-io/starknet-docs/compare/v0.1.476...v0.1.477) (2024-02-14) + +### [0.1.476](https://github.com/starknet-io/starknet-docs/compare/v0.1.475...v0.1.476) (2024-02-14) + + +### Bug Fixes + +* Minor edits to Economics-of-Starknet.adoc ([#1130](https://github.com/starknet-io/starknet-docs/issues/1130)) ([d00cfa6](https://github.com/starknet-io/starknet-docs/commit/d00cfa6f9aa3f9ebb42bd77e6c1bfc3c0fb830ae)) + +### [0.1.475](https://github.com/starknet-io/starknet-docs/compare/v0.1.474...v0.1.475) (2024-02-14) + +### [0.1.474](https://github.com/starknet-io/starknet-docs/compare/v0.1.473...v0.1.474) (2024-02-13) + +### [0.1.473](https://github.com/starknet-io/starknet-docs/compare/v0.1.472...v0.1.473) (2024-02-11) + + +### Bug Fixes + +* ignore fee token contract is the fee formula ([#1123](https://github.com/starknet-io/starknet-docs/issues/1123)) ([3863f6f](https://github.com/starknet-io/starknet-docs/commit/3863f6f693e3f3d06ee53f67cff4e7afb4334e13)) + +### [0.1.472](https://github.com/starknet-io/starknet-docs/compare/v0.1.471...v0.1.472) (2024-02-11) + +### [0.1.471](https://github.com/starknet-io/starknet-docs/compare/v0.1.470...v0.1.471) (2024-02-08) + +### [0.1.470](https://github.com/starknet-io/starknet-docs/compare/v0.1.469...v0.1.470) (2024-02-08) + +### [0.1.469](https://github.com/starknet-io/starknet-docs/compare/v0.1.468...v0.1.469) (2024-02-06) + +### [0.1.468](https://github.com/starknet-io/starknet-docs/compare/v0.1.467...v0.1.468) (2024-02-05) + +### [0.1.467](https://github.com/starknet-io/starknet-docs/compare/v0.1.466...v0.1.467) (2024-02-05) + ### [0.1.466](https://github.com/starknet-io/starknet-docs/compare/v0.1.465...v0.1.466) (2024-02-04) ### [0.1.465](https://github.com/starknet-io/starknet-docs/compare/v0.1.464...v0.1.465) (2024-02-04) diff --git a/_typos.toml b/_typos.toml index 74b5bc3b43..5a9abfe226 100644 --- a/_typos.toml +++ b/_typos.toml @@ -8,4 +8,3 @@ check-file = true [default.extend-words] # Don't correct the word afe = "afe" - diff --git a/components/Starknet/modules/ROOT/pages/index.adoc b/components/Starknet/modules/ROOT/pages/index.adoc index c89e55cf67..496047a2c1 100644 --- a/components/Starknet/modules/ROOT/pages/index.adoc +++ b/components/Starknet/modules/ROOT/pages/index.adoc @@ -1,10 +1,10 @@ [id="overview"] = Overview -Starknet is a permissionless, decentralized zero-knowledge rollup (ZK rollup) for Ethereum. It operates as a Layer 2 (L2) blockchain, enabling any dApp to achieve unlimited scale for its computation without compromising on Ethereum’s composability +Starknet is a permissionless, Validity-Rollup, also known as a zero-knowledge rollup (ZK rollup) for Ethereum. It operates as a Layer 2 (L2) blockchain, enabling any dApp to achieve massive scale for its computation without compromising on Ethereum’s composability and security. -Starknet achieves secure low cost transactions and high performance by using the STARK cryptographic proof system. Starknet contracts and the Starknet OS are written in link:https://github.com/starkware-libs/cairo[Cairo], a custom-built and +Starknet aims to achieves secure low cost transactions and high performance by using the STARK cryptographic proof system. Starknet contracts and the Starknet OS are written in link:https://github.com/starkware-libs/cairo[Cairo], a custom-built and specialized programming language. == Explore Starknet diff --git a/components/Starknet/modules/architecture_and_concepts/images/STRK_estimated_circulating_supply.jpg b/components/Starknet/modules/architecture_and_concepts/images/STRK_estimated_circulating_supply.jpg new file mode 100644 index 0000000000..11c16f3ae6 Binary files /dev/null and b/components/Starknet/modules/architecture_and_concepts/images/STRK_estimated_circulating_supply.jpg differ diff --git a/components/Starknet/modules/architecture_and_concepts/images/planned_distribution_STRK.jpg b/components/Starknet/modules/architecture_and_concepts/images/planned_distribution_STRK.jpg new file mode 100644 index 0000000000..4c6f9424ec Binary files /dev/null and b/components/Starknet/modules/architecture_and_concepts/images/planned_distribution_STRK.jpg differ diff --git a/components/Starknet/modules/architecture_and_concepts/nav.adoc b/components/Starknet/modules/architecture_and_concepts/nav.adoc index 5fefa2c823..8ad01d8911 100644 --- a/components/Starknet/modules/architecture_and_concepts/nav.adoc +++ b/components/Starknet/modules/architecture_and_concepts/nav.adoc @@ -22,7 +22,7 @@ *** xref:Accounts/simplified_transaction_flow.adoc[Simplified transaction flow] ** Contracts -*** xref:Smart_Contracts/contract-classes.adoc[Contract classes] +*** xref:Smart_Contracts/contract-classes.adoc[Contract classes and instances] *** xref:Smart_Contracts/class-hash.adoc[Class hash] *** xref:Smart_Contracts/contract-address.adoc[Contract address] *** xref:Smart_Contracts/contract-storage.adoc[Contract storage] @@ -38,3 +38,5 @@ *** xref:Cryptography/p-value.adoc[The STARK field] *** xref:Cryptography/stark-curve.adoc[The STARK curve] *** xref:Cryptography/hash-functions.adoc[Hash functions] + +* xref:Economics-of-Starknet.adoc[The Economics of Starknet] \ No newline at end of file diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Accounts/validate_and_execute.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/validate_and_execute.adoc index d3bdd7d561..5f33170f4a 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Accounts/validate_and_execute.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/validate_and_execute.adoc @@ -29,7 +29,7 @@ When the `__validate__` function fails, no fee will There are some limitations set on the `__validate__` function. The purpose of these limitations is twofold: -* We want to avoid the sequencer having to do a lot of work only to discover that the validation failed and the sequencer is then not eligible to charge a fee (if this was possible, the sequencer would be completely exposed to DOS attacks). Validation, while now abstract and in control of the account owner rather than the protocol, should still be a simple operation. This is why in the future, Starknet will place max steps limitation upon the `__validate__` function. +* We want to avoid the sequencer having to do a lot of work only to discover that the validation failed and the sequencer is then not eligible to charge a fee (if this was possible, the sequencer would be completely exposed to DOS attacks). Validation, while now abstract and in control of the account owner rather than the protocol, should still be a simple operation. This is why a maximum steps limitation on the `__validate__` function is currently in place on the Starknet network. For more information, see xref:tools:limits_and_triggers.adoc[Current limits]. * Even if the validation is simple, we could still face the following attack: ** An attacker fills the mempool with transactions that are valid at time T. diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/hash-functions.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/hash-functions.adoc index a1a6dfa15c..e0aa79dbce 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/hash-functions.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/hash-functions.adoc @@ -108,4 +108,4 @@ H\big(a_3,...,a_n;\text{hades}(s_1+a_1, s_2+a_2, s_3)\big), & \text{if } n\ge 2 ++++ For an implementation of the above in Python, see link:https://github.com/starkware-libs/cairo-lang/blob/12ca9e91bbdc8a423c63280949c7e34382792067/src/starkware/cairo/common/poseidon_hash.py#L46[poseidon_hash.py], -and for an equivalent Cairo implementation, see link:https://github.com/starkware-libs/cairo-lang/blob/12ca9e91bbdc8a423c63280949c7e34382792067/src/starkware/cairo/common/builtin_poseidon/poseidon.cairo#L28[poseidon.cairo] in the cairo-lang Github repository. +and for an equivalent Cairo implementation, see link:https://github.com/starkware-libs/cairo-lang/blob/12ca9e91bbdc8a423c63280949c7e34382792067/src/starkware/cairo/common/builtin_poseidon/poseidon.cairo#L28[poseidon.cairo] in the cairo-lang GitHub repository. diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Economics-of-Starknet.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Economics-of-Starknet.adoc new file mode 100644 index 0000000000..02ed2c6307 --- /dev/null +++ b/components/Starknet/modules/architecture_and_concepts/pages/Economics-of-Starknet.adoc @@ -0,0 +1,90 @@ +[id="economics_of_starknet"] += The token economics of Starknet +:description: How token economics work in a block chain in general, and specifically in Starknet. The purpose of the Starknet token, its supply, and distribution. +:keywords: tokenomics, STRK, token economics, economic mechanisms of Starknet + +Starknet is a developing decentralized protocol and the economic mechanisms described here, also known as tokenomics, are subject to change based on governance decisions made by the larger community of Starknet. For more details on Starknet’s governance processes see the link:https://governance.starknet.io/[Starknet Governance Hub]. This document describes certain economic fundamentals of the Starknet token. This document is intended for informational purposes only and is meant to outline the usage and functionalities of the asset within Starknet. It is important to understand that 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. + + +[#why_are_economics_relevant] +== Why are economics relevant? + +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. 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. 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. + +Starknet operates as a Layer 2 (L2) network on top of Ethereum. Today, 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. Still under development, Starknet will achieve resilience and censorship resistance by using a token, the Starknet token (STRK), to incentivize network participants to sequence transactions for users of the network and to ensure that there is a provably fair mechanism, a proof-of-stake mechanism, to determine who should sequence and submit a proof for the network blocks. A proof-of-stake mechanism might also be used to facilitate data availability solutions and other significant services required for network operations. + +[#purpose_of_the_token] +== The purpose of the STRK token + +The Starknet token is the mechanism 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. + +* *Transaction fees:* Originally, fees in Starknet were paid only in Ether (ETH). As of v.0.13.0, fees for transactions on the network can be paid for using the Starknet token, as well as Ether. + +* *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. These https://starkware.co/resource/starknet-decentralization-a-roadmap-in-broad-strokes/[protocol changes] are still under discussion within the larger governance community and are targeted for https://starkware.co/resource/starknet-decentralization-a-roadmap-in-broad-strokes/[2024 -2025]. + +* *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 https://governance.starknet.io/[Starknet Governance Hub] + +[IMPORTANT] +==== +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. +==== + + +[#supply_and_distribution] +== 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: + +[cols="1,2",] +|=== +// |Percentage of total| Recipients | Details + +|*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. Community rebates are not yet available and will be announced in 2024 in a subsequent post. +|*10.00%: Foundation Strategic Reserves* |Tokens allocated for the Starknet Foundation to fund ecosystem activities that are aligned with the https://www.starknet.io/en/content/introducing-the-starknet-foundation[Foundation’s mission]. +|*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. +|=== + +image:planned_distribution_STRK.jpg[Planned distribution of STRK] + +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) will be 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) 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. + + +Through this lock-up period, token holders cannot transfer, sell, or pledge their STRK tokens. Delegation of voting is permitted with locked tokens and, when available, staking might also be permitted. + +The total circulating supply of tokens is planned to increase 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 will be made pursuant to a schedule that will be determined with the community at a later point, not before Starknet services are more decentralized. The supply in circulation might not, therefore, 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 link:https://starkware.co/resource/a-token-minting-proposal-to-manage-inflation/[_A token-minting proposal to manage inflation_]. + +[#risks_and_disclaimers] +== 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 participate in the network or that the network will continue to function as intended. + +The technical documents provided herein describe certain planned and specified economic fundamentals of a digital asset, STRK. These materials are intended for informational purposes only and are meant to outline the usage and functionalities of the asset within Starknet. It is important to understand that the primary purpose of STRK is to pay for fees, provide a mechanism for securing consensus, and allow for decentralized governance on Starknet; it is not intended to serve as an investment. + +Starknet relies upon third parties to adopt and implement the software and protocols as users of Starknet. It also relies, in whole or partly, on third parties to develop, supply and otherwise support it. As a Layer 2 network over Ethereum, Starknet also relies upon third parties maintaining and operating the Ethereum network. There is no assurance or guarantee that those third parties will complete their work, properly carry out their obligations, and/or otherwise meet anyone’s needs. + +STRK, as the native token of Starknet, may be subject to the risks of the Starknet network, including, without limitation, the following: (i) the technology associated with Starknet may not function as intended; (ii) the details of the Starknet token economics including the total supply and distribution schedule may be changed due to decisions made by the consensus of participants of the Starknet network; (iii) Starknet may fail to attract sufficient interest from key stakeholders or users; (iv) Starknet may not progress satisfactorily and Starknet tokens may not be useful or valuable; (v) Starknet may suffer from attacks by hackers or other individuals; and (vi) Starknet is comprised of open-source technologies that depend on a network of computers to run certain software programs to process transactions, and because of this model StarkWare and the Starknet Foundation have limited control over Starknet. + +Risks related to blockchain technology in general and Starknet in particular may impact the usefulness of Starknet, and, in turn, the utility or value of STRK. The software and hardware, technology and technical concepts and theories applicable to Starknet and STRK are still in an early development stage and unproven, there is no warranty that Starknet will achieve any specific level of functionality or success, nor that the underlying technology will be uninterrupted or error-free, and there is an inherent risk that the technology could contain weaknesses, vulnerabilities or bugs causing, potentially, the complete loss of any Starknet tokens held by Starknet users. + +As with most commonly used public blockchains, STRK is accessed using a private key that corresponds to the address at which they are stored. If the private key, or the "seed" used to create the address and corresponding private key are lost or stolen, the tokens associated with that address might be unrecoverable and will be permanently lost. + +Public blockchain-based systems, including Starknet and the underlying Ethereum network, depend on independent verifiers, and therefore may be vulnerable to consensus attacks including, but not limited to, double-spend attacks, majority voting power attacks, race condition attacks, and censorship attacks. These attacks, if successful, could result in the permanent loss of STRK. + +Starknet, STRK, and blockchain technology are nascent, and there may be additional risks not described above or that may be new or unanticipated. We recommend only using Starknet or holding STRK if you are familiar with the technology and aware of the risks. + +This document and its contents are not, and should not be construed as, an offer to sell, or the solicitation of an offer to buy, any tokens, nor should it or any part of it form the basis or be relied on in connection with any contract or commitment whatsoever. This document is not advice of any kind, including legal, investment, financial, tax, or any other professional advice. Nothing in this document should be read or interpreted as a guarantee or promise of how the Starknet network or its STRK will develop, be utilized, or accrue value. + +All information in this document is provided on an “as is” basis without any representation or warranty of any kind. This document only outlines current plans, which could change at the discretion of various parties, and the success of which will depend on many factors outside of Starknet Foundation’s control. Such future statements necessarily involve known and unknown risks, which may cause actual performance and results in future periods to differ materially from what we have described or implied in this document. StarkWare and the Starknet Foundation disclaim all warranties, express or implied, to the fullest extent permitted by law with respect to the functionality of Starknet and STRK. diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/fee-mechanism.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/fee-mechanism.adoc index 2647cfb497..5e543647d0 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/fee-mechanism.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/fee-mechanism.adoc @@ -21,8 +21,8 @@ The following formula describes the overall fee, stem:[F], for a transaction: ++++ \begin{align} F = \text{gas_price}\cdot&\Bigg(\max_k v_k w_k + \\ -& + \; \text{da_calldata_cost}\left(2n+2(m-1) + \ell + 3t + \sum\limits_{i=1}^t q_i\right)\\ -& - \; \text{contract_update_discount}\cdot n - 240 \\ +& + \; \text{da_calldata_cost}\left(2(n-1)+2(m-1) + \ell + 3t + \sum\limits_{i=1}^t q_i\right)\\ +& - \; \text{contract_update_discount}\cdot (n-1) - 240 \\ & + \; \text{message_calldata_cost}\cdot\left(3t + \sum\limits_{i=1}^t q_i\right) \\ & + \; \text{storage_write_cost}\cdot t\Bigg) \end{align} @@ -33,8 +33,8 @@ where: * stem:[$v$] is a vector that represents resource usage, where each of its entries, stem:[$v_k$], corresponds to different resource types: Cairo steps and number of applications of each builtin. + For more information see xref:#calculation_of_computation_costs[Calculation of computation costs]. -* stem:[$n$] is xref:#storage_updates[the number of unique contracts updated], which also includes changes to classes of existing contracts and contract deployments, even if the storage of the newly deployed contract is untouched. In other words, stem:[$n\ge\ell$]. -* stem:[$m$] is the number of values updated, not counting multiple updates for the same key. Notice that stem:[$m\ge 1$] is always true, because the sequencer's balance is always updated, which does not incur any fee. +* stem:[$n$] is xref:#storage_updates[the number of unique contracts updated], which also includes changes to classes of existing contracts and contract deployments, even if the storage of the newly deployed contract is untouched. In other words, stem:[$n\ge\ell$]. Notice that stem:[$n\ge 1$] always holds, because the fee token contract is always updated, which does not incur any fee. +* stem:[$m$] is the number of values updated, not counting multiple updates for the same key. Notice that stem:[$m\ge 1$] always holds, because the sequencer's balance is always updated, which does not incur any fee. * stem:[$t$] is the number of L2->L1 messages sent, where the corresponding payload sizes are denoted by stem:[$q_1,...,q_t$]. * stem:[$\ell$] is the number of contracts whose class was changed, which happens on contract deployment and when applying the `replace_class` syscall. * stem:[$w$] is the xref:#calculation_of_computation_costs[`CairoResourceFeeWeights`] vector. @@ -185,7 +185,7 @@ The following formula describes the storage update fee for a transaction: [stem] ++++ -\underbrace{\textit{gas_price}\left(\text{da_calldata_cost} \cdot 2n - \text{contract_update_discount}\cdot n\right)}_{\text{contract addresses + new nonce and number of storage updates +\underbrace{\textit{gas_price}\left(\text{da_calldata_cost} \cdot 2(n-1) - \text{contract_update_discount}\cdot (n-1)\right)}_{\text{contract addresses + new nonce and number of storage updates }} \\ + \\ @@ -195,7 +195,7 @@ The following formula describes the storage update fee for a transaction: where: -* stem:[$n$] is xref:#storage_updates[the number of unique contracts updated], which also includes changes to classes of existing contracts and contract deployments, even if the storage of the newly deployed contract is untouched. In other words, stem:[$n\ge\ell$]. +* stem:[$n$] is xref:#storage_updates[the number of unique contracts updated], which also includes changes to classes of existing contracts and contract deployments, even if the storage of the newly deployed contract is untouched. In other words, stem:[$n\ge\ell$]. Notice that stem:[$n\ge 1$] always holds, because the fee token contract is always updated at the end of each transaction, in order to update the sequencer's and the sender's balances. The fee token contract update is not taken into account when computing the fee. * stem:[$m$] is the number of values updated, not counting multiple updates for the same key. Notice that stem:[$m\ge 1$] always holds, because the sequencer's balance is updated at the end of each transaction. The sequencer's balance update is not taken into account when computing the fee. * stem:[\text{contract_update_discount}] is 312 gas, which is discounted for every updated contract. This discount is a result of the fact that out of the stem:[$2n$] words caused by updating contracts, stem:[$n$] words are short, including at most 6 non-zero bytes: + diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/transaction-life-cycle.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/transaction-life-cycle.adoc index f53fd20401..3996aaefcc 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/transaction-life-cycle.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/transaction-life-cycle.adoc @@ -39,19 +39,24 @@ The following are the possible statuses of a transaction from the moment a user |Status type |Status |Explanation .5+|*Finality* |`NOT_RECEIVED` |The transaction is not yet known to the sequencer. -|`RECEIVED` |The transaction was received by the mempool. The transaction now either executes successfully, is rejected, or reverted. -|`REJECTED` |The transaction was received by the mempool but failed validation in the sequencer. Such transactions are not included in a block. +|`RECEIVED` a|The transaction was received by the mempool. The transaction now either executes successfully, is rejected, or reverted. + +The transaction has no execution status. +|`REJECTED` a|The transaction was received by the mempool but failed validation in the sequencer. Such transactions are not included in a block. + +The transaction has no execution status. + + +[NOTE] +==== +A `REJECTED` transaction is stored in the mempool. You cannot send another transaction with the same transaction hash. +==== |`ACCEPTED_ON_L2` |The transaction was executed and entered an actual created block on L2. |`ACCEPTED_ON_L1` |The transaction was accepted on Ethereum. .2+|*Execution* |`REVERTED` |The transaction passed validation but failed during execution in the sequencer. It is included in the block with the status `REVERTED`. |`SUCCEEDED` |The transaction was successfully executed by the sequencer. It is included in the block. |=== -[NOTE] -==== -If the finality status of a transaction is `RECEIVED` or `REJECTED`, the transaction does not have an execution status. -==== - [id="transaction-state-implications"] == State implications of a reverted transaction diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-classes.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-classes.adoc index 627dd72d67..29076e1e90 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-classes.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-classes.adoc @@ -1,15 +1,15 @@ [id="contract_classes"] -= Contract classes += Contract classes and instances As in object-oriented programming, Starknet distinguishes between a contract and its implementation by separating contracts into classes and instances. -== Contract Classes +== Contract classes A _contract class_ is the definition of a contract. It includes 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. -== Contract Instances +== Contract instances 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. @@ -20,7 +20,9 @@ A contract class does not necessarily have a deployed instance in Starknet. A contract class does not necessarily require a deployed instance in Starknet. ==== -== Working with Classes +A contract instance has a nonce, the value of which is the number of transactions originating from this address plus 1. For example, when you deploy an account with a `DEPLOY_ACCOUNT` transaction, the nonce of the account contract in the transaction is `0`. After the `DEPLOY_ACCOUNT` transaction, until the account contract sends its next transaction, the nonce is `1`. + +== Working with classes [horizontal,labelwidth=20,role="stripes-odd"] Adding new classes:: To introduce new classes to Starknet's state, use the `DECLARE` transaction. @@ -29,7 +31,7 @@ Deploying instances:: To deploy a new instance of a previously declared class, u 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 +== 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] diff --git a/components/Starknet/modules/quick_start/pages/set_up_an_account.adoc b/components/Starknet/modules/quick_start/pages/set_up_an_account.adoc index 88a216fc80..de9ae92257 100644 --- a/components/Starknet/modules/quick_start/pages/set_up_an_account.adoc +++ b/components/Starknet/modules/quick_start/pages/set_up_an_account.adoc @@ -104,7 +104,7 @@ starkli account fetch --output ~/.starkli-wallets/deploye You can obtain access to a JSON-RPC endpoint in one of the following ways: -- Host your own node with Pathfinder, Juno, or Papyrus. +- Host your own node with Pathfinder, Juno, Deoxys, or Papyrus. - Use a third-party JSON-RPC API provider. For information on providers, see xref:tools:api-services.adoc[Full nodes and API services]. The following command shows the details of the account descriptor: diff --git a/components/Starknet/modules/starknet_versions/pages/deprecated.adoc b/components/Starknet/modules/starknet_versions/pages/deprecated.adoc index 32e1849d41..3f321b1c28 100644 --- a/components/Starknet/modules/starknet_versions/pages/deprecated.adoc +++ b/components/Starknet/modules/starknet_versions/pages/deprecated.adoc @@ -46,7 +46,7 @@ Support for Starknet CLI will be removed in Starknet v0.13.0. |=== |Name|Description -| Starknet feeder gateway a| The Starknet feeder gateway, a temporary solution for querying the sequencer’s state, is being replaced by Starknet full nodes (Pathfinder, Juno, Papyrus) and RPC services. For more information, see xref:tools:api-services.adoc[Full nodes and API services]. +| Starknet feeder gateway a| The Starknet feeder gateway, a temporary solution for querying the sequencer’s state, is being replaced by Starknet full nodes (Pathfinder, Juno, Deoxys, Papyrus) and RPC services. For more information, see xref:tools:api-services.adoc[Full nodes and API services]. Support for the feeder gateway queries that are not required for full nodes to synchronize on the state of Starknet will stop according to the following schedule: diff --git a/components/Starknet/modules/starknet_versions/pages/pathfinder_versions.adoc b/components/Starknet/modules/starknet_versions/pages/pathfinder_versions.adoc index 9038c72ba9..4cc5da7c20 100644 --- a/components/Starknet/modules/starknet_versions/pages/pathfinder_versions.adoc +++ b/components/Starknet/modules/starknet_versions/pages/pathfinder_versions.adoc @@ -12,7 +12,7 @@ It provides the following features: * Run Starknet functions without requiring a Starknet transaction * Ability to do fee estimation for transactions -See the official https://github.com/eqlabs/pathfinder[Pathfinder Github repository] for more details. +See the official https://github.com/eqlabs/pathfinder[Pathfinder GitHub repository] for more details. ## [0.6.6] - 2023-07-10 (latest) diff --git a/components/Starknet/modules/starknet_versions/pages/version_notes.adoc b/components/Starknet/modules/starknet_versions/pages/version_notes.adoc index 8545547437..21d62a39ed 100644 --- a/components/Starknet/modules/starknet_versions/pages/version_notes.adoc +++ b/components/Starknet/modules/starknet_versions/pages/version_notes.adoc @@ -31,7 +31,7 @@ Starknet 0.13.0 includes the following changes: * v3 transactions, including: ** Fee payment in STRK ** Reserved fields for future features, such as Volition and payment master -* `get_block` API: The `gas_price` field is replaced by the `eth_l1_gas_price` and `strk_l1_gas_price` fields. This change applies also to existing blocks. For more information on the new fields, see the link:https://github.com/starkware-libs/starknet-specs/releases/tag/v0.6.0[JSON RPC API Spec on Github] +* `get_block` API: The `gas_price` field is replaced by the `eth_l1_gas_price` and `strk_l1_gas_price` fields. This change applies also to existing blocks. For more information on the new fields, see the link:https://github.com/starkware-libs/starknet-specs/releases/tag/v0.6.0[JSON RPC API Spec on GitHub] * Sierra v1.4.0. This new version of Sierra is part of Crate v2.4.0, in the Cairo 2.4.0 package. For more information, see link:https://community.starknet.io/t/cairo-v2-4-0-is-out/109275[Cairo v2.4.0 is out!] on the Community forum. * Improved performance of `secp256k1_mul` and `secp256r1_mul` syscalls * Computation cost is reduced by approximately 50% as a result of reduced Cairo steps and increased use of builtins. L1 data availability cost is reduced by approximately 10%-25%. For an ERC-20 transfer, the DA fee reduction is 25%. diff --git a/components/Starknet/modules/tools/nav.adoc b/components/Starknet/modules/tools/nav.adoc index 71367c2421..fee7f4a9b1 100644 --- a/components/Starknet/modules/tools/nav.adoc +++ b/components/Starknet/modules/tools/nav.adoc @@ -15,7 +15,7 @@ ** xref:ref_block_explorers.adoc[Block explorers] ** xref:audit.adoc[Audit providers] -** StarkGate bridge developer's guide +** StarkGate bridge guide *** xref:starkgate-bridge.adoc[Overview] *** xref:starkgate_architecture.adoc[StarkGate architecture] *** Procedures diff --git a/components/Starknet/modules/tools/pages/api-services.adoc b/components/Starknet/modules/tools/pages/api-services.adoc index 6d756d0217..2dded9248f 100644 --- a/components/Starknet/modules/tools/pages/api-services.adoc +++ b/components/Starknet/modules/tools/pages/api-services.adoc @@ -2,7 +2,7 @@ A list of recommended full-nodes, open API endpoints, and API providers. -For complete information on the Starknet Node API in JSON RPC format, see link:https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json[`starknet_api_openrpc.json`] on Github. +For complete information on the Starknet Node API in JSON RPC format, see link:https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json[`starknet_api_openrpc.json`] on GitHub. .API providers [cols="1,2,2",stripes=even] @@ -32,7 +32,7 @@ Starknet JSON-RPC version endpoints] |https://www.lavanet.xyz/[Lava Protocol] |https://www.lavanet.xyz/get-started/starknet[https://www.lavanet.xyz/get-started/starknet] | |https://data.voyager.online/[Nethermind] |https://data.voyager.online/[https://data.voyager.online] a| https://docs.data.voyager.online/spec[RPC spec versions] - +|link:https://nownodes.io/starknet[NOWNodes]| | |https://www.reddio.com/node[Reddio] | | |=== @@ -47,6 +47,7 @@ https://docs.data.voyager.online/spec[RPC spec versions] [%header,cols="2,2,1"] |=== | Provider name | Description | More information +|Deoxys|A Starknet full-node written in Rust and powered by Substrate by Kasar |link:https://github.com/kasarlabs/deoxys[github.com/kasarlabs/deoxys] |Juno|A Starknet full-node written in go-lang by Nethermind |link:https://github.com/NethermindEth/juno[github.com/NethermindEth/juno] |Papyrus|A Starknet full-node written in Rust by StarkWare | link:https://github.com/starkware-libs/papyrus[github.com/starkware-libs/papyrus] |Pathfinder|A Starknet full-node written in Rust by Equilibrium |link:https://github.com/eqlabs/pathfinder[github.com/eqlabs/pathfinder] diff --git a/components/Starknet/modules/tools/pages/important_addresses.adoc b/components/Starknet/modules/tools/pages/important_addresses.adoc index fa0db685eb..16ddba419c 100644 --- a/components/Starknet/modules/tools/pages/important_addresses.adoc +++ b/components/Starknet/modules/tools/pages/important_addresses.adoc @@ -25,11 +25,22 @@ The Starknet Core Contract:: link:https://sepolia.etherscan.io/address/0xE2Bb56e Verifier address:: link:https://sepolia.etherscan.io/address/0x07ec0D28e50322Eb0C159B9090ecF3aeA8346DFe[`0x07ec0D28e50322Eb0C159B9090ecF3aeA8346DFe`^] Sequencer base URL for API routing:: \https://alpha-sepolia.starknet.io -== Starknet fee token +== Starknet fee tokens -The Starknet fee token is currently ETH. +The Starknet fee tokens are STRK and ETH. -This address is the same for testnet and Mainnet. + + + +[horizontal, labelwidth="15",role="stripes-odd"] +L2 STRK address (Mainnet and testnet):: link:https://starkscan.co/contract/0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d[`0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d`] +L2 ETH address (Mainnet and testnet):: link:https://starkscan.co/contract/0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7[`0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7`] + +== Starknet voting token + +The Starknet voting token is vSTRK. For information on vSTRK, see link:https://governance.starknet.io/learn/vstrk_overview[_vSTRK overview_] on the Starknet Governance Hub. [horizontal, labelwidth="15",role="stripes-odd"] -L2 token address:: link:https://starkscan.co/contract/0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7[`0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7`] \ No newline at end of file +Mainnet address:: link:https://starkscan.co/contract/0x0782f0ddca11d9950bc3220e35ac82cf868778edb67a5e58b39838544bc4cd0f[`0x0782f0ddca11d9950bc3220e35ac82cf868778edb67a5e58b39838544bc4cd0f`] +Sepolia testnet address:: link:https://starkscan.co/contract/0x035c332b8de00874e702b4831c84b22281fb3246f714475496d74e644f35d492[`0x035c332b8de00874e702b4831c84b22281fb3246f714475496d74e644f35d492`] +Goerli testnet address:: link:https://starkscan.co/contract/0x01a881a75bb478cedfd4d3ea19d2a4564350d78ea463a5287833526a416d5e31[`0x01a881a75bb478cedfd4d3ea19d2a4564350d78ea463a5287833526a416d5e31`] diff --git a/components/Starknet/modules/tools/pages/limits_and_triggers.adoc b/components/Starknet/modules/tools/pages/limits_and_triggers.adoc index 25dd1c40fd..359f811a56 100644 --- a/components/Starknet/modules/tools/pages/limits_and_triggers.adoc +++ b/components/Starknet/modules/tools/pages/limits_and_triggers.adoc @@ -28,15 +28,20 @@ This limit is important for ensuring the efficient execution of transactions and |Max Cairo steps for `validate`| The maximum number of computational steps, measured in Cairo steps, for a `validate` function. | 1,000,000 | 1,000,000 |1,000,000 -|Max contract bytecode size (No of felts in the program)| The maximum size of the bytecode or program that a smart contract can have on Starknet. +|Max contract bytecode size (Number of felts in the program)| The maximum size of the bytecode or program that a smart contract can have on Starknet. Bytecode is the low-level code that comprises smart contracts. Limiting this size helps manage the complexity of contracts and the overall efficiency of the network. -| 61,440 | 61,440 | 61,440 +| 81,290 | 81,290 | 81,290 |Max contract class size|The maximum size for a contract class within Starknet. Contract classes are a fundamental building block for smart contracts, and limiting their size can have implications for the network's scalability and security. -| 20MB | 20MB | 20MB +| 4,089,446 bytes +| 4,089,446 bytes +| 4,089,446 bytes + |IP address limits (read/write)| In order to reduce network spam, Starknet limits the amount of contract reads and writes that a single IP address can make. | 200 per min per IP address| 200 per min per IP address|200 per min per IP address +| Signature length (felts) | | 4,000 | 4,000 | 4,000 +| Calldata length (felts) | | 4,000 | 4,000 | 4,000 |=== diff --git a/components/Starknet/modules/tools/pages/starkgate-adding_a_token.adoc b/components/Starknet/modules/tools/pages/starkgate-adding_a_token.adoc index 6b3d87b7db..05cb9822a0 100644 --- a/components/Starknet/modules/tools/pages/starkgate-adding_a_token.adoc +++ b/components/Starknet/modules/tools/pages/starkgate-adding_a_token.adoc @@ -22,7 +22,7 @@ Be aware of the following: * The L2 ERC-20 contract is a standard contract, so it is not recommended to add tokens with non-standard behavior, such as inflationary tokens. -* Adding a token that requires a customized bridging mechanism or a non-standard ERC-20 contract on L2 is currently not permissionless, and can be done only by the StarkWare team. Please contact StarkWare on the link:https://community.starknet.io/[Starknet Community Forum] and link:https://discord.com/invite/qypnmzkhbc[Discord channel]. +* Adding a token that requires a customized bridging mechanism or a non-standard ERC-20 contract on L2 is currently not permissionless, and can be done only by the StarkWare team. Please contact StarkWare at support@starknetcommunity.io. == Additional resources diff --git a/components/Starknet/modules/tools/pages/starkgate-bridge.adoc b/components/Starknet/modules/tools/pages/starkgate-bridge.adoc index 66c32d65fb..a037b34fb9 100644 --- a/components/Starknet/modules/tools/pages/starkgate-bridge.adoc +++ b/components/Starknet/modules/tools/pages/starkgate-bridge.adoc @@ -16,7 +16,7 @@ include::partial$snippet_backwards_compatibiity_note.adoc[] StarkGate supports many tokens, including ETH, WBTC, USDC, DAI, and many more. -For a comprehensive list of tokens that StarkGate supports, see the JSON files in the Starknet Github repository shown in the table xref:#table_StarkGate_token_addresses[]. +For a comprehensive list of tokens that StarkGate supports, see the JSON files in the Starknet GitHub repository shown in the table xref:#table_StarkGate_token_addresses[]. [#table_StarkGate_token_addresses] .StarkGate bridged tokens diff --git a/components/Starknet/modules/tools/pages/starkgate-estimating_fees.adoc b/components/Starknet/modules/tools/pages/starkgate-estimating_fees.adoc index b8d1b2ba4d..6d2186a704 100644 --- a/components/Starknet/modules/tools/pages/starkgate-estimating_fees.adoc +++ b/components/Starknet/modules/tools/pages/starkgate-estimating_fees.adoc @@ -1,7 +1,9 @@ [id="starkgate_estimating_fees"] = Estimating StarkGate fees -StarkGate enforces a minimum fee for all transactions. You can estimate what the fee using the following L1 functions: +StarkGate enforces a minimum fee for all transactions to account for the L1 -> L2 message costs. For more information, see xref:architecture_and_concepts:Network_Architecture/messaging-mechanism.adoc#l1-l2-message-fees[L1 -> L2 message fees]. + +You can estimate the fee using the following L1 functions: [horizontal,labelwidth="25",role="stripes-odd"] `estimateDepositFeeWei`:: Estimates the fee for a deposit transaction. diff --git a/components/Starknet/modules/tools/pages/starkgate_architecture.adoc b/components/Starknet/modules/tools/pages/starkgate_architecture.adoc index 7f7adb6b2a..f2bc5343b7 100644 --- a/components/Starknet/modules/tools/pages/starkgate_architecture.adoc +++ b/components/Starknet/modules/tools/pages/starkgate_architecture.adoc @@ -38,6 +38,17 @@ The _StarkGate Registry_:: * contains the addresses to all supported bridges * enables a bridge developer to stop servicing an existing bridge +[#stark_gate_withdrawal_limit] +== Withdrawal limit + +By default, StarkGate imposes no limit on withdrawals. However, in order to mitigate risks associated with critical vulnerabilities that could result in the loss of user funds, StarkGate can enable a withdrawal limit. + +If a serious security issue arises, the security agent in the StarkGate contract can limit withdrawals to 5% of the Total Value Locked (TVL) per day for any affected token by calling the `setWithdrawLimitPCT()` function in the `WithdrawalLimit.sol` contract. A dedicated team can then investigate and resolve the issue. + +Only a security admin quorum can disable the withdrawal limit. The quorum will consist of Starknet Foundation members, Starknet ecosystem contributors, and StarkWare representatives. This diverse group will ensure that decisions reflect the Starknet community's broad interests. + +This approach, blending manual oversight with automated detection, aims to minimize potential losses. + == Additional resources @@ -46,5 +57,7 @@ The _StarkGate Registry_:: * The xref:starkgate_function_reference.adoc[_StarkGate function reference_]. Lists functions exposed by the Registry, Manager, and the bridge itself, including: ** xref:starkgate_function_reference.adoc#getBridge[`getBridge`] ** xref:starkgate_function_reference.adoc#enrollTokenBridge[`enrollTokenBridge`] -** L1 contracts on Github -** L2 contracts on Github \ No newline at end of file +** L1 contracts on GitHub +** L2 contracts on GitHub +// Awaiting final URL. +// * link:https://github.com/starknet-io/starkgate-contracts/blob/d62a255307d2f3de65665f18316766a2c69ead78/src/solidity/WithdrawalLimit.sol#L20[`setWithdrawLimitPCT`] in `WithdrawalLimit.sol` diff --git a/package-lock.json b/package-lock.json index a9d010409a..f20a31d1fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "starknet-docs", - "version": "0.1.466", + "version": "0.1.490", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.1.466", + "version": "0.1.490", "dependencies": { "@antora/lunr-extension": "^1.0.0-alpha.8", "@asciidoctor/tabs": "^1.0.0-beta.3", diff --git a/package.json b/package.json index 1498e02b16..4e16460cdf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "starknet-docs", - "version": "0.1.466", + "version": "0.1.490", "private": true, "scripts": { "pre-release": "standard-version --prerelease --skip.changelog --releaseCommitMessageFormat 'chore(prerelease): {{currentTag}}'",