I would like to add custom RPC method to geth. I found this question: How to add a custom JSON-RPC endpoint to geth?. But it does not work...

What I did:

1. https://github.com/ethereum/go-ethereum
2. Modified `go-ethereum/internal/ethapi/api.go` file adding new function. 
3. Run docker build --pull --rm -f "Dockerfile" -t goethereum:latest "."

Now I have image, from this image I have created docker-compose.yml to run network with one bootnode and one miner. Calling from Postman:

POST|GET http://localhost:8545
    "jsonrpc": "2.0",
    "method": "eth_myMethod",
    "params": [
        "Hello world!"
    "id": 1

But for the response I get:

    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": -32601,
        "message": "the method eth_myMethod does not exist/is not available"

Is there any line of code I need to add in order to register this new method to be available trough JSON RPC API?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.