lesson 6 environment variables not working? #5395
Replies: 6 comments 10 replies
-
@rainbowginger Do you have the dotenv dependency installed? leave your repo so I can test with my keys locally. |
Beta Was this translation helpful? Give feedback.
-
I don't understand how they are undefined. I have added the variables in
.env file. How would I define the variables?
Network settings are working when directly assigned only when they are
assigned through a environment variable. The error shows up.
I don't know how to do what you are telling me to do. I don't understand it.
…On Sat, Apr 29, 2023, 20:47 Ali Murtaza < ***@***.***> wrote:
@rainbowginger Your env variables are undefined, and also your network
settings are not correct, make sure to copy the network settings I provided
below image above. —Reply to this email directly, vie
*DuckDuckGo* removed 1 tracker.
More →
<https://duckduckgo.com/-wXmpP8QxS5-03oQoCi36fzMj3aQiUlQpaoQsRaFxbh6x7h6hNVT5kw9iS7GCxm5TqmavjzTTJV69gPWsW0L_jAxEiO6LdcNHI2A_wMA7HGsPvnw63J3F7CTi8UqoMFm1_iJWCvNfWE3u6ZJHzu0PwyLp_hN2PjxVRubENgbClFbfCAuaGzrspebaPObCldPbHcLs0tkARp0eCPPCktbeAY4Z8dx-VBbo9s54JHpLKuD-5guHAAd5c85ckcKsRvUPPuzHAkCmKe0FFNCmWM0xW5-Zq10iDQ>
@rainbowginger <https://github.com/rainbowginger> Your env variables are
undefined, and also your network settings are not correct, make sure to
copy the network settings I provided below image above.
—
Reply to this email directly, view it on GitHub
<#5395 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3NHEVPRTBRGXN6XSUYBZ5TXDUWJXANCNFSM6AAAAAAXQDLAIA>
.
You are receiving this because you were mentioned.Message ID:
<smartcontractkit/full-blockchain-solidity-course-js/repo-discussions/5395/comments/5762196
@github.com>
|
Beta Was this translation helpful? Give feedback.
-
@alymurtazamemon You were correct-this worked networks: {
Sepolia: {
url: process.env.SEPOLIA_RPC_URL,
accounts: [process.env.SEPOLIA_PVT_KEY],
chainId: 11155111,
}, But why is this not working const RPC_URL = process.env.SEPOLIA_RPC_URL;
const PVT_KEY = process.env.SEPOLIA_PVT_KEY;
const CHAIN_ID = process.env.SEPOLIA_CHAIN_ID; |
Beta Was this translation helpful? Give feedback.
-
Thanks @rainbowginger and @alymurtazamemon , I had these same issue and couldn't continue the course , tried searching on different platforms for the solution but couldn't understand any and was getting frustrated. Thank you !!
|
Beta Was this translation helpful? Give feedback.
-
I also faced the same issue while configuring, but I solved it. So I will share my insight. Why
|
Beta Was this translation helpful? Give feedback.
-
Gr8
…On Mon, 12 Jun, 2023, 16:46 Pseudo Code, < ***@***.***> wrote:
I also faced the same issue while configuring, but I solved it. So I will
share my insight. Why const CHAIN_ID = process.env.SEPOLIA_CHAIN_ID; didn't
work because process.env.SEPOLIA_CHAIN_ID is retur
*DuckDuckGo* removed 1 tracker.
More →
<https://duckduckgo.com/-fcssrtdQ4lmib_srSB_zCYaob_UqdCaNIyzQaKzlB_3MqMPIKzPQa2A8D67tD2KacdwdWhCaqJnux2KZouadvBr8WZax1g5x_69BZ7g9ZkmFYOC5aONLUL9R5S9N3vjHvZjY0woGIfsVhPQA8jKOWetchcdq_DFGBhJt>
I also faced the same issue while configuring, but I solved it. So I will
share my insight.
Why const CHAIN_ID = process.env.SEPOLIA_CHAIN_ID; didn't work because
process.env.SEPOLIA_CHAIN_ID is returning a string, and in the network
object the expected type is integer. So you convert the string to integer
using parseInt()
networks: {
sepolia: {
url: SEPOLIA_RPC_URL,
accounts: [SEPOLIA_PVT_KEY],
chainId: parseInt(SEPOLIA_CHAIN_ID),
},
},
—
Reply to this email directly, view it on GitHub
<#5395 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3NHEVKW7UJLROXIUGK7DEDXK327JANCNFSM6AAAAAAXQDLAIA>
.
You are receiving this because you were mentioned.Message ID:
<smartcontractkit/full-blockchain-solidity-course-js/repo-discussions/5395/comments/6151278
@github.com>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am following a solidity hardhat tutorial. Learning to deploy a contract to sepolia testnet.
Shows error when I am using environmental variables to provide network details.I cud deploy the contract if i provide the details directly.
hardhat.config.js
.env
error
when using environment variablesBeta Was this translation helpful? Give feedback.
All reactions