Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
How to connect to a deployed Polygon testnet contract?

I have a front-end / web3 application that connects to a deployed contract in the rinkeby ethereum networt.

That is possible with the Web3 library, and creating an instance of web3, like the code below:

web3.js

import Web3 from "web3";

window.ethereum.request({ method: "eth_requestAccounts" });

const web3 = new Web3(window.ethereum);

export default web3;

So, in another file, i connect to the deployed contract via contract address and ABI:

contract.js

import web3 from "./web3";

const address = "0x(...)fEb";
const abi = ["(...)"]
export default new web3.eth.Contract(abi, address);

Ok. Then i can call methods on my etherium contract.

But i would like to do it in the mumbai polygon testnet. I already have a deployed / verified contract, and then in the contract.js, I replaced the values, address and abi, but it doesn't work.

I saw something about magic sdk library, but the examples is kind different from this model, and i got kind confused.

So, someone have a hint about how to connect to a mumbai polygon testnet to front-end?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

If you need to communicate with Polygon, you should use Matic.js and use this guide: https://medium.com/the-polygon-blog/beginner-friendly-tutorial-to-matic-js-58f7c24c9744

Answer to the question: To connect to Mumbai Polygon you use:

const polygonNodeOptions = {

  rpcUrl: 'https://rpc-mumbai.maticvigil.com/',

  chainId: 80001,

};
about 4 years ago · Juan Pablo Isaza Relatório

0

From https://mumbai.polygonscan.com/tx/xxxxxx Get the contract address from your deployed contract. which you can find in To: section

deployed contract

then

const getContract = new web3.eth.Contract(yourabi, deployedcontractAddress); const res = await getContract.methods.your-method().call();

Hope this helps.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda