# How deploy your starknet account with nodejs

By [steve neo](https://paragraph.com/@defime) · 2021-11-28

---

This tutorial will teach you how to deploy an argent account, bravos similar to.

First, Make sure you have the nodejs environment.

If not please install them now.

[https://nodejs.org/](https://nodejs.org/)

1.  Let's create the project directory first
    
    `mkdir starknetAccount && cd starknetAccount`
    
2.  Then run npm init, and input your fields or simply run npm init -y
    
    `npm init -y`
    
3.  Install starknet
    
    `npm install starknet`
    
4.  Let write a create.js and paste following code.
    
        // import dependencies
        const { Account, ec, stark, Provider, hash } = require("starknet");
        
        // here we create mainnet account!
        const provider = new Provider({ sequencer: { network: "mainnet-alpha" } });
        
        //new Argent X account v0.2.3 :
        const argentXproxyClassHash = "0x25ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918";
        const argentXaccountClassHash = "0x033434ad846cdd5f23eb73ff09fe6fddd568284a0fb7d1be20ee482f044dabe2";
        
        async function main() {
          // generate a random private key and get it's keyPair
          // simply you can think you can get a same starknet account with a same private key
          const privateKeyAX = stark.randomAddress();
          console.log(`privateKeyAX:`, privateKeyAX)
          const starkKeyPairAX = ec.getKeyPair(privateKeyAX);
          const starkKeyPubAX = ec.getStarkKey(starkKeyPairAX);
        
          // Calculate future address of the ArgentX account
          const AXproxyConstructorCallData = stark.compileCalldata({
            implementation: argentXaccountClassHash,
            selector: hash.getSelectorFromName("initialize"),
            calldata: stark.compileCalldata({ signer: starkKeyPubAX, guardian: "0" }),
          });
          const AXcontractAddress = hash.calculateContractAddressFromHash(
            starkKeyPubAX,
            argentXproxyClassHash,
            AXproxyConstructorCallData,
            0
          );
          console.log('Precalculated account address=', AXcontractAddress);
          
          const accountAX = new Account(provider, AXcontractAddress, starkKeyPairAX);
        
          const deployAccountPayload = {
            classHash: argentXproxyClassHash,
            constructorCalldata: AXproxyConstructorCallData,
            contractAddress: AXcontractAddress,
            addressSalt: starkKeyPubAX
          };
          console.log(`starting deployAccount...`)
          //!important you can only activate your account with eth in account!
          const { transaction_hash: AXdAth, contract_address: AXcontractFinalAddress } = await accountAX.deployAccount(deployAccountPayload);
          console.log('ArgentX wallet deployed at :', AXcontractFinalAddress);
        }
        
        main()
          .then(() => process.exit(0))
          .catch((err) => {
            console.log(err)
            process.exit(1)
          })
        
    
5.  Summary
    

![project architecture](https://storage.googleapis.com/papyrus_images/501c8dc8d6861a8da1d2767fac2fcfc0c7366995ce147ce44945fe6e7c83415e.png)

project architecture

**As you can see from the code, the core logic is to generate the private key, get the keyPair through the private key, and finally calculate the starknet account address.**

**Attention**

1.  The code creates the main network account
    
2.  A private key corresponds to an address
    
3.  We implement the argent address
    
4.  There are more you can do with your imagination!
    

**I’m neo, There will be more excellent articles later, stay tuned!**

---

*Originally published on [steve neo](https://paragraph.com/@defime/how-deploy-your-starknet-account-with-nodejs)*
