Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
JameStark committed Aug 15, 2023
2 parents 92163d6 + c22797e commit 2328e5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
[id="block_structure"]
= Block structure

In Starknet, the block is defined as a list of transactions and a block header.
In Starknet, the block is defined as a list of transactions and a block header containing the following fields:

[id="block_header"]
== Block header

The following fields define the block header:

[%autowidth]
|===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The contract address is a unique identifier of the contract on Starknet. It is a

* `prefix` - The ASCII encoding of the constant string `STARKNET_CONTRACT_ADDRESS`.
* `deployer_address` - The deployer address, unless `deploy_from_zero` is `true`, in which case it is `0`.
* `salt` - The salt passed by the contract calling the syscall.
* `salt` - The salt passed by the contract calling the syscall, provided by the transaction sender.
* `class_hash` - See xref:./class-hash.adoc#computing_the_cairo_1_class_hash[the class hash documentation].
* `constructor_calldata_hash` - xref:Cryptography/hash-functions.adoc#pedersen_array_hash[Array hash] of the inputs to the constructor.

Expand All @@ -21,6 +21,13 @@ contract_address := pedersen(
constructor_calldata_hash)
----

[NOTE]
====
A random `salt` ensures unique addresses for smart contract deployments, preventing conflicts when deploying identical contract classes.
It also thwarts replay attacks by influencing the transaction hash with a unique sender address.
====

You can find more detail of the address computation in the https://github.com/starkware-libs/cairo-lang/blob/ed6cf8d6cec50a6ad95fa36d1eb4a7f48538019e/src/starkware/starknet/services/api/gateway/contract_address.py#L12[Cairo code repository].


0 comments on commit 2328e5f

Please sign in to comment.