There are two popular ways you can do:
Connecting to testnet/mainnet:
- Use geth command with mode to sync Eth block chain. You no need to trust any 3rd party vendor. Use
fast mode to download database is fast and less space when compare to full mode.
--syncmode "fast". I'll recommend this process.
geth [config] --testnet --syncmode "full"
After run above command you will find HTTP endpoint opened: http://127.0.0.1:8545 This is RPC mode, ip. Using this ip you can able to connect.
- Connecting to provider, If you don't have time to sync and space. Then you can connect with dev's are trying to connect. You need to create an account infura for getting Infura_Access_Token. Account creation in Infura is free.
For local network, any way you will use geth client with your own genesis.json.
For more details, refer below link:
Integration guide for infura provider with truffle
How to step multiple networks in local system
Requesting Test Ethers