Skip to content

Error in deploying my contract #6623

Discussion options

You must be logged in to vote
let provider = new ethers.JsonRpcProvider(process.env.RPC_URL_ALCHEMY); // connection to blockchain
let wallet = new ethers.Wallet(process.env.PRIVATE_KEY_SEPOLIA, provider); // Use a sepolia account for deploying
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
const contract = await contractFactory.deploy(); // deploy the contract
await contract.deploymentTransaction().wait(1); // 1 block confirmation

Try this out. You can go to ethers.js document for details.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@sreeraj003
Comment options

@markblockfish
Comment options

@MugheesMb
Comment options

@markblockfish
Comment options

Answer selected by markblockfish
@Mihir-pp
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants