5

Geth allows me to define & load my own custom JavaScript functions with --preload flag or require() on Geth console.

But is there way to access my functions via RPC interface?

Like :

curl -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"mycustom_function()","params":[],"id":123}'

I've seen i can open access to more management APIs with --rpcapi eth,web3,admin,eth,miner but it doesnt work for my custom functions.

1 Answer 1

0

--preload is an easy way to add commonly used functions and objects to geth console. You cannot access them using RPC interface.

For example, if you are interacting with a contract deployed at address addr with ABI abi, you can create a file with MyContract = web3.eth.contract(abi).at(0x1) and preload it using --preload. So you can simply access your contract method using MyContract object inside geth console.

Your Answer

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

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