Package org.consensusj.ethereum.jsonrpc
Class EthereumClient
java.lang.Object
org.consensusj.jsonrpc.DefaultRpcClient
org.consensusj.ethereum.jsonrpc.EthereumClient
- All Implemented Interfaces:
AutoCloseable
,AsyncSupport
,JsonRpcClient<JavaType>
,JsonRpcTransport<JavaType>
A partial implementation of an Ethereum RPC Client
How to mine just a little for "reg test mode" in Eth:
https://github.com/ethereum/go-ethereum/wiki/bitchin-tricks
See also:
https://github.com/ethereum/go-ethereum/wiki/Management-APIs
-
Nested Class Summary
Nested classes/interfaces inherited from class org.consensusj.jsonrpc.DefaultRpcClient
DefaultRpcClient.TransientErrorMapper<T>, DefaultRpcClient.TransportFactory
Nested classes/interfaces inherited from interface org.consensusj.jsonrpc.AsyncSupport
AsyncSupport.ThrowingSupplier<T>, AsyncSupport.TransientErrorFilter
-
Field Summary
Fields inherited from class org.consensusj.jsonrpc.DefaultRpcClient
jsonRpcVersion, mapper
-
Constructor Summary
ConstructorDescriptionEthereumClient
(URI server, String rpcuser, String rpcpassword) Construct a JSON-RPC client from URI, username, and password -
Method Summary
Modifier and TypeMethodDescriptionlong
ethCall
(EthTxCallObject callObject, String block) ethGetBalance
(String address, String block) boolean
minerStart
(int numberOfThreads) boolean
Returns Keccak-256 (not the standardized SHA3-256) of the given dataMethods inherited from class org.consensusj.jsonrpc.DefaultRpcClient
collectionTypeForClasses, collectionTypeForClasses, defaultType, getJsonRpcVersion, getMapper, getServerURI, identityTransientErrorMapper, pollOnce, responseTypeFor, responseTypeFor, sendRequestForResponseAsync, sendRequestForResponseAsync, statusFromErrorResponse, temporarilyUnavailableResponse, typeForClass, waitForServer, waitForServer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.consensusj.jsonrpc.AsyncSupport
getDefaultAsyncExecutor, supplyAsync, supplyAsync
Methods inherited from interface org.consensusj.jsonrpc.JsonRpcClient
buildJsonRequest, buildJsonRequest, close, send, send, send, send, send, send, sendAsync, sendAsync, sendAsync, sendAsync, sendAsync
Methods inherited from interface org.consensusj.jsonrpc.JsonRpcTransport
sendRequestForResponse, syncGet
-
Field Details
-
DEFAULT_LOCALHOST
-
-
Constructor Details
-
EthereumClient
Construct a JSON-RPC client from URI, username, and password- Parameters:
server
- server URI should not contain username/passwordrpcuser
- username for the RPC HTTP connectionrpcpassword
- password for the RPC HTTP connection
-
EthereumClient
public EthereumClient()
-
-
Method Details
-
ethProtocolVersion
- Throws:
IOException
JsonRpcStatusException
-
ethBlockNumber
- Throws:
IOException
JsonRpcStatusException
-
ethGetBalance
public BigInteger ethGetBalance(String address, String block) throws IOException, JsonRpcStatusException - Throws:
IOException
JsonRpcStatusException
-
ethCall
public String ethCall(EthTxCallObject callObject, String block) throws IOException, JsonRpcStatusException - Throws:
IOException
JsonRpcStatusException
-
web3ClientVersion
- Throws:
IOException
JsonRpcStatusException
-
web3Sha3
Returns Keccak-256 (not the standardized SHA3-256) of the given data- Parameters:
dataToHash
-- Returns:
- Keccak-256 hash of the data
- Throws:
IOException
JsonRpcStatusException
-
minerStart
- Throws:
IOException
JsonRpcStatusException
-
minerStop
- Throws:
IOException
JsonRpcStatusException
-