Deploying a new account
You can deploy a new account in the following ways:
-
Send a
DEPLOY_ACCOUNT
transaction. This method does not require a preexisting account. -
Using the Universal Deployer Contract (UDC). This method requires an existing account to send the
INVOKE
transaction.
Upon receiving one of these transactions, the sequencer performs the following steps:
-
Runs the respective validation function in the contract, as follows:
-
When deploying with the
DEPLOY_ACCOUNT
transaction type, the sequencer executes the__validate_deploy__
function in the deployed contract. -
When deploying using the UDC, the sequencer executes the
__validate__
function in the contract of the sender’s address.
-
-
Executes the constructor with the given arguments.
-
Charges fees from the new account address.
If you use a
DEPLOY_ACCOUNT
transaction, the fees are paid from the address of the deployed account. If you use the UDC, which requires anINVOKE
transaction, the fees are paid from the sender’s account. For information on the differences between V1 and V3INVOKE
transactions, seeINVOKE
transaction in Transaction types. -
Sets the account’s nonce as follows:
-
1
, when deployed with aDEPLOY_ACCOUNT
transaction -
0
, when deployed with the UDC
-
Deploying a new account with Starkli
Starkli simplifies account creation, whether you create an account as a Starknet wallet account, or using the UDC.
To create and deploy a new account, use Starkli’s starkli account
command.
For more information on creating a new account as a Starknet wallet account with a DEPLOY_ACCOUNT
transaction, or by using the UDC with an INVOKE
transaction , see Accounts in the Starkli Book.
DEPLOY_ACCOUNT
constructor restrictions
The constructor of the DEPLOY_ACCOUNT
transaction has the following limitations:
-
Restricted access to
sequencer_address
in theget_execution_info
syscall. The syscall returns zero values forsequencer_address
-
Restricted access to the following syscalls:
-
get_block_hash
for Cairo contracts -
get_sequencer_address
for Cairo 0 contracts
-
Additional resources
-
Accounts in the Starkli Book