3

I'm trying to debug & test a smart contract I developed, however doing so on testnets takes a lot of time and I wanted to test properly on local node.

I can create the node and deploy the contract, transfer from account to another in metamask, every thing works fine, except when I go to http://127.0.0.1:8545/ in browser, I get this error:

{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"Parse error: Unexpected end of JSON input"}} 

I've tried both brave & chrome, I tried creating a different hardhat project, same error.

What can I do? Thanks!

2
  • 1
    What do u expect to see? Commented Feb 5, 2022 at 15:14
  • I really don't know, I just expected to see something, is this normal? Commented Feb 5, 2022 at 21:21

1 Answer 1

6

This is an expected output. It's a response to the empty request body:

# request curl 'http://127.0.0.1:8545/' --data-raw '' 
# response {"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"Parse error: Unexpected end of JSON input"}} 

If you sent a valid JSON-RPC request body (which is generally not possible from the browser address bar, unless you have installed some kind of browser extension), you'd get a valid response:

# request curl 'http://127.0.0.1:8545' --data-raw '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":1}' 
# response {"jsonrpc":"2.0","id":1,"result":true} 
Sign up to request clarification or add additional context in comments.

1 Comment

Understood, thanks for the clear explanation !

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.