Smart contract is already deployed and we can view our own smart contract. Now we want to access its method from API?

var tokenContractABI = {your token contract ABI}
var tokenContractAddress = "{your token contract address}"
var tokenContract = eth.contract(tokenContractABI).at(tokenContractAddress)

like at this link https://github.com/ethereum/wiki/wiki/JSON-RPC, Its mentioned that apis are available for default contract and can be accessed from api (localhost:8545) using {"jsonrpc":"2.0","method":"eth_getCode","params":["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x2"],"id":1}

If i want to use my smart contract method to be exposed to API, then how can i use them. can i do it like this ? {"jsonrpc":"2.0","method":"tokenContract_testMethod","params":["", "0x2"],"id":1}

PS: My understanding is admin, personal, eth are default contracts deployed when we start blockchain.? Am i correct ? please validate this point also.

Thanks in advance.!

1 Answer 1


You don't "host" a smart contract. Contracts are deployed to the blockchain so everyone participating on the network has a copy of it.

JSON-RPC has a "data" field that contains all of the information regarding the contract method you are wanting to call (name, inputs, outputs) that is encoded via ABI.

Your Answer

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

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