Quiero conectarme a la red de prueba de Ropsten :
// Is there is an injected web3 instance?
if (typeof web3 !== 'undefined') {
App.web3Provider = web3.currentProvider;
web3 = new Web3(web3.currentProvider);
} else {
// If no injected web3 instance is detected, fallback to the TestRPC.
App.web3Provider = new web3.providers.HttpProvider('http://localhost:8545');
web3 = new Web3(App.web3Provider);
}
Tengo http://localhost:8545 en este código. ¿Cómo me conecto a Ropsten en lugar de http://localhost:8545 ?
Puede ejecutar un nodo local y especificar su cadena usando --chain ropsten
al iniciar geth/parity y conectarse a localhost una vez que se complete la sincronización o puede conectarse a infura.io
:
var web3 = new Web3(new Web3.providers.HttpProvider(
'https://ropsten.infura.io/v3/[infura_project_id]'
));
Para obtener enlaces de infura, utilice: https://infura.io/
Muhammad Shahzad
geth --testnet --chain ropsten --rpc
Recibí este error: uso incorrecto. bandera proporcionada pero no definida: -chaind9ngle
--testnet
felipe rego
web3.eth.personal.currentProvider.connected = false
para mi. Probé Infura ropsten, kovan y ganache local.