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.
Let's create the project directory first
mkdir starknetAccount && cd starknetAccountThen run npm init, and input your fields or simply run npm init -y
npm init -yInstall starknet
npm install starknetLet 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) })Summary

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
The code creates the main network account
A private key corresponds to an address
We implement the argent address
There are more you can do with your imagination!
I’m neo, There will be more excellent articles later, stay tuned!
