INFURA / infura

Official Public Repository for INFURA
https://infura.io
380 stars 62 forks source link

block-chain transaction issue with infura POST 405/Invalid JSON RPC response #106

Open jasham opened 6 years ago

jasham commented 6 years ago

Hello,

I am working on a chrome extension which takes data from block-chain and display in chrome content-script also when user click on that data one transaction happen which will increase the count in block-chain.

I have used react-redux for chrome-extention.

I am able to retrieve data from block-chain please check the below code.

async componentDidMount(){
    const ads = await advertiserAbi.methods
                     .getSpecificAdvertiserDetail(
                     "any address").call();
    this.setState({ads});
}

But the problem is coming in performing transaction. Please check the below code.

async onSubmitForUpdate() {
    console.log("Hello");
    await userAbi.methods
      .setStatistics("any address")
      .send({
      from: "any address"
    });
}

Below is the error which I am getting when checked in console.

POST https://rinkeby.infura.io/<--specific address--> 405 ()

Uncaught (in promise) Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (content.js:108391)
at XMLHttpRequest.request.onreadystatechange `(content.js:119211)

Thanks, Jasham

ec2 commented 6 years ago

Looks like you're trying to make a transaction. Do you have your private key imported properly in your JS app? I ask because we dont host keys on our machines for security purposes, so methods like sendTransaction will not work.

jasham commented 6 years ago

Thanks Tueric.