Skip to main content

starknet_addDeclareTransaction RPC Method

Submit a new class declaration transaction.

Updated on
Mar 18, 2024

starknet_addDeclareTransaction RPC Method

Parameters

declare_transaction
object
REQUIRED
Declare transaction required to declare a new class on Starknet. It can be one of the following:
BROADCASTED_DECLARE_TXN_V1
object
The Broadcasted declare contract transaction V1
type
string
REQUIRED
The type of declare. It can take only one value - 'DECLARE'
sender_address
string
REQUIRED
The address of the account contract sending the declaration transaction
max_fee
string
REQUIRED
The maximal fee that can be charged for including the transaction
version
string
REQUIRED
The version of the transaction scheme
signature
string
REQUIRED
The signature associated with the transaction
nonce
string
REQUIRED
The nonce value
contract_class
object
REQUIRED
The class to be declared
sierra_program
array
REQUIRED
The list of Sierra instructions of which the program consists
contract_class_version
string
REQUIRED
The version of the contract class object. Currently, the Starknet OS supports version 0.1.0
entry_points_by_type
object
REQUIRED
The entry points by type object which contains the following fields:
CONSTRUCTOR
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
EXTERNAL
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
L1_HANDLER
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
abi
string
The class ABI, as supplied by the user declaring the class
BROADCASTED_DECLARE_TXN_V2
object
The Broadcasted declare Contract Transaction V2
type
string
REQUIRED
The type of declare. It can take only one value - 'DECLARE'
sender_address
string
REQUIRED
The address of the account contract sending the declaration transaction
compiled_class_hash
string
REQUIRED
The hash of the Cairo assembly resulting from the Sierra compilation
max_fee
string
REQUIRED
The maximal fee that can be charged for including the transaction
version
string
REQUIRED
The version of the transaction scheme
signature
string
REQUIRED
The signature associated with the transaction
nonce
string
REQUIRED
The nonce value
contract_class
object
REQUIRED
The class to be declared
sierra_program
array
REQUIRED
The list of Sierra instructions of which the program consists
contract_class_version
string
REQUIRED
The version of the contract class object. Currently, the Starknet OS supports version 0.1.0
entry_points_by_type
object
REQUIRED
The entry points by type object which contains the following fields:
CONSTRUCTOR
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
EXTERNAL
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
L1_HANDLER
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
abi
string
The class ABI, as supplied by the user declaring the class
BROADCASTED_DECLARE_TXN_V3
object
The Broadcasted declare Contract Transaction V3
type
string
REQUIRED
The type of declare. It can take only one value - 'DECLARE'
sender_address
string
REQUIRED
The address of the account contract sending the declaration transaction
compiled_class_hash
string
REQUIRED
The hash of the Cairo assembly resulting from the Sierra compilation
max_fee
string
REQUIRED
The maximal fee that can be charged for including the transaction
version
string
REQUIRED
The version of the transaction scheme
signature
string
REQUIRED
The signature associated with the transaction
nonce
string
REQUIRED
The nonce value
contract_class
object
REQUIRED
The class to be declared
sierra_program
array
REQUIRED
The list of Sierra instructions of which the program consists
contract_class_version
string
REQUIRED
The version of the contract class object. Currently, the Starknet OS supports version 0.1.0
entry_points_by_type
object
REQUIRED
The entry points by type object which contains the following fields:
CONSTRUCTOR
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
EXTERNAL
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
L1_HANDLER
array
REQUIRED
The list of Sierra instructions of which the program consists
selector
string
REQUIRED
A unique identifier of the entry point (function) in the program
function_idx
integer
REQUIRED
The index of the function in the program
abi
string
The class ABI, as supplied by the user declaring the class
resource_bounds
object
REQUIRED
The resource bounds for the transaction execution
l1_gas
string
REQUIRED
The max amount and max price per unit of L1 gas used in this tx
l2_gas
string
REQUIRED
The max amount and max price per unit of L2 gas used in this tx
tip
string
REQUIRED
The tip for the transaction
paymaster_data
array
REQUIRED
The data needed to allow the paymaster to pay for the transaction in native tokens
account_deployment_data
array
REQUIRED
The data needed to deploy the account contract from which this tx will be initiated
nonce_data_availability_mode
string
REQUIRED
The storage domain of the account's nonce (an account has a nonce per DA mode). It can be one of 'L1' or 'L2'
fee_data_availability_mode
string
REQUIRED
The storage domain of the account's balance from which fee will be charged. It can be one of 'L1' or 'L2'

Returns

result
object
The result of the transaction submission
transaction_hash
string
The result of the transaction submission
class_hash
string
The hash of the declared class
Request
1
curl --location 'https://docs-demo.strk-mainnet.quiknode.pro/' \
2
--header 'accept: application/json' \
3
--header 'content-type: application/json' \
4
--data '
5
{
6
"id": 1,
7
"jsonrpc": "2.0",
8
"method": "starknet_addDeclareTransaction",
9
"params": [
10
{
11
"max_fee": "MAX_FEE",
12
"version": "VERSION",
13
"signature": [
14
"SIGNATURE"
15
],
16
"nonce": "NONCE_VALUE",
17
"type": "DECLARE",
18
"contract_class": {
19
"sierraProgram": [
20
"SIERRA_PROGRAM"
21
],
22
"contractClassVersion": "CONTRACT_CLASS_VERSION",
23
"entryPointsByType": {
24
"CONSTRUCTOR": [
25
{
26
"selector": "SELECTOR",
27
"functionIdx": 0
28
}
29
],
30
"EXTERNAL": [
31
{
32
"selector": "SELECTOR",
33
"functionIdx": 0
34
}
35
],
36
"L1_HANDLER": [
37
{
38
"selector": "SELECTOR",
39
"functionIdx": 0
40
}
41
]
42
},
43
"abi": "ABI"
44
},
45
"sender_address": "SENDER_ADDRESS",
46
"compiled_class_hash": "COMPILED_CLASS_HASH"
47
}
48
]
49
}
50
'
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free