1

I am trying to deploy a contract using Remix IDE and Metamask. But whenever I try to create to deploy the contract I get the error

Cannot create an account: Error: Internal JSON-RPC error.

I am using Injected web3 and have followed every step on here:

https://medium.com/@merunasgrincalaitis/the-ultimate-end-to-end-tutorial-to-create-and-deploy-a-fully-descentralized-dapp-in-ethereum-18f0cf6d7e0e

Can anyone direct me as to why this is happening?

2

It depends on where you point your RPC connection. It was probably a local instance of TestRPC/Ganache, which has been bugging like that lately. Just restart it and make sure you tell Metamask the correct port. If it's the Ropsten/Main Network, try restarting your Browser.

0

I am working with Web3j 4.1.1 and have been having the same problem. I was running a local (i.e. private/custom) block chain using geth, thinking it would be an ideal way to do my earliest tests in privacy instead of using or abusing an actual testnet by littering it with dozens hundreds of abandoned or broken contract instances. I also hoped to learn a lot.

While the latter part came true, no contract deployed onto my local private blockchain ever worked. First I tried using Web3j to deploy the contract, while inspecting it in MetaMask. While it deployed successfully (and consumed some eth in gas costs), all subsequent calls to the contract returned 0.

I next tried deploying the same contract using MetaMask (both by deploying the code, and by pointing to the previous existing address), and in all cases I got the same error you did:

Internal JSON-RPC error

I tried stopping and restarting geth, to no avail.

However, when I instead started a new geth pointed at Rinkeby, everything started to work. The Web3J contract deployment worked perfectly, and all calls I've made to the contract are returning correct values, using both Web3j and MetaMask.

I never figured out why the local blockchain wouldn't work and it remains a mystery. If anyone would like to help diagnose, here are the geth commands I used:

Local (unable to interact with deployed contract):

geth --datadir . --keystore ./keystore --networkid 8888 --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal,admin --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --mine --miner.threads=1 --miner.gasprice "1000000000" --unlock 0 --password ./config/default-password.txt

Rinkeby (able to deploy and interact with contract):

geth --rinkeby --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal,admin --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.