vechain / web3-gear

Proxy Thor's RESTful API to Eth JSON-RPC, to support Remix, Truffle and more.
MIT License
30 stars 17 forks source link

JSON RPC Error network #30

Open marcomarasco opened 5 years ago

marcomarasco commented 5 years ago

Got the following error during transactions.

Error: Wrong response id "3477728465" (expected: "1") in {"jsonrpc":"2.0","id":1,"method":"net_version","params":[]}

Wonder if there is a particular network id mapping to avoid this.

uldaman commented 5 years ago

I tested this api to get the expected return value.

curl 'http://localhost:8545/' -H 'Content-Type: application/json' --data-binary '{"jsonrpc":"2.0","id":1,"method":"net_version","params":[]}'

{"jsonrpc": "2.0", "result": 5777, "id": 1}

Please check your execution environment.

marcomarasco commented 5 years ago

I tested this api to get the expected return value.

curl 'http://localhost:8545/' -H 'Content-Type: application/json' --data-binary '{"jsonrpc":"2.0","id":1,"method":"net_version","params":[]}'

{"jsonrpc": "2.0", "result": 5777, "id": 1}

Using curl I also get the correct response.

Please check your execution environment.

@uldaman my execution environment uses react + thorify + web3 v.1.0.0-beta.37 + truffle (truffle-contract).

In your opinion what can cause this behavior?

libotony commented 5 years ago

Hi @marcomarasco thorify and web3-gear can not work together, this link will help you understand the difference

marcomarasco commented 5 years ago

@libotony my apologyze, i didn't explain myself very well. Looking at your link the solution I adopted is the one at point 2

  1. An alternative for web application: Thorify + Web3 + Comet

So the environment is.

Local SOLO Thor Node using Thor + Web3-Gear proxy. This allows me to deploy contract on SOLO net using Truffle suite. And log the actions on local chain during development and tests.

dApp using React + Drizzle + Thorify + Web3 + Comet

The error mentioned above in previous messages is retrieved using dApp and truffle-contract when i tried to init a new SC from ABI created during deploy with truffle compile (and migrate).

Have a look at contract export method from truffle-contract for further informations.

uldaman commented 5 years ago

Please show more error information when web3-gear goes wrong.

marcomarasco commented 5 years ago

As you can see here the first one is the error generated via dApp.

The second one is from Google Chrome console when i'm trying to invoke window.web3.eth.net.getNetworkType() method.

@uldaman and @libotony this can be a behavior related to web3? Or "thorified" web3 instance instead?

libotony commented 5 years ago

You are using Comet then the provider is from Comet and I am not sure if this provider is compatible with truffle-contract. What I am sure of is the provider from thorify is not compatible with package truffle-contract, if you are trying to deploy the contract to testnet or mainnet, I would suggest you use https://inspector.vecha.in

marcomarasco commented 5 years ago

@libotony how can i use Truffle to deploy contracts on Testnet?

$ web3-gear --log 1 --debug 1 --host https://sync-testnet.vechain.org --port 8669

This command will fail after few seconds, maybe due timeout.

libotony commented 5 years ago

It is recommended to connect to the local node

lily-57blocks commented 3 years ago

I also met this problem when using web3-gear + @openzeppelin/truffle-upgrades to deploy smart contract.

beantheavg commented 2 years ago

having similar issues with testnet and local node. getting a 500 internal server error. is this project still active?