I have a decentralized web application that is hosted in the cloud. I recently deployed a smart contract to two different test networks Ropsten and Goerli - my contract deployed to the Ropsten network is using infura as the host so the provider is https://ropsten.infura.io/v3/{project-id}. my web application is able to access the contract because it's hosted by infura However when I deployed the same contract to Goerli - I set up a local geth node and connected accounts that I created with clef. I deployed the same contract from localhost:8545 (the default geth port) I can interact with my contract locally when I run my application from localhost:3099.
However when users access the application via the web, How do I connect my web application to my locally hosted geth node? When I run my application locally (from a different port) current code below
if (process.env.NETWORK === 'goerli') {
host = process.env.HOST;
port = process.env.GOERLIPORT;
web3address = host + port; // http://localhost:8545
}
var web3 = new Web3(web3address);
Would I have to point my live web application to my public ip instead of localhost:8545? If I'm running my geth node locally?
Are there any tutorials or information on deploying smart contracts from a local geth node and have a web application that lives in the cloud interact with the contract that is hosted on such local node - As always any information is appreciated