You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not an issue actually, I only need help with clarification on InfuraProvider and I can't find discussion option here.
I am just into web3 and I have to connect to the sepolia testnest through Infura.
I have the contract address and the ABI ready, I am using ethers.js and metamask.
There's a confusion on what I have seen so far on the implementation.
I can deduce that I have two ways on connecting to the contract.
Using metamask and WebBroswerProvider of ethers.js v6
Uing ethers.js InfuraProvider:
I have implemented the first (WebBroswerProvider or Web3Provider) method now, I can access the current user's account and I have implemented a contract implementation:
There is confusion on the second method (InfuraProvider) about the PRIVATE_KEY and its signer:
const infuraProvider = new ethers.InfuraProvider("sepolia", INFURA_API_KEY); //v6
const privateKey = 'YOUR_PRIVATE_KEY'; //Here is the confusion,
const signer = new ethers.Wallet(privateKey, provider);
const contract = new ethers.Contract(contractAddress, contractABI, signer);
The real concern now is that, I can personally get the private key of my wallet account and test use it like in the last snippet. But if users come to the platform, they would definitely not be doing that, how would the private be gotten the current user if the InfuraProvider is to be used, so as to create a signer for the contract?
Please I need clarifications here, I might not be able to explain clearly or missed the concept, please help clarify everything, what I basically need help with is how to connect to sepolia testnest using InfuraProvider. Thanks
The text was updated successfully, but these errors were encountered:
This is not an issue actually, I only need help with clarification on InfuraProvider and I can't find discussion option here.
I am just into web3 and I have to connect to the sepolia testnest through Infura.
I have the contract address and the ABI ready, I am using ethers.js and metamask.
There's a confusion on what I have seen so far on the implementation.
I can deduce that I have two ways on connecting to the contract.
I have implemented the first (WebBroswerProvider or Web3Provider) method now, I can access the current user's account and I have implemented a contract implementation:
There is confusion on the second method (InfuraProvider) about the PRIVATE_KEY and its signer:
const infuraProvider = new ethers.InfuraProvider("sepolia", INFURA_API_KEY); //v6
const privateKey = 'YOUR_PRIVATE_KEY'; //Here is the confusion,
const signer = new ethers.Wallet(privateKey, provider);
const contract = new ethers.Contract(contractAddress, contractABI, signer);
The real concern now is that, I can personally get the private key of my wallet account and test use it like in the last snippet. But if users come to the platform, they would definitely not be doing that, how would the private be gotten the current user if the InfuraProvider is to be used, so as to create a signer for the contract?
Please I need clarifications here, I might not be able to explain clearly or missed the concept, please help clarify everything, what I basically need help with is how to connect to sepolia testnest using InfuraProvider. Thanks
The text was updated successfully, but these errors were encountered: