Clarity about funding the account before creation (deployment)

In StarkNet, we get account abstraction out of the box. They are deterministic (like how create2 works in Ethereum). However, I believe their is not enough clarity in the official documentation bout why we need to fund an account before deploying it, and it seems crucial to me as this is something relatively new in the Web 3 ecosystem. I am not sure but I believe that it is neccesary, because accounts are not native and the code needs to be deployed - as it can be different code as long as it meets the standards. Just looking for some confirmation here.

52 Likes

Hey,

From what I know/understand, is that at the moment those account deployment are fully taken by Starkware.
But at some point you’ll need to pay (or send something to the account) to deploy the account as it executes a transaction (deploy a smart contract) and therefore costs something to do it.

Hope it helps,
G.

25 Likes

Hello @PradhumnaPancholi :wave:t5:

There are currently two ways to deploy accounts on -

  1. Using the deploy account transaction - you can read more about it here. Very soon it will also be added to the docs.starknet.io.
    The purpose of this method is to allow users to deploy account without the need to rely on any other 3rd party. You prefund the address and then you can use this transaction to deploy the account and the fee is taken from your address.
    Do note that this is somewhat similar to Ethereum - in both cases you can “use” your address as a recipient even before it contains funds. In both cases, to start sending transactions from this address you need to fund it. The only difference is the deploy account transaction, but IMHO it is not inherently different.
  2. The other option is to use the deploy syscall. Using this method, you can have another user pay for the deployment of your account.

If there are any other questions let me know.

21 Likes

Exactly, so the cost is for deploying the account smart contract as they are not natively built (maybe for the lack of a better term) on StarkNet like Ethereum? Am I right here ?

19 Likes

okay, so I got the second method completely but I wasn’t clear on the first one. The notion helped a lot, I have gotten a better idea now, will look more into the risks section and how it can be solved.

Looking forward to contributing to this ecosystem.

Thanks,
Pradhumna Pancholi

20 Likes

Indeed.
About @bbrandtom first technique:
You will basically pay for the deploy of someone else’s account.
You first send fund to the address and then since it has enough funds, it’ll be able to trigger the account deployment transaction.

17 Likes

Great questions and very happy to have you here!

17 Likes

Got a question about this one transaction that u commit to top up account to deploy it further, where and how can we check this transaction after the deployment? How does this info stored?

16 Likes

I’m not sure I understand this question - are you asking where can you track the transactions status?
If so then you can use one of the block explorers of StarkNet -
Voyager / StarkScan / ViewBlock

10 Likes

The question was about that 1 transaction you commit to top up an account to be able to deploy it, when an account is deployed it has 0 transactions in it’s history, so where does this 1 transaction go?

10 Likes

Oh I see.

The funding transaction is sent from a different account, the same way you first fund an account on Ethereum.

9 Likes

Sorry if this is off topic and thanks for your time and answers. I didn’t specify, if a user replenishes a wallet that is yet to be deployed using the official bridge, then how is this transaction counted, where is it stored and is it not assigned to this yet undeployed account?

8 Likes

Ser, I’m not sure if understand your question correctly(if I have misunderstood please correct me), but for your first deposit, it was deposited into your newly created account, as mentioned in the account deploy process provided by Tom(Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.),please check:

A user can determine the address of his future account off-chain and then request to fund it. This is similar to Ether, where a user can “own” an address by selecting a key pair off-chain, but still needs an existing address to send him ETH in order to send the first transaction.

Then, you can use those funds to deploy account

Transaction Flow

Upon receiving a DEPLOY_ACCOUNT transaction, the sequencer will:

- verify that the address has funds to pay for the deployment
- execute the constructor with the given arguments
- execute the __validate_deploy__ entry point
- charge fee from the new account address
- advance the nonce to 1

Note that in determining the contract address, deployer address 0 will be used.

For account create and deploy, you can also find information here:Setting up a StarkNet account :: StarkNet documentation

thank you

8 Likes