You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To review how transaction appear in the Starknet API, see https://github.com/starkware-libs/starknet-specs/blob/b5c43955b1868b8e19af6d1736178e02ec84e678/api/starknet_api_openrpc.json[starknet_api_openrpc.json^].
The `DECLARE` transaction introduces new contract classes into the state of Starknet, enabling other contracts to deploy instances of those classes or use them in a library call. For more information, see xref:architecture-and-concepts:smart-contracts/contract-classes.adoc[contract classes].
* `class_hash` is the hash of the contract class. See xref:architecture-and-concepts:smart-contracts/class-hash.adoc#computing_the_cairo_1_class_hash[Class Hash] for details about how the hash is computed
75
+
* `compiled_class_hash` is the hash of the compiled class
76
+
generated by the Sierra->Casm compiler that is used in Starknet
77
+
78
+
== `DEPLOY_ACCOUNT` v3
79
+
80
+
:deploy_account:
81
+
82
+
Since StarkNet v0.10.1 the `DEPLOY_ACCOUNT` transaction replaces the `DEPLOY` transaction for deploying account contracts.
83
+
84
+
To use it, you should first pre-fund your new account address so that you can pay the transaction fee. You can then send the `DEPLOY_ACCOUNT` transaction.
85
+
86
+
For more information, see xref:architecture-and-concepts:accounts/deploying-new-accounts.adoc[].
* `class_hash` is the hash of the xref:architecture-and-concepts:smart-contracts/contract-classes.adoc[contract class]. See xref:architecture-and-concepts:smart-contracts/class-hash.adoc[Class Hash] for details about how the hash is computed.
118
+
* `contract_address` is the address of the newly deployed account. For information on how this address is calculated, see xref:architecture-and-concepts:smart-contracts/contract-address.adoc[Contract address].
119
+
120
+
== Additional information
121
+
122
+
=== Signature
123
+
124
+
While Starknet does not have a specific signature scheme built into the protocol, the Cairo language, in which smart contracts are written, does have an efficient implementation for ECDSA signature with respect to a STARK-friendly curve. For more information, see xref:architecture-and-concepts:cryptography.adoc[].
125
+
126
+
The generator used in the ECDSA algorithm is stem:[G=\left(g_x, g_y\right)] where:
When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases.
52
161
|===
53
162
54
-
=== v1 hash calculation
163
+
==== Hash calculation
55
164
56
165
The `INVOKE` v1 transaction hash is calculated as a hash over the given transaction elements,
57
166
specifically:
@@ -78,7 +187,9 @@ Where:
78
187
* `_h_` is the xref:architecture:cryptography.adoc#pedersen_hash[Pedersen] hash
79
188
80
189
81
-
=== v0 hash calculation
190
+
=== `INVOKE` v0
191
+
192
+
==== Hash calculation
82
193
83
194
The hash of a v0 `INVOKE` transaction is computed as follows:
84
195
@@ -103,55 +214,9 @@ Where:
103
214
104
215
:!invoke:
105
216
106
-
== `DECLARE` transaction
217
+
=== `DECLARE` v2
107
218
108
-
:declare:
109
-
110
-
The `DECLARE` transaction introduces new contract classes into the state of Starknet, enabling other contracts to deploy instances of those classes or use them in a library call. For more information, see https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html[the Cairo Book].
111
-
112
-
// [IMPORTANT]
113
-
// ====
114
-
// You can only declare Cairo classes with v2 and v3 of the `DECLARE` transaction type.
115
-
//
116
-
// v1, which declares Cairo 0 classes, is deprecated and will be removed in a future Starknet version.
* `class_hash` is the hash of the contract class. See https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html[the Cairo Book^] for details about how the hash is computed
151
-
* `compiled_class_hash` is the hash of the compiled class
152
-
generated by the Sierra->Casm compiler that is used in Starknet
153
-
154
-
=== v2 transaction fields
219
+
==== Transaction fields
155
220
156
221
[%autowidth.stretch]
157
222
|===
@@ -168,7 +233,7 @@ generated by the Sierra->Casm compiler that is used in Starknet
168
233
When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases.
169
234
|===
170
235
171
-
=== v2 hash calculation
236
+
==== Hash calculation
172
237
173
238
The hash of a v2 `DECLARE` transaction is computed as follows:
174
239
@@ -193,7 +258,9 @@ Where:
193
258
* `class_hash` is the hash of the contract class. See https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html[the Cairo Book^] for details about how the hash is computed
194
259
* `compiled_class_hash` is the hash of the compiled class generated by the Sierra->Casm compiler that is used in Starknet
195
260
196
-
=== v1 transaction fields
261
+
=== `DECLARE` v1
262
+
263
+
==== Transaction fields
197
264
198
265
[NOTE]
199
266
====
@@ -213,8 +280,7 @@ The `DECLARE` v1 transaction was used to declare Cairo 0 classes.
213
280
When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases.
214
281
|===
215
282
216
-
217
-
=== v1 hash calculation
283
+
==== Hash calculation
218
284
219
285
The hash of a v1 `DECLARE` transaction is computed as follows:
220
286
@@ -242,7 +308,9 @@ computed.
242
308
* `_h_` is the xref:architecture:cryptography.adoc#pedersen_hash[Pedersen] hash
243
309
244
310
245
-
=== v0 hash calculation
311
+
=== `DECLARE` v0
312
+
313
+
==== Hash calculation
246
314
247
315
[NOTE]
248
316
====
@@ -275,49 +343,9 @@ Where:
275
343
276
344
:!declare:
277
345
278
-
== `DEPLOY_ACCOUNT` transaction
279
-
280
-
:deploy_account:
281
-
282
-
Since StarkNet v0.10.1 the `DEPLOY_ACCOUNT` transaction replaces the `DEPLOY` transaction for deploying account contracts.
346
+
=== `DEPLOY_ACCOUNT` v1
283
347
284
-
To use it, you should first pre-fund your new account address so that you can pay the transaction fee. You can then send the `DEPLOY_ACCOUNT` transaction.
285
-
286
-
For more information, see xref:architecture:accounts#deploying_new_accounts.adoc[Deploying new accounts].
* `class_hash` is the hash of the contract class. See https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html[the Cairo Book^] for details about how the hash is computed.
318
-
* `contract_address` is the address of the newly deployed account. For information on how this address is calculated, see https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html[the Cairo Book^].
| `version` | `FieldElement` | The transaction's version. The value is 1. +
333
361
|===
334
362
335
-
=== v1 hash calculation
363
+
==== Hash calculation
336
364
337
365
The hash of a `DEPLOY_ACCOUNT` transaction is computed as follows:
338
366
@@ -360,9 +388,9 @@ Where:
360
388
361
389
:!deploy_account:
362
390
363
-
== `DEPLOY` transaction
391
+
=== `DEPLOY` v0
364
392
365
-
=== v0 hash calculation
393
+
==== Hash calculation
366
394
367
395
If you need to retrieve the hash of an existing `DEPLOY` transaction, you can use this information to calculate the hash of the transaction.
368
396
@@ -389,23 +417,3 @@ Where:
389
417
`sn_keccak` is xref:architecture:cryptography.adoc#starknet_keccak[Starknet Keccak].
390
418
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see xref:#chain_id[].
391
419
* `contract_address` is calculated as described see https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html[the Cairo Book^].
392
-
393
-
== Additional information
394
-
395
-
=== Signature
396
-
397
-
While Starknet does not have a specific signature scheme built into the protocol, the Cairo language, in which smart contracts are written, does have an efficient implementation for ECDSA signature with respect to a STARK-friendly curve. For more information, see xref:architecture:cryptography.adoc[].
398
-
399
-
=== Chain ID
400
-
401
-
Chain IDs are given as numbers, representing the ASCII encoding of specific constant strings, as illustrated by the following Python snippet:
0 commit comments