Git Product home page Git Product logo

ethers-simple-storage-fcc's Introduction

Update: Head to Cyfrin Updraft

ℹ️ Important: This repo is no longer maintained; we invite all people learning Solidity to head to Cyfrin Updraft! The 100% free #1 smart contract education platform on earth. Developed with love by Patrick & Cyfrin <3

Ethers Simple Storage

This is part of the FreeCodeCamp Solidity & Javascript Blockchain Course.

Video Link : ⌨️ (05:30:42) Lesson 5: Ethers.js Simple Storage

Getting Started

Requirements

  • git
    • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
  • Nodejs
    • You'll know you've installed nodejs right if you can run:
      • node --version and get an ouput like: vx.x.x
  • Yarn instead of npm
    • You'll know you've installed yarn right if you can run:
      • yarn --version and get an output like: x.x.x
      • You might need to install it with npm
  • ganache
    • You'll know you did it right if you can run the application and see:
      ganache
    • You can alternatively use ganache-cli or hardhat

Optional Gitpod

If you can't or don't want to run and install locally, you can work with this repo in Gitpod. If you do this, you can skip the clone this repo part.

Open in Gitpod

Setup

Clone this repo

git clone https://github.com/PatrickAlphaC/ethers-simple-storage
cd ethers-simple-storage

Then install dependencies

yarn

Note: You'll notice in our package.json we are using "solc": "0.8.7-fixed". Usually, you'll just be able to do "solc": "0.8.7" to get a specific version, but there was a bit of an issue with that one... You'll find out why we use 0.8.7

Typescript

If you like typescript, run git checkout typescript then run yarn

Usage

  1. Run your ganache local chain, by hitting quickstart on your ganache application

Save the workspace. This way, next time you open ganache you can start the workspace you've created, otherwise you'll have to redo all the steps below.

  1. Copy the RPC SERVER sting in your ganache CLI, and place it into your .env file similar to what's in .env.example.

ganache

.env Example:

RPC_URL=http://0.0.0.0:8545
  1. Hit the key on one of the accounts, and copy the key you see and place it into your .env file, similar to what you see in .env.example.

ganache

ganache

.env Example:

PRIVATE_KEY=11ee3108a03081fe260ecdc106554d09d9d1209bcafd46942b10e02943effc4a

  1. Compile your code

Run

yarn compile

You'll see files SimpleStorage_sol_SimpleStorage.abi and SimpleStorage_sol_SimpleStorage.bin be created.

  1. Run your application
node deploy.js

For WSL users

  1. Run
yarn add ganache
  1. Change Server settings in Ganache

Settings > Server > Host Name

Change Host Name to vEthernet (WSL)

  1. Run your application
node deploy.js

Deploying to a testnet

Make sure you have a metamask or other wallet, and export the private key.

IMPORTANT

USE A METAMASK THAT DOESNT HAVE ANY REAL FUNDS IN IT. Just in case you accidentally push your private key to a public place. I highly recommend you use a different metamask or wallet when developing.

  1. Export your private key and place it in your .env file, as done above.

  2. Go to Alchemy and create a new project on the testnet of choice (ie, Sepolia)

  3. Grab your URL associated with the testnet, and place it into your .env file.

  4. Make sure you have testnet ETH in your account. You can get some here. You should get testnet ETH for the same testnet that you made a project in Alchemy (ie, Sepolia)

  5. Run

node deploy.js

Troubleshooting: Ethers 6.X.X instability

const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL)
                                      ^

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

If you are experiencing issues with the latest version of Ethers, ethers ^6.0.2, try

const provider = new ethers.JsonRpcProvider(process.env.RPC_URL)

as providers were migrated to ethers.* in version 6 (previously ethers.providers.*). reference: https://docs.ethers.org/v6/migrating/#migrate-providers

Or you can easily solve the problem by downgrading to a previous version of Ethers, such as ethers 5.7.2.

To downgrade to ethers 5.7.2, run either of the following commands on your command line interface, depending on your package manager:

For npm:

npm install [email protected]

For yarn:


Thank you!

If you appreciated this, feel free to follow me or donate!

ETH/Polygon/Avalanche/etc Address: 0x9680201d9c93d65a3603d2088d125e955c73BD65

Patrick Collins Twitter Patrick Collins YouTube Patrick Collins Linkedin Patrick Collins Medium

ethers-simple-storage-fcc's People

Contributors

0xronin avatar alymurtazamemon avatar ankitsinghtd avatar okioki-nunc avatar patrickalphac avatar robocrypter avatar rogerbetter avatar rohitks7 avatar shawnesquivel avatar synacktraa avatar uday03meh avatar ybwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ethers-simple-storage-fcc's Issues

Solved

Hi all, I am following Patrick's lesson and in lesson 5-6, when he talked about VS code formatting, he mentioned that in settings.json, for "editor.defaultFormatter", we should use "NomicFoundation.hardhat-solidity". But when I tried to do so, this value has been underlined by system, indicating it is not a valid parameter. I tried to change it to "esbenp.prettier-vscode", still my codes are all in white.

The Prettier - Code formatter extension version is v9.10.4.
The Solidity extension version is v0.6.9. (No Solidity + Hardhat extension as in his video)

Please advise. Thank you.

Error: invalid JSON wallet

Getting an Error while generating wallet from encrypted JSON.
Code:

  let wallet = new ethers.Wallet.fromEncryptedJsonSync(
    encryptedJson,
    process.env.PRIVATE_KEY_PASS
  );

Error:

Error: invalid JSON wallet
    at decryptJsonWalletSync (/home/mitrang/Documents/hardhat-tutorial/hhFcc/ethersSimpleStorage/node_modules/@ethersproject/json-wallets/lib/index.js:38:11)
    at new Wallet.fromEncryptedJsonSync (/home/mitrang/Documents/hardhat-tutorial/hhFcc/ethersSimpleStorage/node_modules/@ethersproject/wallet/lib/index.js:229:68)
    at main (/home/mitrang/Documents/hardhat-tutorial/hhFcc/ethersSimpleStorage/deploy.js:10:16)
    at Object.<anonymous> (/home/mitrang/Documents/hardhat-tutorial/hhFcc/ethersSimpleStorage/deploy.js:35:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

The private key is properly encrypted in '.encryptedKey.json'.
Can anyone please help?

deploy.js file:

const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config();

async function main() {
  const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
  // const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);

  const encryptedJson = fs.read("./.encryptedKey.json", "utf8");
  let wallet = new ethers.Wallet.fromEncryptedJsonSync(
    encryptedJson,
    process.env.PRIVATE_KEY_PASS
  );
  wallet = await wallet.connect(provider);

  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);
  console.log("Deploying...");
  const contract = await contractFactory.deploy();
  const TxReceipt = await contract.deployTransaction.wait(1);

  const currentFavNum = await contract.retrieve();
  console.log(`Current fav Num: ${currentFavNum.toString()}`);
  const transactionResponse = await contract.store("7");
  const transactionReceipt = await transactionResponse.wait(1);
  const updatedFavNum = await contract.retrieve();
  console.log(`Updated fav number is : ${updatedFavNum.toString()}`);
}

main()
  .then(() => process.exit(0))
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });

chainId address mismatch

Hello guys, I got to the session were we are to deploy the SimpleStorage.sol contract with only transaction data, but I'm stuck with the following error.

Error: chainId address mismatch (argument="transaction", value={"nonce":3,"gasPrice":20000000000,"gasLimit":10000000,"to":null,"value":0,"data":"0x..."
reason: 'chainId address mismatch',
code: 'INVALID_ARGUMENT',
argument: 'transaction',

Here is the code snippet

const nonce = await wallet.getTransactionCount();
  const tx = {
    nonce: nonce,
    gasPrice: 20000000000,
    gasLimit: 10000000,
    to: null,
    value: 0,
    data: "0x...",
    chainId: 31337,
  };
  const sendTxResponse = await wallet.sendTransaction(tx);
  await sendTxResponse.wait(1);
  console.log(sendTxResponse);

I tried using my ganache Network ID: 5777 as chainId as instructed but still got the same error.
I also tried using 31337 as chainId but it didn't work.

Any Ideas???

TypeError trying to run node deploy.js

I could not get my local Ganache to run deployments so I skipped to hardhat and had some success, but now I am getting the following typeerror when trying to run the node deploy.js

TypeError: Cannot read properties of undefined (reading 'toHexString')
at isHexable (/home/thearkitech/hardhat-fcc/ethers-simple-storage/node_modules/@ethersproject/bytes/lib/index.js:9:21)
at hexlify (/home/thearkitech/hardhat-fcc/ethers-simple-storage/node_modules/@ethersproject/bytes/lib/index.js:175:9)
at new SigningKey (/home/thearkitech/hardhat-fcc/ethers-simple-storage/node_modules/@ethersproject/signing-key/lib/index.js:20:82)
at new Wallet (/home/thearkitech/hardhat-fcc/ethers-simple-storage/node_modules/@ethersproject/wallet/lib/index.js:120:36)
at main (/home/thearkitech/hardhat-fcc/ethers-simple-storage/deploy.js:11:20)
at Object. (/home/thearkitech/hardhat-fcc/ethers-simple-storage/deploy.js:47:1)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)

Any suggestions?

Clarification on setting up development environment

Hi guys,

I always have a doubt:

After I have installed all the packages as node, ethers, solc etc in my local project folder, when I create a new folder for a new project do I have to reinstall all the dependecies?

thanks

ganache UI doesn't show transactions

I'm having an issue with the ganache UI. I'm fairly certain that my transactions are going through since the nonce of the wallet keeps going up (I think I'm at 3 or 4 now). However, when I view the Transactions tab on Ganache's UI, it shows nothing.

No error messages in the console either.

Any ideas for how I can display the transactions on the Ganache UI?

const ethers = require("ethers");
const fs = require("fs");

async function main() {
  // create the provider
  const provider = new ethers.providers.JsonRpcProvider(
    "http://172.18.192.1:7545"
  );

  //   note: never put your private key in the code editor!
  const wallet = new ethers.Wallet(
    "privatewalletstuff",
    provider
  );
  //   to deploy: ABI + bin
  const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const bin = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin", "utf8");
  const nonce = await wallet.getTransactionCount();

  const tx = {
    nonce: nonce,
    gasPrice: 20000000000,
    gasLimit: 1000000,
    to: null,
    value: 0,
    data: "0x...... bunch of data",
    chainId: 1337,
  };
  // Signing the tx
  // const signedTxResponse = await wallet.signTransaction(tx);
  // console.log(signedTxResponse);

  const sentTxResponse = await wallet.sendTransaction(tx);
  await sentTxResponse.wait(1);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

Ganache wallet
image

Ganache UI
image

Error running node deploy.js command in the terminal - Error: Cannot find module

I'm just at the start (6:35:00) of using VSC and can't find a solution. I've tried reinstalling, and restarting, won't work!

When I try to run the deploy.js code using
node deploy.js
in the terminal, I get the following error:

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/home/surfnparmy/folder/test.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

I found this on Github but didn't seem like there was a single solution. Most didn't make sense :/
nodejs/help#3709

What it looks like for me:
image

Please help!

Issue : could not detect network with ganache

Hi all !
So I was trying to launch my first blockchain with ganache (hour 7) and I am stuck with the following issue :
"reason: 'could not detect network',
code: 'NETWORK_ERROR',
event: 'noNetwork'
"

I made sure ganache is running, that I have ethers and fs
I don't know where exactly the issue is so I can't make a minimalist code

async function main() {
  const provider = new ethers.providers.JsonRpcProvider(
    "http://127.0.0.1:7545"
  );
  const wallet = new ethers.Wallet(
    "1b8975f86182691cc7a416ed4b6bc04dfabff769922925632232636f5da1c1c4",
    provider
  );
  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);
  console.log("deploying please wait...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

Thank you for your help

Compiler version problem in visual studio code

I started visual studio code but usage of latest compiler version is showing error.

I used this:

'''
pragma solidity >=0.8.0 <0.9.0;
'''

'''

I got this error message:

Source file requires different compiler version (current compiler is 0.4.17+commit.bdeb9e52.Emscripten.clang - note that nightly builds are considered to be strictly less than the released versionsolc

'''

Can someone please help me?, Thanks in advance.

ts-node command not found

If we don't have ts-node installed globally its gives the error ts-node command not found. Need to update README.MD to use npx ts-node deploy.ts if using npm or yarn ts-node deploy.ts for yarn.

some typos at line 54, 128

I have seen some typos on line no. 54 and 128. So, I fixed it and created a pull request.
I'm so happy to contribute!

error Command "--base-path" not found.

Hi Fam.
i am at 6:53:10 of the course
Iran this command
yarn --solcjs --bin --abi --include-path node-modules/ --base-path . -o . SimpleStorage.sol

and it shows an error

error Command "--base-path" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

version of node.js engine is incompatible with module when I run "yarn add solc"

After I run "yarn add solc" I run to this error:
error [email protected]: The engine "node" is incompatible with this module. Expected version "^14.0.0 || ^16.0.0 || ^18.0.0". Got "19.6.0"
error Found incompatible module.

I think its because I downloaded node.js via homebrew and It automatically got me version 19.6.0
Can you please tell me what is the best way to solve this error? Should I lower my version of node.js back to 18.0.0?
Please anyone write me how to solve this problem I will be waiting :)

bash: cd--: command not found

gitpod /workspace/ethers-simple-storage-fcc (main) $ cd--
bash: cd--: command not found
gitpod /workspace/ethers-simple-storage-fcc (main) $ cd..
bash: cd..: command not found
gitpod /workspace/ethers-simple-storage-fcc (main) $ nkdir new_folder
bash: nkdir: command not found
gitpod /workspace/ethers-simple-storage-fcc (main) $ bash: cd--: command not found

I got the above in my gitpod when trying to set up and create folder
can any one help?

Error: missing revert data in call exception

Hi everyone. Right now I'm on Lesson 5 (7:30:00).
When trying to deploy deploy.js I get many errors in the console. The first line is:

Error: missing revert data in call exception; Transaction reverted without a reason string

I was following the course and just double-checked my code with Patrick's, both deploy.js and SimpleStorage.sol
I hate putting a lot of code in my questions, but since I can't determine the place of the issue happening, it's the only way.

The full error message:

Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"from":"0x8F37d537F328b3B2f14C2d287841a8Aa2fE19cae","to":"0x7E194Cb05852B9ce1859DEA59D5C4f03feD99604","data":"0x2e64cec1","accessList":null}, error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"id\":62,\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"VM Exception while processing transaction: revert\",\"code\":-32000,\"data\":{\"0x2f6a6404c1cbb4f8341d75aabea34bdfc7ea0ab100f1de9d22eaa26ddc547914\":{\"error\":\"revert\",\"program_counter\":92,\"return\":\"0x\"},\"stack\":\"RuntimeError: VM Exception while processing transaction: revert\\n at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\n at /Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:568:26\",\"name\":\"RuntimeError\"}}}","error":{"code":-32000,"data":{"0x2f6a6404c1cbb4f8341d75aabea34bdfc7ea0ab100f1de9d22eaa26ddc547914":{"error":"revert","program_counter":92,"return":"0x"},"stack":"RuntimeError: VM Exception while processing transaction: revert\n at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\n at /Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:568:26","name":"RuntimeError"}},"requestBody":"{\"method\":\"eth_call\",\"params\":[{\"from\":\"0x8f37d537f328b3b2f14c2d287841a8aa2fe19cae\",\"to\":\"0x7e194cb05852b9ce1859dea59d5c4f03fed99604\",\"data\":\"0x2e64cec1\"},\"latest\"],\"id\":62,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"http://127.0.0.1:7545"}, code=CALL_EXCEPTION, version=providers/5.6.8) at Logger.makeError (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21) at Logger.throwError (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20) at checkError (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:108:16) at JsonRpcProvider.<anonymous> (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:703:47) at step (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23) at Object.throw (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53) at rejected (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65) at processTicksAndRejections (node:internal/process/task_queues:96:5) { reason: 'missing revert data in call exception; Transaction reverted without a reason string', code: 'CALL_EXCEPTION', data: '0x', transaction: { from: '0x8F37d537F328b3B2f14C2d287841a8Aa2fE19cae', to: '0x7E194Cb05852B9ce1859DEA59D5C4f03feD99604', data: '0x2e64cec1', accessList: null }, error: Error: processing response error (body="{\"id\":62,\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"VM Exception while processing transaction: revert\",\"code\":-32000,\"data\":{\"0x2f6a6404c1cbb4f8341d75aabea34bdfc7ea0ab100f1de9d22eaa26ddc547914\":{\"error\":\"revert\",\"program_counter\":92,\"return\":\"0x\"},\"stack\":\"RuntimeError: VM Exception while processing transaction: revert\\n at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\n at /Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:568:26\",\"name\":\"RuntimeError\"}}}", error={"code":-32000,"data":{"0x2f6a6404c1cbb4f8341d75aabea34bdfc7ea0ab100f1de9d22eaa26ddc547914":{"error":"revert","program_counter":92,"return":"0x"},"stack":"RuntimeError: VM Exception while processing transaction: revert\n at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\n at /Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:568:26","name":"RuntimeError"}}, requestBody="{\"method\":\"eth_call\",\"params\":[{\"from\":\"0x8f37d537f328b3b2f14c2d287841a8aa2fe19cae\",\"to\":\"0x7e194cb05852b9ce1859dea59d5c4f03fed99604\",\"data\":\"0x2e64cec1\"},\"latest\"],\"id\":62,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="http://127.0.0.1:7545", code=SERVER_ERROR, version=web/5.6.1) at Logger.makeError (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21) at Logger.throwError (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20) at /Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:305:32 at step (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:33:23) at Object.next (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:14:53) at fulfilled (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:96:5) { reason: 'processing response error', code: 'SERVER_ERROR', body: '{"id":62,"jsonrpc":"2.0","error":{"message":"VM Exception while processing transaction: revert","code":-32000,"data":{"0x2f6a6404c1cbb4f8341d75aabea34bdfc7ea0ab100f1de9d22eaa26ddc547914":{"error":"revert","program_counter":92,"return":"0x"},"stack":"RuntimeError: VM Exception while processing transaction: revert\\n at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\n at /Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:568:26","name":"RuntimeError"}}}', error: Error: VM Exception while processing transaction: revert at getResult (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:191:21) at processJsonFunc (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:348:22) at /Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:280:46 at step (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:33:23) at Object.next (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:14:53) at fulfilled (/Users/jasmine_sprout/solidity-course/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: -32000, data: [Object] }, requestBody: '{"method":"eth_call","params":[{"from":"0x8f37d537f328b3b2f14c2d287841a8aa2fe19cae","to":"0x7e194cb05852b9ce1859dea59d5c4f03fed99604","data":"0x2e64cec1"},"latest"],"id":62,"jsonrpc":"2.0"}', requestMethod: 'POST', url: 'http://127.0.0.1:7545' } }

when i run deploy.js file, it gives me this error

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
at Logger.makeError (/home/syed/hardhat/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21)
at Logger.throwError (/home/syed/hardhat/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20)
at JsonRpcProvider. (/home/syed/hardhat/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:561:54)
at step (/home/syed/hardhat/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.throw (/home/syed/hardhat/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at rejected (/home/syed/hardhat/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'could not detect network',
code: 'NETWORK_ERROR',
event: 'noNetwork'

Private key and password shows up while deploying encryptKey.js

7e4d139eed481a441af9b92301e8399fc08941ff1dff64ec06ed2b1ca74e7dee
password
{"address":"15085b7e9d18f77bbd6cff655659869ec727a479","id":"41ea1350-c30c-4d64-9183-b7c35a072f0a","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"7d04a47e5e432eed4be40998aec54d95"},"ciphertext":"3a700c1fe3af4734b3ed1eb8955e3123f46bd3935533568c33e9b62e64093185","kdf":"scrypt","kdfparams":{"salt":"ae4b643339414f8f1687c4de30a8e957d7b52182c7b10547e09239b0864ffc55","n":131072,"dklen":32,"p":1,"r":8},"mac":"3cbba12c07c9770540e3c350dd12bccd8511bbf05cbe9a3751279870099456d4"}}
croppederror

SyntaxError: missing ) after argument list

Hi,
I am receiving the following error when running node deploy.js

SyntaxError: missing ) after argument list
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47

Here is my deploy.js file code:

const ethers = require("ethers");
const fs = require("fs-extra");
// synchronous [solidity]
// asynchronous [javascript]
// http://127.0.0.1:7545

async function main() {
const provider = new ethers.providers.JsonRpcProvider(http://127.0.0.1:7545);
const wallet = new ethers.Wallet("558ad0d522271091e7afe0a509d7bde199777ce200b95c027825a269276f7201", provider);
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);
console.log("Deploying, please wait...");
const contract = await contractFactory.deploy();
console.log(contract);
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1);
});

Any ideas?

Error when deploying to Goeri network

I am getting this error
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"reason":"processing response error","code":"SERVER_ERROR","body":"{"jsonrpc":"2.0","id":49,"error":{"code":-32000,"message":"gas required exceeds allowance (0)"

could not detect network

I am using ganache and did the same thing that the tutor in the video did. but I have this error:

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
    at Logger.makeError (/home/amir/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21)
    at Logger.throwError (/home/amir/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20)
    at JsonRpcProvider.<anonymous> (/home/amir/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:561:54)
    at step (/home/amir/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
    at Object.throw (/home/amir/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
    at rejected (/home/amir/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'could not detect network',
  code: 'NETWORK_ERROR',
  event: 'noNetwork'
}

Lesson 5: TypeError: abi.map is not a function

async function main() {
  //http://127.0.0.1:7545
  const provider = new ethers.providers.StaticJsonRpcProvider(
    "http://127.0.0.1:7545"
  );
  const wallet = new ethers.Wallet(
    "0e84b59ddccb5ba19af241e6ba52ba04e56ce5bf5d9a9f79b641f3c97a643388",
    provider
  );
  const abi = new fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.abi",
    "utf8"
  );
  const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );
  const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
  console.log("Deploying, please wait...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

I am having this error:

TypeError: abi.map is not a function
    at new Interface (/home/ramy-unix/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/abi/lib/interface.js:100:65)
    at Function.BaseContract.getInterface (/home/ramy-unix/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/contracts/lib/index.js:764:16)
    at ContractFactory.getInterface (/home/ramy-unix/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/contracts/lib/index.js:1192:25)
    at new ContractFactory (/home/ramy-unix/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/contracts/lib/index.js:1089:116)
    at main (/home/ramy-unix/hh-fcc/ethers-simple-storage/deploy.js:21:27)
    at Object.<anonymous> (/home/ramy-unix/hh-fcc/ethers-simple-storage/deploy.js:27:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

Code breaks at this line

 const contractFactory = new ethers.ContractFactory(abi, binary, wallet);

timestamp: 7:08:42

Unable to install Solc in my environment [Doesn't show up] (Stuck at Tutorial Moment 6:48:00)

In the tutorial, after running:

yarn add solc

Visual Studio would bring up 2 new packages: (package.json && yarn.lock)
image

### None of them appear to me after running the exact same command. I ran:

corepack enable
yarn --version
solcjs --version

And I still get nothing. I tried everything, even installing it with

npm install solc

But nothing really brought those files in my visual studio
image

typescript error - Only a void function can be called with the 'new' keyword

hi everyone

I am trying to switch to ts version of the deploy file in this course.

in the deploy.ts, I am using the decrypt method fromEncryptedJsonSync from the from ethers.Wallet ether js.
unfortunately it works with js but not in ts version.

here is my code and my packages version:

import {ethers } from 'ethers'
import dotenv from 'dotenv'
dotenv.config();
import * as fs from 'fs-extra';


// using Ganache desktop localy to get the a test wallet locally, getting the Private key from it
const ProviderRPC:string = process.env.PROVIDER_RPC !;
const PrivateKeyPassword:string = process.env.PRIVATE_KEY_PASSWORD!;
// abi - bin > files names
const AbiFileName = "SimpleStorage_sol_SimpleStorage.abi"
const BinFileName = "SimpleStorage_sol_SimpleStorage.bin"

async function main() {
    // main scipt to compile code
    //HTTP://127.0.0.1:7545

    // blockchain connection  ( network provider )
    const provider = new ethers.providers.JsonRpcProvider(ProviderRPC)
    //const wallet = new ethers.Wallet(PrivateKey, provider);
    //get the encryptedJsonKey object
    const encryptedJsonKey:string = fs.readFileSync("./.encryptedKey.json", "utf8")
    // decrypt the encryptedJsonKey object  throw passing the pasword  to get the wallet
    console.log(PrivateKeyPassword)
    let wallet:any= new ethers.Wallet.fromEncryptedJsonSync(
        encryptedJsonKey,
        PrivateKeyPassword
    )
    console.log(wallet)
    // connect the wallet with the provider
    wallet = await wallet.connect(provider)

    const abi = fs.readFileSync(`./${AbiFileName}`, "utf8")
    const bin = fs.readFileSync(`./${BinFileName}`, "utf8")

    const contractFactory = new ethers.ContractFactory(abi, bin, wallet)
    console.log("Deploying, Please wait ...")
    const contract = await contractFactory.deploy()
    // specifiy the number of block confirmation that it gonna wait
    await contract.deployTransaction.wait(1)
    console.log(`contract address : ${contract.address}`)

    // store a new favorite number
    const StoreTransactionReceipt = await contract.store("16")
    const StoreTransactionResp = await StoreTransactionReceipt.wait(1)

    // get the favorite number
    const currentFavoriteNumber = await contract.retrieve()
    console.log(`current Favorite Number : ${currentFavoriteNumber.toString()}`)
   
}

main()
    .then(() => {
        console.log("deployment Done!")
        process.exit(0)
    })
    .catch((error) => {
        console.error(error)
        process.exit(1)
    })

the issue is in the line below :

    let wallet:any= new ethers.Wallet.fromEncryptedJsonSync(
        encryptedJsonKey,
        PrivateKeyPassword
    )

the error I am getting in my console

deploy.ts:29:21 - error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.

29     let wallet:any= new ethers.Wallet.fromEncryptedJsonSync(
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30         encryptedJsonKey,
   ~~~~~~~~~~~~~~~~~~~~~~~~~
31         PrivateKeyPassword
   ~~~~~~~~~~~~~~~~~~~~~~~~~~
32     )
   ~~~~~

    at createTSError (/home/ub-rahmon/.nvm/versions/node/v16.14.2/lib/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/home/ub-rahmon/.nvm/versions/node/v16.14.2/lib/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/home/ub-rahmon/.nvm/versions/node/v16.14.2/lib/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/home/ub-rahmon/.nvm/versions/node/v16.14.2/lib/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/home/ub-rahmon/.nvm/versions/node/v16.14.2/lib/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Object.require.extensions.<computed> [as .ts] (/home/ub-rahmon/.nvm/versions/node/v16.14.2/lib/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  diagnosticCodes: [ 7009 ]

my package json file

{
  "dependencies": {
    "@types/fs-extra": "^9.0.13",
    "dotenv": "^16.0.3",
    "ethers": "5.5.3",
    "fs-extra": "^10.1.0",
    "prettier": "^2.7.1",
    "prettier-plugin-solidity": "^1.0.0-beta.24",
    "solc": "0.8.7-fixed",
    "ts-node": "^10.9.1",
    "typescript": "^4.8.4"
  },
  "scripts": {
    "deploy": "yarn solcjs --bin --abi --include-path node_modules/ --base-path . -o . SimpleStorage.sol"
  },
  "devDependencies": {
    "ethers-typescript-typings": "^0.0.4"
  }
}

I tried to look into the node_modules/@ethersproject/wallet/src.ts/index.ts file
it gives punch of errors there too, I think maybe it's a typescript version issue or the ethersjs types not working well.
any ideas? :)

ENV Variable not able to read on terminal

Hey there - so when I try to run the deploy.js script with encrypted keys, I try to set the environment variable for PRIVATE_KEY_PASSWORD=PASSWORD in the terminal. For your information, I did not install all the Ubuntu environment for coding hence the terminal I use is still with Windows. I think the problem is that I cannot find anywhere how to pass a "node deploy.js" command with a ENV variable set in the terminal in Windows. Could you help?

image

Running into a "NETWORK_ERROR" while deploying contract to Goerli

So, I've been following the entire tutorial and was able to run the simple storage contract on Ganache. However, when I try to deploy the same on Goerli through Alchemy, I get this error:

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2)
    at Logger.makeError (/home/gopikk/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:238:21)
    at Logger.throwError (/home/gopikk/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:247:20)
    at JsonRpcProvider.<anonymous> (/home/gopikk/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:609:54)
    at step (/home/gopikk/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
    at Object.throw (/home/gopikk/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
    at rejected (/home/gopikk/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  reason: 'could not detect network',
  code: 'NETWORK_ERROR',
  event: 'noNetwork'
}

I tried hardcoding the RPC URL and my PRIVATE KEY values into the provider and wallet functions, instead of getting them from the .env file, without any success. Is this an issue with Alchemy's API/ Goerli? Am I missing something?

when watching 8:03:38 ,deploy contract to goeril instead of Ganache , there is error "reason":"cannot estimate gas; transaction may fail or may require manual gas limit"

deploy Ganache is ok but deploy to goeril there is error :

<ref *1> Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":49,\"error\":{\"code\":-32000,\"message\":\"gas required exceeds allowance (0)\"}}","error":{"code":-32000},"requestBody":"{\"method\":\"eth_estimateGas\",\"params\":[{\"type\":\"0x2\",\"maxFeePerGas\":\"0x59682f10\",\"maxPriorityFeePerGas\":\"0x59682f00\",\"from\":\"0x69a1a724b43b4dab6f29f24a2260db7fe0360d26\",\"data\":\"0x608060405234801561001057600080fd5b50610771806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80632e64cec11461005c5780636057361d1461007a5780636f760f41146100965780638bab8dd5146100b25780639e7a13ad146100e2575b600080fd5b610064610113565b604051610071919061052a565b60405180910390f35b610094600480360381019061008f919061046d565b61011c565b005b6100b060048036038101906100ab9190610411565b610126565b005b6100cc60048036038101906100c791906103c8565b6101b6565b6040516100d9919061052a565b60405180910390f35b6100fc60048036038101906100f7919061046d565b6101e4565b60405161010a929190610545565b60405180910390f35b60008054905090565b8060008190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000155602082015181600101908051906020019061018c9291906102a0565b505050806002836040516101a09190610513565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b600181815481106101f457600080fd5b906000526020600020906002020160009150905080600001549080600101805461021d9061063e565b80601f01602080910402602001604051908101604052809291908181526020018280546102499061063e565b80156102965780601f1061026b57610100808354040283529160200191610296565b820191906000526020600020905b81548152906001019060200180831161027957829003601f168201915b5050505050905082565b8280546102ac9061063e565b90600052602060002090601f0160209004810192826102ce5760008555610315565b82601f106102e757805160ff1916838001178555610315565b82800160010185558215610315579182015b828111156103145782518255916020019190600101906102f9565b5b5090506103229190610326565b5090565b5b8082111561033f576000816000905550600101610327565b5090565b60006103566103518461059a565b610575565b90508281526020810184848401111561037257610371610704565b5b61037d8482856105fc565b509392505050565b600082601f83011261039a576103996106ff565b5b81356103aa848260208601610343565b91505092915050565b6000813590506103c281610724565b92915050565b6000602082840312156103de576103dd61070e565b5b600082013567ffffffffffffffff8111156103fc576103fb610709565b5b61040884828501610385565b91505092915050565b600080604083850312156104285761042761070e565b5b600083013567ffffffffffffffff81111561044657610445610709565b5b61045285828601610385565b9250506020610463858286016103b3565b9150509250929050565b6000602082840312156104835761048261070e565b5b6000610491848285016103b3565b91505092915050565b60006104a5826105cb565b6104af81856105d6565b93506104bf81856020860161060b565b6104c881610713565b840191505092915050565b60006104de826105cb565b6104e881856105e7565b93506104f881856020860161060b565b80840191505092915050565b61050d816105f2565b82525050565b600061051f82846104d3565b915081905092915050565b600060208201905061053f6000830184610504565b92915050565b600060408201905061055a6000830185610504565b818103602083015261056c818461049a565b90509392505050565b600061057f610590565b905061058b8282610670565b919050565b6000604051905090565b600067ffffffffffffffff8211156105b5576105b46106d0565b5b6105be82610713565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b8381101561062957808201518184015260208101905061060e565b83811115610638576000848401525b50505050565b6000600282049050600182168061065657607f821691505b6020821081141561066a576106696106a1565b5b50919050565b61067982610713565b810181811067ffffffffffffffff82111715610698576106976106d0565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61072d816105f2565b811461073857600080fd5b5056fea264697066735822122015fa82012a5ba90afc1b50f78cfa31a87e5fd8f9e571aed286dd7e8b0fc884d964736f6c63430008070033\"}],\"id\":49,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://eth-goerli.g.alchemy.com/v2/c-T9Z1w70lxJlZv0-beEklqlrJd2HLOF"},"method":"estimateGas","transaction":{"from":"0x69a1a724b43b4dAb6F29F24a2260Db7fe0360D26","maxPriorityFeePerGas":{"type":"BigNumber","hex":"0x59682f00"},"maxFeePerGas":{"type":"BigNumber","hex":"0x59682f10"},"data":"0x608060405234801561001057600080fd5b50610771806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80632e64cec11461005c5780636057361d1461007a5780636f760f41146100965780638bab8dd5146100b25780639e7a13ad146100e2575b600080fd5b610064610113565b604051610071919061052a565b60405180910390f35b610094600480360381019061008f919061046d565b61011c565b005b6100b060048036038101906100ab9190610411565b610126565b005b6100cc60048036038101906100c791906103c8565b6101b6565b6040516100d9919061052a565b60405180910390f35b6100fc60048036038101906100f7919061046d565b6101e4565b60405161010a929190610545565b60405180910390f35b60008054905090565b8060008190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000155602082015181600101908051906020019061018c9291906102a0565b505050806002836040516101a09190610513565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b600181815481106101f457600080fd5b906000526020600020906002020160009150905080600001549080600101805461021d9061063e565b80601f01602080910402602001604051908101604052809291908181526020018280546102499061063e565b80156102965780601f1061026b57610100808354040283529160200191610296565b820191906000526020600020905b81548152906001019060200180831161027957829003601f168201915b5050505050905082565b8280546102ac9061063e565b90600052602060002090601f0160209004810192826102ce5760008555610315565b82601f106102e757805160ff1916838001178555610315565b82800160010185558215610315579182015b828111156103145782518255916020019190600101906102f9565b5b5090506103229190610326565b5090565b5b8082111561033f576000816000905550600101610327565b5090565b60006103566103518461059a565b610575565b90508281526020810184848401111561037257610371610704565b5b61037d8482856105fc565b509392505050565b600082601f83011261039a576103996106ff565b5b81356103aa848260208601610343565b91505092915050565b6000813590506103c281610724565b92915050565b6000602082840312156103de576103dd61070e565b5b600082013567ffffffffffffffff8111156103fc576103fb610709565b5b61040884828501610385565b91505092915050565b600080604083850312156104285761042761070e565b5b600083013567ffffffffffffffff81111561044657610445610709565b5b61045285828601610385565b9250506020610463858286016103b3565b9150509250929050565b6000602082840312156104835761048261070e565b5b6000610491848285016103b3565b91505092915050565b60006104a5826105cb565b6104af81856105d6565b93506104bf81856020860161060b565b6104c881610713565b840191505092915050565b60006104de826105cb565b6104e881856105e7565b93506104f881856020860161060b565b80840191505092915050565b61050d816105f2565b82525050565b600061051f82846104d3565b915081905092915050565b600060208201905061053f6000830184610504565b92915050565b600060408201905061055a6000830185610504565b818103602083015261056c818461049a565b90509392505050565b600061057f610590565b905061058b8282610670565b919050565b6000604051905090565b600067ffffffffffffffff8211156105b5576105b46106d0565b5b6105be82610713565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b8381101561062957808201518184015260208101905061060e565b83811115610638576000848401525b50505050565b6000600282049050600182168061065657607f821691505b6020821081141561066a576106696106a1565b5b50919050565b61067982610713565b810181811067ffffffffffffffff82111715610698576106976106d0565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61072d816105f2565b811461073857600080fd5b5056fea264697066735822122015fa82012a5ba90afc1b50f78cfa31a87e5fd8f9e571aed286dd7e8b0fc884d964736f6c63430008070033","type":2,"accessList":null}}, tx={"data":"0x608060405234801561001057600080fd5b50610771806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80632e64cec11461005c5780636057361d1461007a5780636f760f41146100965780638bab8dd5146100b25780639e7a13ad146100e2575b600080fd5b610064610113565b604051610071919061052a565b60405180910390f35b610094600480360381019061008f919061046d565b61011c565b005b6100b060048036038101906100ab9190610411565b610126565b005b6100cc60048036038101906100c791906103c8565b6101b6565b6040516100d9919061052a565b60405180910390f35b6100fc60048036038101906100f7919061046d565b6101e4565b60405161010a929190610545565b60405180910390f35b60008054905090565b8060008190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000155602082015181600101908051906020019061018c9291906102a0565b505050806002836040516101a09190610513565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b600181815481106101f457600080fd5b906000526020600020906002020160009150905080600001549080600101805461021d9061063e565b80601f01602080910402602001604051908101604052809291908181526020018280546102499061063e565b80156102965780601f1061026b57610100808354040283529160200191610296565b820191906000526020600020905b81548152906001019060200180831161027957829003601f168201915b5050505050905082565b8280546102ac9061063e565b90600052602060002090601f0160209004810192826102ce5760008555610315565b82601f106102e757805160ff1916838001178555610315565b82800160010185558215610315579182015b828111156103145782518255916020019190600101906102f9565b5b5090506103229190610326565b5090565b5b8082111561033f576000816000905550600101610327565b5090565b60006103566103518461059a565b610575565b90508281526020810184848401111561037257610371610704565b5b61037d8482856105fc565b509392505050565b600082601f83011261039a576103996106ff565b5b81356103aa848260208601610343565b91505092915050565b6000813590506103c281610724565b92915050565b6000602082840312156103de576103dd61070e565b5b600082013567ffffffffffffffff8111156103fc576103fb610709565b5b61040884828501610385565b91505092915050565b600080604083850312156104285761042761070e565b5b600083013567ffffffffffffffff81111561044657610445610709565b5b61045285828601610385565b9250506020610463858286016103b3565b9150509250929050565b6000602082840312156104835761048261070e565b5b6000610491848285016103b3565b91505092915050565b60006104a5826105cb565b6104af81856105d6565b93506104bf81856020860161060b565b6104c881610713565b840191505092915050565b60006104de826105cb565b6104e881856105e7565b93506104f881856020860161060b565b80840191505092915050565b61050d816105f2565b82525050565b600061051f82846104d3565b915081905092915050565b600060208201905061053f6000830184610504565b92915050565b600060408201905061055a6000830185610504565b818103602083015261056c818461049a565b90509392505050565b600061057f610590565b905061058b8282610670565b919050565b6000604051905090565b600067ffffffffffffffff8211156105b5576105b46106d0565b5b6105be82610713565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b8381101561062957808201518184015260208101905061060e565b83811115610638576000848401525b50505050565b6000600282049050600182168061065657607f821691505b6020821081141561066a576106696106a1565b5b50919050565b61067982610713565b810181811067ffffffffffffffff82111715610698576106976106d0565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61072d816105f2565b811461073857600080fd5b5056fea264697066735822122015fa82012a5ba90afc1b50f78cfa31a87e5fd8f9e571aed286dd7e8b0fc884d964736f6c63430008070033","from":"0x69a1a724b43b4dAb6F29F24a2260Db7fe0360D26","type":2,"maxFeePerGas":{"type":"BigNumber","hex":"0x59682f10"},"maxPriorityFeePerGas":{"type":"BigNumber","hex":"0x59682f00"},"nonce":{},"gasLimit":{},"chainId":{}}, code=UNPREDICTABLE_GAS_LIMIT, version=abstract-signer/5.7.0)
    at Logger.makeError (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/logger/lib/index.js:238:21)
    at Logger.throwError (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/logger/lib/index.js:247:20)
    at /Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/abstract-signer/lib/index.js:365:47
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 6) {
  reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
  code: 'UNPREDICTABLE_GAS_LIMIT',
  error: Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":49,\"error\":{\"code\":-32000,\"message\":\"gas required exceeds allowance (0)\"}}","error":{"code":-32000},"requestBody":"{\"method\":\"eth_estimateGas\",\"params\":[{\"type\":\"0x2\",\"maxFeePerGas\":\"0x59682f10\",\"maxPriorityFeePerGas\":\"0x59682f00\",\"from\":\"0x69a1a724b43b4dab6f29f24a2260db7fe0360d26\",\"data\":\"0x608060405234801561001057600080fd5b50610771806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80632e64cec11461005c5780636057361d1461007a5780636f760f41146100965780638bab8dd5146100b25780639e7a13ad146100e2575b600080fd5b610064610113565b604051610071919061052a565b60405180910390f35b610094600480360381019061008f919061046d565b61011c565b005b6100b060048036038101906100ab9190610411565b610126565b005b6100cc60048036038101906100c791906103c8565b6101b6565b6040516100d9919061052a565b60405180910390f35b6100fc60048036038101906100f7919061046d565b6101e4565b60405161010a929190610545565b60405180910390f35b60008054905090565b8060008190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000155602082015181600101908051906020019061018c9291906102a0565b505050806002836040516101a09190610513565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b600181815481106101f457600080fd5b906000526020600020906002020160009150905080600001549080600101805461021d9061063e565b80601f01602080910402602001604051908101604052809291908181526020018280546102499061063e565b80156102965780601f1061026b57610100808354040283529160200191610296565b820191906000526020600020905b81548152906001019060200180831161027957829003601f168201915b5050505050905082565b8280546102ac9061063e565b90600052602060002090601f0160209004810192826102ce5760008555610315565b82601f106102e757805160ff1916838001178555610315565b82800160010185558215610315579182015b828111156103145782518255916020019190600101906102f9565b5b5090506103229190610326565b5090565b5b8082111561033f576000816000905550600101610327565b5090565b60006103566103518461059a565b610575565b90508281526020810184848401111561037257610371610704565b5b61037d8482856105fc565b509392505050565b600082601f83011261039a576103996106ff565b5b81356103aa848260208601610343565b91505092915050565b6000813590506103c281610724565b92915050565b6000602082840312156103de576103dd61070e565b5b600082013567ffffffffffffffff8111156103fc576103fb610709565b5b61040884828501610385565b91505092915050565b600080604083850312156104285761042761070e565b5b600083013567ffffffffffffffff81111561044657610445610709565b5b61045285828601610385565b9250506020610463858286016103b3565b9150509250929050565b6000602082840312156104835761048261070e565b5b6000610491848285016103b3565b91505092915050565b60006104a5826105cb565b6104af81856105d6565b93506104bf81856020860161060b565b6104c881610713565b840191505092915050565b60006104de826105cb565b6104e881856105e7565b93506104f881856020860161060b565b80840191505092915050565b61050d816105f2565b82525050565b600061051f82846104d3565b915081905092915050565b600060208201905061053f6000830184610504565b92915050565b600060408201905061055a6000830185610504565b818103602083015261056c818461049a565b90509392505050565b600061057f610590565b905061058b8282610670565b919050565b6000604051905090565b600067ffffffffffffffff8211156105b5576105b46106d0565b5b6105be82610713565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b8381101561062957808201518184015260208101905061060e565b83811115610638576000848401525b50505050565b6000600282049050600182168061065657607f821691505b6020821081141561066a576106696106a1565b5b50919050565b61067982610713565b810181811067ffffffffffffffff82111715610698576106976106d0565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61072d816105f2565b811461073857600080fd5b5056fea264697066735822122015fa82012a5ba90afc1b50f78cfa31a87e5fd8f9e571aed286dd7e8b0fc884d964736f6c63430008070033\"}],\"id\":49,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://eth-goerli.g.alchemy.com/v2/c-T9Z1w70lxJlZv0-beEklqlrJd2HLOF"}, method="estimateGas", transaction={"from":"0x69a1a724b43b4dAb6F29F24a2260Db7fe0360D26","maxPriorityFeePerGas":{"type":"BigNumber","hex":"0x59682f00"},"maxFeePerGas":{"type":"BigNumber","hex":"0x59682f10"},"data":"0x608060405234801561001057600080fd5b50610771806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80632e64cec11461005c5780636057361d1461007a5780636f760f41146100965780638bab8dd5146100b25780639e7a13ad146100e2575b600080fd5b610064610113565b604051610071919061052a565b60405180910390f35b610094600480360381019061008f919061046d565b61011c565b005b6100b060048036038101906100ab9190610411565b610126565b005b6100cc60048036038101906100c791906103c8565b6101b6565b6040516100d9919061052a565b60405180910390f35b6100fc60048036038101906100f7919061046d565b6101e4565b60405161010a929190610545565b60405180910390f35b60008054905090565b8060008190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000155602082015181600101908051906020019061018c9291906102a0565b505050806002836040516101a09190610513565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b600181815481106101f457600080fd5b906000526020600020906002020160009150905080600001549080600101805461021d9061063e565b80601f01602080910402602001604051908101604052809291908181526020018280546102499061063e565b80156102965780601f1061026b57610100808354040283529160200191610296565b820191906000526020600020905b81548152906001019060200180831161027957829003601f168201915b5050505050905082565b8280546102ac9061063e565b90600052602060002090601f0160209004810192826102ce5760008555610315565b82601f106102e757805160ff1916838001178555610315565b82800160010185558215610315579182015b828111156103145782518255916020019190600101906102f9565b5b5090506103229190610326565b5090565b5b8082111561033f576000816000905550600101610327565b5090565b60006103566103518461059a565b610575565b90508281526020810184848401111561037257610371610704565b5b61037d8482856105fc565b509392505050565b600082601f83011261039a576103996106ff565b5b81356103aa848260208601610343565b91505092915050565b6000813590506103c281610724565b92915050565b6000602082840312156103de576103dd61070e565b5b600082013567ffffffffffffffff8111156103fc576103fb610709565b5b61040884828501610385565b91505092915050565b600080604083850312156104285761042761070e565b5b600083013567ffffffffffffffff81111561044657610445610709565b5b61045285828601610385565b9250506020610463858286016103b3565b9150509250929050565b6000602082840312156104835761048261070e565b5b6000610491848285016103b3565b91505092915050565b60006104a5826105cb565b6104af81856105d6565b93506104bf81856020860161060b565b6104c881610713565b840191505092915050565b60006104de826105cb565b6104e881856105e7565b93506104f881856020860161060b565b80840191505092915050565b61050d816105f2565b82525050565b600061051f82846104d3565b915081905092915050565b600060208201905061053f6000830184610504565b92915050565b600060408201905061055a6000830185610504565b818103602083015261056c818461049a565b90509392505050565b600061057f610590565b905061058b8282610670565b919050565b6000604051905090565b600067ffffffffffffffff8211156105b5576105b46106d0565b5b6105be82610713565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b8381101561062957808201518184015260208101905061060e565b83811115610638576000848401525b50505050565b6000600282049050600182168061065657607f821691505b6020821081141561066a576106696106a1565b5b50919050565b61067982610713565b810181811067ffffffffffffffff82111715610698576106976106d0565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61072d816105f2565b811461073857600080fd5b5056fea264697066735822122015fa82012a5ba90afc1b50f78cfa31a87e5fd8f9e571aed286dd7e8b0fc884d964736f6c63430008070033","type":2,"accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)
      at Logger.makeError (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/logger/lib/index.js:238:21)
      at Logger.throwError (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/logger/lib/index.js:247:20)
      at checkError (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:175:16)
      at JsonRpcProvider.<anonymous> (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:751:47)
      at step (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
      at Object.throw (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
      at rejected (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
    code: 'UNPREDICTABLE_GAS_LIMIT',
    error: Error: processing response error (body="{\"jsonrpc\":\"2.0\",\"id\":49,\"error\":{\"code\":-32000,\"message\":\"gas required exceeds allowance (0)\"}}", error={"code":-32000}, requestBody="{\"method\":\"eth_estimateGas\",\"params\":[{\"type\":\"0x2\",\"maxFeePerGas\":\"0x59682f10\",\"maxPriorityFeePerGas\":\"0x59682f00\",\"from\":\"0x69a1a724b43b4dab6f29f24a2260db7fe0360d26\",\"data\":\do not type it "}],\"id\":49,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://eth-goerli.g.alchemy.com/v2/c-T9Z1w70lxJlZv0-beEklqlrJd2HLOF", code=SERVER_ERROR, version=web/5.7.1)
        at Logger.makeError (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/logger/lib/index.js:238:21)
        at Logger.throwError (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/logger/lib/index.js:247:20)
        at /Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/web/lib/index.js:313:32
        at step (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/web/lib/index.js:33:23)
        at Object.next (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/web/lib/index.js:14:53)
        at fulfilled (/Users/lwj/script/learning/code/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/web/lib/index.js:5:58)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
      reason: 'processing response error',
      code: 'SERVER_ERROR',
      body: '{"jsonrpc":"2.0","id":49,"error":{"code":-32000,"message":"gas required exceeds allowance (0)"}}',
      error: [Error],
      requestBody: '{"method":"eth_estimateGas","params":[{"type":"0x2","maxFeePerGas":"0x59682f10","maxPriorityFeePerGas":"0x59682f00","from":"0x69a1a724b43b4dab6f29f24a2260db7fe0360d26","data":"do not type it"}],"id":49,"jsonrpc":"2.0"}',
      requestMethod: 'POST',
      url: 'https://eth-goerli.g.alchemy.com/v2/c-T9Z1w70lxJlZv0-beEklqlrJd2HLOF'
    },
    method: 'estimateGas',
    transaction: {
      from: '0x69a1a724b43b4dAb6F29F24a2260Db7fe0360D26',
      maxPriorityFeePerGas: [BigNumber],
      maxFeePerGas: [BigNumber],
      data: 'do not type it',
      type: 2,
      accessList: null
    }
  },
  tx: {
    data: 'do not type it',
    from: '0x69a1a724b43b4dAb6F29F24a2260Db7fe0360D26',
    type: 2,
    maxFeePerGas: BigNumber { _hex: '0x59682f10', _isBigNumber: true },
    maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
    nonce: Promise { 0 },
    gasLimit: Promise { <rejected> [Circular *1] },
    chainId: Promise { 5 }
  }
}

EncryptedKey and Password not working

When I am trying to deploy contract with password it is show no commend found error
"PRIVATE_KEY_PASSWORD=SAYA123 : The term 'PRIVATE_KEY_PASSWORD=SAYA123' is not
recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again."
and also if i tryin to delete PRIVATE_KEY from .env it is also not working.

README.md, SyntaxError: Cannot use import statement outside a module

On video time 8:17:16
README.md

I followed the instructions by commenting the lines

const ethers = require("ethers")
const fs = require("fs-extra")
require("dotenv").config()

and replacing them with

import { ethers } from "ethers"
import * as fs from "fs-extra"
import "dotenv/config" 

now, in deploy.ts file

async function main() {
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL)
    const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider)
    ...
}

and in encryptKey.ts file

async function main() {
    const wallet = new ethers.Wallet(process.env.PRIVATE_KEY)
    const encryptedJsonKey = await wallet.encrypt(
        process.env.PRIVATE_KEY_PASSWORD,
        process.env.PRIVATE_KEY
    )

<process.env.PRIVATE_KEY> in both files is giving the error

var process: NodeJS.Process
Argument of type 'string | undefined' is not assignable to parameter of type 'BytesLike | ExternallyOwnedAccount | SigningKey'.
  Type 'undefined' is not assignable to type 'BytesLike | ExternallyOwnedAccount | SigningKey'.ts(2345)

I tried uncommenting const ethers = require("ethers"), replacing import { ethers } from "ethers" and the error is gone but when run,

(node:10196) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
import * as fs from "fs-extra"
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:74:18)
    at wrapSafe (node:internal/modules/cjs/loader:1141:20)
    at Module._compile (node:internal/modules/cjs/loader:1182:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.13.0

please help!

sender doesn't have enough funds to send tx (Lesson 05)

const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
  // endpoint
  // http://127.0.0.1:7545
  const provider = new ethers.providers.JsonRpcProvider(
    "http://127.0.0.1:7545"
  );
  const wallet = new ethers.Wallet(
    "375dc9e049aae95d782a74eb9a852430dd63b1273313aa23f8d36be64ab3b877",
    provider
  );
  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);
  // console.log("Deploying contract...");
  // const contract = await contractFactory.deploy();
  // const transactionRecipe = await contract.deployTransaction.wait(1);
  console.log("Lets only deploy with transaction data");
  const nonce = await wallet.getTransactionCount();
  const tx = {
    nonce,
    gasPrice: 20000000000,
    gasLimit: 6721975,
    to: null,
    value: 0,
    data: "0x608060405234801561001057600080fd5b50610771806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80632e64cec11461005c5780636057361d1461007a5780636f760f41146100965780638bab8dd5146100b25780639e7a13ad146100e2575b600080fd5b610064610113565b604051610071919061052a565b60405180910390f35b610094600480360381019061008f919061046d565b61011c565b005b6100b060048036038101906100ab9190610411565b610126565b005b6100cc60048036038101906100c791906103c8565b6101b6565b6040516100d9919061052a565b60405180910390f35b6100fc60048036038101906100f7919061046d565b6101e4565b60405161010a929190610545565b60405180910390f35b60008054905090565b8060008190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000155602082015181600101908051906020019061018c9291906102a0565b505050806002836040516101a09190610513565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b600181815481106101f457600080fd5b906000526020600020906002020160009150905080600001549080600101805461021d9061063e565b80601f01602080910402602001604051908101604052809291908181526020018280546102499061063e565b80156102965780601f1061026b57610100808354040283529160200191610296565b820191906000526020600020905b81548152906001019060200180831161027957829003601f168201915b5050505050905082565b8280546102ac9061063e565b90600052602060002090601f0160209004810192826102ce5760008555610315565b82601f106102e757805160ff1916838001178555610315565b82800160010185558215610315579182015b828111156103145782518255916020019190600101906102f9565b5b5090506103229190610326565b5090565b5b8082111561033f576000816000905550600101610327565b5090565b60006103566103518461059a565b610575565b90508281526020810184848401111561037257610371610704565b5b61037d8482856105fc565b509392505050565b600082601f83011261039a576103996106ff565b5b81356103aa848260208601610343565b91505092915050565b6000813590506103c281610724565b92915050565b6000602082840312156103de576103dd61070e565b5b600082013567ffffffffffffffff8111156103fc576103fb610709565b5b61040884828501610385565b91505092915050565b600080604083850312156104285761042761070e565b5b600083013567ffffffffffffffff81111561044657610445610709565b5b61045285828601610385565b9250506020610463858286016103b3565b9150509250929050565b6000602082840312156104835761048261070e565b5b6000610491848285016103b3565b91505092915050565b60006104a5826105cb565b6104af81856105d6565b93506104bf81856020860161060b565b6104c881610713565b840191505092915050565b60006104de826105cb565b6104e881856105e7565b93506104f881856020860161060b565b80840191505092915050565b61050d816105f2565b82525050565b600061051f82846104d3565b915081905092915050565b600060208201905061053f6000830184610504565b92915050565b600060408201905061055a6000830185610504565b818103602083015261056c818461049a565b90509392505050565b600061057f610590565b905061058b8282610670565b919050565b6000604051905090565b600067ffffffffffffffff8211156105b5576105b46106d0565b5b6105be82610713565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b8381101561062957808201518184015260208101905061060e565b83811115610638576000848401525b50505050565b6000600282049050600182168061065657607f821691505b6020821081141561066a576106696106a1565b5b50919050565b61067982610713565b810181811067ffffffffffffffff82111715610698576106976106d0565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61072d816105f2565b811461073857600080fd5b5056fea2646970667358221220ee94bfa2d5662b903592cc10f5a668b88dcd6372e2682549f3fb7c3aeed4228764736f6c63430008070033",
    chainId: 1337,
  };
  const sentTxResponse = await wallet.sendTransaction(tx);
  await sentTxResponse.wait(1);
  console.log(sentTxResponse);
}
main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

issue: i am having an issue while deploying the contract to local ganache

hi` all, at 7:08 hrs when I am trying to deploy my contract to local ganache it gets stuck there as my promise is not getting resolved

const ethers = require("ethers");
const fs = require("fs-extra");

async function main() {
  //RPC SERVER
  //HTTP://127.0.0.1:8545

  const provider = new ethers.providers.JsonRpcProvider(
    "HTTP://172.22.192.1:7545"
  );
  const wallet = new ethers.Wallet(
    "76fe5a715ceefaaa33f4bc5732d89f0b6057a76605d478e199b865fb162c7729",
    provider
  );
  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);
  console.log("deploying please wait");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

here I'm copying my bash terminal:

ritesh@LAPTOP-TI9KIBT3:~/hardhatfcc/ethers-simple-storage$ node deploy.js
deploying please wait

after 10 mins console gave me output for network not found. i have already changed my server to vEthernetWSL

ritesh@LAPTOP-TI9KIBT3:~/hardhatfcc/ethers-simple-storage$ node deploy.js
deploying please wait
Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
    at Logger.makeError (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21)
    at Logger.throwError (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20)
    at JsonRpcProvider.<anonymous> (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:561:54)
    at step (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
    at Object.throw (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
    at rejected (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65) {
  reason: 'could not detect network',
  code: 'NETWORK_ERROR',
  event: 'noNetwork'
}
ritesh@LAPTOP-TI9KIBT3:~/hardhatfcc/ethers-simple-storage$ 

Error - Could not detect network

async function main() {
  //http://127.0.0.t1:7545
  const provider = new ethers.providers.JsonRpcProvider(
    "http://127.0.0.1:7545"
  );
  const wallet = new ethers.Wallet(
    "2b31280e6c45d29375b68a16194554f976a0fe1e0f88f54fde19945fdf0a66e3",
    provider
  );
  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);
  console.log("Deploying, please wait...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

I got the following error while deploying the Simple Storage smart contract using above code.

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
    at Logger.makeError (/home/casket/blockchain/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21)
    at Logger.throwError (/home/casket/blockchain/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20)
    at JsonRpcProvider.<anonymous> (/home/casket/blockchain/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:561:54)
    at step (/home/casket/blockchain/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
    at Object.throw (/home/casket/blockchain/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
    at rejected (/home/casket/blockchain/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'could not detect network',
  code: 'NETWORK_ERROR',
  event: 'noNetwork'
}

What's wrong here?

Cant deploy contract to test network.

In section 5 I am right at the part at the very end where I am trying to deploy the contract to the test netwrok and I am getting this error:

Deploying, please wait...
<ref *1> Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"reason":"processing response error",

It deployed just fine when connecting to ganache. The video also never mentioned anything about inputting a gas fee at this point either

Network error on 'node deploy.js' command on Ubuntu subsystem on Windows

So im trying to run this command and getting this error
error fires right after conrtact.deploy()

  const contract = await contractFactory.deploy();

Here is the error:

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
    at Logger.makeError (/home/andrey/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21)
    at Logger.throwError (/home/andrey/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20)
    at JsonRpcProvider.<anonymous> (/home/andrey/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:561:54)
    at step (/home/andrey/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
    at Object.throw (/home/andrey/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
    at rejected (/home/andrey/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'could not detect network',
  code: 'NETWORK_ERROR',
  event: 'noNetwork'
}

Here is my code:

const ethers = require("ethers");
const fs = require("fs-extra");

// yarn solcjs --bin --abi --include-path node_modules/ --base-path . -o . SimpleStorage.sol
// http://127.0.0.1:7545

async function main() {
  const provider = new ethers.providers.JsonRpcProvider(
    "http://127.0.0.1:7545"
  );
  const wallet = new ethers.Wallet(
    [wallet key goes here],
    provider
  );

  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);
  console.log("Deploying...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((err) => {
    console.log(err);
    process.exit(1);
  });

Error: cannot estimate gas; transaction may fail or may require manual gas limit

Hi, while running node deploy.js i get the following error. How can i set manual gas limit. please help.

*********My Code ************

` const provider = new ethers.providers.JsonRpcProvider("HTTP://127.0.0.1:7545")

const wallet = new ethers.Wallet("16dd1fe882e9c481d9c505f34335519b2c381b6842143dddf23e4ab5a79634df", provider);
//getting abi
const abi = readFileSync("SimpleStorage_sol_SimpleStorage.abi", "utf-8");
const binary = readFileSync("SimpleStorage_sol_SimpleStorage.bin", "utf-8");
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying, Please wait...");
const contract = await contractFactory.deploy();
console.log(contract);

`

deployError

Cannot read property 'toHexString' of undefined

Hi!

I saw closed thread with almost the same title, but it didn't help me :(

I keep getting this error, and i can not continue with the course:

TypeError: Cannot read property 'toHexString' of undefined
    at isHexable (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/bytes/lib/index.js:9:21)
    at arrayify (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/bytes/lib/index.js:69:9)
    at getPassword (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/json-wallets/lib/utils.js:25:33)
    at _computeKdfKey (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/json-wallets/lib/keystore.js:160:49)
    at decryptSync (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/json-wallets/lib/keystore.js:210:15)
    at decryptJsonWalletSync (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers
[nenadsky@archlinux ethers-simple-storage-fcc]$ node deploy.js 
TypeError: Cannot read property 'toHexString' of undefined
    at isHexable (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/bytes/lib/index.js:9:21)
    at arrayify (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/bytes/lib/index.js:69:9)
    at getPassword (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/json-wallets/lib/utils.js:25:33)
    at _computeKdfKey (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/json-wallets/lib/keystore.js:160:49)
    at decryptSync (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/json-wallets/lib/keystore.js:210:15)
    at decryptJsonWalletSync (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/json-wallets/lib/index.js:36:43)
    at new Wallet.fromEncryptedJsonSync (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/node_modules/@ethersproject/wallet/lib/index.js:229:68)
    at main (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/deploy.js:10:16)
    at Object.<anonymous> (/home/nenadsky/Documents/Ethereum/hh-fcc/ethers-simple-storage-fcc/deploy.js:52:1)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)

Deploy.js file

const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config();

async function main() {
  const provider = new ethers.providers.JsonRpcProvider(
    process.env.RPC_URL
  );
  const encryptedJson = fs.readFileSync("./.encryptedKey.json", "utf8");
  let wallet = new ethers.Wallet.fromEncryptedJsonSync(encryptedJson, process.env.PRIVATE_KEY_PASSWORD);
  wallet = await wallet.connect(provider);

  const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );
  console.log(`Contract address: ${contract.address}`);
  const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
  console.log("Deploying, please wait...");
  const contract = await contractFactory.deploy();
 

  /*const currentFavouriteNumber = await contract.retrieve();
  console.log(`Current favourite number: ${currentFavouriteNumber.toString()}`);
  const transactionResponse = await contract.store("7");
  const transactionReceipt = await transactionResponse.wait(1);
  const updatedFavouriteNumber = await contract.retrieve();
  console.log(`Updated favourite number: ${updatedFavouriteNumber.toString()}`);
*/
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

I can't find any typo or similar error.

.env file contains private_key and rpc_url constants...

deploy.js is throwing a no network error

I am at 7:07:38 in the course where Patrick first runs the deploy.js using the command node deploy.js. Instead of getting the contract details, it throws an error stating "could not detect network". Any help would be much appreciated.
the entire error is as follows:

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
at Logger.makeError (/home/bondiver/hh-fcc/ethers-ss/node_modules/@ethersproject/logger/lib/index.js:233:21)
at Logger.throwError (/home/bondiver/hh-fcc/ethers-ss/node_modules/@ethersproject/logger/lib/index.js:242:20)
at JsonRpcProvider. (/home/bondiver/hh-fcc/ethers-ss/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:561:54)
at step (/home/bondiver/hh-fcc/ethers-ss/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.throw (/home/bondiver/hh-fcc/ethers-ss/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at rejected (/home/bondiver/hh-fcc/ethers-ss/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'could not detect network',
code: 'NETWORK_ERROR',
event: 'noNetwork'
}

Below is my deploy.js code,

const ethers = require("ethers");
const fs = require("fs-extra");

async function main() {
  // http://127.0.0.1:7545

  const provider = new ethers.providers.JsonRpcProvider(
    "HTTP://127.0.0.1:7545"
  );
  const wallet = new ethers.Wallet(
    "6e6170240a5a4462244c76841fbaac9fe4edd90af97e44574647c5bc0db11197",
    provider
  );

  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);
  console.log("deployment in process...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

Lesson 5: TXRejectedError: the tx doesn't have the correct nonce.

Hello, I am receiving the error below when trying to deploy "deploy.js":

TXRejectedError: the tx doesn't have the correct nonce. 

Here is the code:

  const nonce = await wallet.getTransactionCount();
  const tx = {
    nonce: nonce,
    gasPrice: 20000000000,
    gasLimit: 1000000,
    to: null,
    value: 0,
    data: "Long Byte Code",
    chainId: 1337,
  };
  const sentTxResponse = await wallet.sendTransaction(tx);
  await sentTxResponse.wait(1);
  console.log(sentTxResponse);

Anyone have any ideas why I still get this error even when using await wallet.sendTransaction(tx) for the nonce?
"Long Byte Code" stores the Byte code from the byte file. It has been removed for space.

TypeError: Cannot read properties of null (reading 'constructor')

const ethers = require("ethers");
const { readFileSync } = require("fs-extra");
// const fs = require("fs-extra");
const path = require("path");

async function main() {
  //http://127.0.0.1:7545
  const provider = new ethers.providers.JsonRpcProvider(
    "http://127.0.0.1:7545"
  );
  const wallet = new ethers.Wallet(
    "5ff3b403d98780d3bd969dde70759a3ebafaf924b1599423ac490e49fea24b81",
    provider
  );
  const abi = readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const binary = readFileSync("./SimpleStorage_sol_SimpleStorage.bin", "utf8");
  const contractFactory = ethers.ContractFactory(abi, binary, wallet);
  console.log("Deploying, please wait ...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

When i tried running the above code, I got this error below, I have tried for days to resolve it but cant get pass it

TypeError: Cannot read properties of null (reading 'constructor')
    at getStatic (/home/okhakume/BlockchainDev/hh-fcc/ether-simple-storage-fcc/node_modules/@ethersproject/properties/lib/index.js:60:53)
    at Object.ContractFactory (/home/okhakume/BlockchainDev/hh-fcc/ether-simple-storage-fcc/node_modules/@ethersproject/contracts/lib/index.js:1089:88)
    at main (/home/okhakume/BlockchainDev/hh-fcc/ether-simple-storage-fcc/deploy.js:17:34)
    at Object.<anonymous> (/home/okhakume/BlockchainDev/hh-fcc/ether-simple-storage-fcc/deploy.js:23:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Code works without transactionResponse.wait() using Ganache, but doesn't work on real testnet without it.

Screen Shot 2022-12-29 at 10 50 05 AM

''' const currentFavNum = await contract.retrieve();
console.log(Current favorite number is: ${currentFavNum});
console.log("Updating favorite number...");
let transactionResponse = await contract.store(7);
// let transactionReceipt = await transactionResponse.wait();

const updatedFavNum = await contract.retrieve();
console.log(`Updated favorite number is: ${updatedFavNum}`);'''

As the screenshot shows, the favNum is not updated if I comment out the '''transactionResponse.wait()''', but then it works perfectly when I add it back. Wondering why?

ps: it only happens when I'm using Goerli. Ganache works fine with or without '''transactionResponse.wait()'''

Delete private_key_password from .env file

Hi everyone, I have a question about private key encryption. In the tutorial after generating "encryptedKey.json" we can delete PRIVATE_KEY_PASSWORD from .env file.

But in deploy.js we refer to process.env.PRIVATE_KEY_PASSWORD to create wallet. In my case, the program cannot find this variable since we have deleted it from .env already.

I'm wondering do we still need to keep PRIVATE_KEY_PASSWORD in .env? Or is it because I have done something wrong? Thanks.

The term 'PRIVATE_KEY_PASSWORD=password' is not recognized as a name of a cmdlet, function, script file, or executable program.

I'm using VScode in windows 10 with admin rights.
Regarding instructions on 7:47 on the video. I cannot define the variable PRIVATE_KEY_PASSWORD when writing
"PRIVATE_KEY_PASSWORD=password node deploy.js" For some reason I cannot define any variable on the integrated powershell terminal of the VScode, executed with or without admin rights.
This is the error message that I have when writing that command line:

PS E:\mycodefolder> PRIVATE_KEY_PASSWORD=password node deploy.js

Error:
"PRIVATE_KEY_PASSWORD=password: The term 'PRIVATE_KEY_PASSWORD=password' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

I would greatly thank in advance any sort of help, I'm sure this is just a newbie problem that I encountered.

deploy.js wont deploy.

I am in the part where we added the dependencies. see code below.

error123

but I am getting this error when I run node
error1234
deploy.js , anyone knows what is going on here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.