How to get your Mainnet endpoint and put it in the code

Plankton5165

Regular Member
Joined
Jul 23, 2019
Messages
210
Reaction score
16
I’ve tried running a code that utilizes an arbitrage flash loan in the past on MetaMask, and it’s said “transaction failed”.

Apparently, it’s because it had a Testnet endpoint and I was trying to deploy on Mainnet, and I need a Mainnet endpoint in order to use Mainnet. What’s also apparent is that I need to get a Mainnet endpoint for myself.

But how do you get your Mainnet endpoint? And don’t you put it somewhere in the code or something?
 
I’ve tried running a code that utilizes an arbitrage flash loan in the past on MetaMask, and it’s said “transaction failed”.

Apparently, it’s because it had a Testnet endpoint and I was trying to deploy on Mainnet, and I need a Mainnet endpoint in order to use Mainnet. What’s also apparent is that I need to get a Mainnet endpoint for myself.

But how do you get your Mainnet endpoint? And don’t you put it somewhere in the code or something?
go to infura.io and get an api key chose ethereum mainnet, thats the endpoint url
 
Turns out I've already had the url long before this thread was created.

However, all it says in the url is this:

404 page not found
 
I hate to be a bother, but I’m still waiting to hear a fix to the 404 error. I’m not here to waste time.

Maybe I just take this to the Infura support team?
 
Last edited:
This is a screenshot of such website.
View attachment 293421
you're supposed to use the endpoint in your code if you just visit it like that it will show an error 404, for example if you use web3.js or any other library to make requests and use the infura endpoint

web3 = Web3(Web3.HTTPProvider(f'https://mainnet.infura.io/v3/{INFURA_API_KEY}'))
factory_contract = web3.eth.contract(address=factory_address, abi=factory_abi)
etc .........
 
This is what I have used in the code already and I still get that error:
const provider = new ethers.providers.JsonRpcProvider({url: 'https://mainnet.infura.io/v3/(API key is here, of course I'm not gonna share it)'})

This is another error I have been getting:
TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')
 
you're supposed to use the endpoint in your code if you just visit it like that it will show an error 404, for example if you use web3.js or any other library to make requests and use the infura endpoint

web3 = Web3(Web3.HTTPProvider(f'https://mainnet.infura.io/v3/{INFURA_API_KEY}'))
factory_contract = web3.eth.contract(address=factory_address, abi=factory_abi)
etc .........
This is what I have used in the code already and I still get that error:
const provider = new ethers.providers.JsonRpcProvider({url: 'https://mainnet.infura.io/v3/(API key is here, of course I'm not gonna share it)'})

This is another error I have been getting:
TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')
Well?

Are you gonna help me?
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock