class EthereumSynchronous extends AnyRef
All of the methods in this class block until a value is ready to be returned to the caller.
- Alphabetic
- By Inheritance
- EthereumSynchronous
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
EthereumSynchronous(web3j: Web3j)
- web3j
can be shared with EthereumASynchronous
Value Members
-
def
accounts: List[Address]
Invokes the eth_accounts JSON-RPC endpoint.
Invokes the eth_accounts JSON-RPC endpoint.
- returns
the list of addresses owned by the client
-
def
addToGroup(identityAddress: Address): Boolean
Add the given identity address to the Whisper group.
Add the given identity address to the Whisper group.
Invokes the shh_addtogroup JSON-RPC endpoint.
- returns
true if the identity was successfully added to the group
-
def
balance(address: Address, defaultBlockParameter: DefaultBlockParameter): Ether
Invokes the eth_getbalance JSON-RPC endpoint.
Invokes the eth_getbalance JSON-RPC endpoint.
- defaultBlockParameter
either an integer block number, or the string "latest", "earliest" or "pending". See the specification.
- returns
the balance of the account at given address
-
def
blockByHash(blockHash: BlockHash, returnFullTransactionObjects: Boolean): Option[Block]
Invokes the eth_getblockbyhash JSON-RPC endpoint.
Invokes the eth_getblockbyhash JSON-RPC endpoint.
- returns
Some(block object), or None if no block was found
- def blockByNumber(defaultBlockParameter: DefaultBlockParameter, returnFullTransactionObjects: Boolean = false): Option[Block]
-
def
blockNumber: BigInteger
Invokes the eth_blocknumber JSON-RPC endpoint.
Invokes the eth_blocknumber JSON-RPC endpoint.
- returns
the number of the most recent block
- def blockTransactionCountByHash(blockHash: BlockHash): BigInteger
- def blockTransactionCountByNumber(defaultBlockParameter: DefaultBlockParameter): BigInteger
-
def
call(transaction: Transaction, defaultBlockParameter: DefaultBlockParameter): String
Invokes the eth_call JSON-RPC endpoint.
Invokes the eth_call JSON-RPC endpoint.
- returns
value of executed contract, without creating a transaction on the block chain
-
def
code(address: Address, defaultBlockParameter: DefaultBlockParameter): String
Invokes the eth_getcode JSON-RPC endpoint.
Invokes the eth_getcode JSON-RPC endpoint.
- returns
code at a given address
-
def
coinbaseAddress: Address
Invokes the eth_coinbase JSON-RPC endpoint.
Invokes the eth_coinbase JSON-RPC endpoint.
- returns
the client coinbase address
-
def
compileLLL(sourceCode: LLLSource): LLLCompiled
Invokes the eth_compilelll JSON-RPC endpoint.
Invokes the eth_compilelll JSON-RPC endpoint.
- returns
compiled LLL code
- def compileSerpent(sourceCode: SerpentSource): SerpentCompiled
-
def
compileSolidity(sourceCode: SoliditySource): Map[String, Code]
Invokes the eth_compilesolidity JSON-RPC endpoint.
Invokes the eth_compilesolidity JSON-RPC endpoint.
- returns
compiled Solidity code
-
def
compilers: List[Compiler]
Invokes the eth_getcompilers JSON-RPC endpoint.
Invokes the eth_getcompilers JSON-RPC endpoint.
- returns
a list of available compilers found by the underlying Web3J library
-
def
estimateGas(transaction: Transaction): Ether
Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas.
Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas. Invokes the eth_estimategas JSON-RPC endpoint.
- returns
amount of gas estimated
-
def
filterChangesEth(filterId: FilterId): List[LogResult[_]]
Polling method for an eth filter.
Polling method for an eth filter.
Invokes the eth_getfilterchanges JSON-RPC endpoint.
- returns
List of log items since last poll, could be an empty array if nothing has changed since last poll
-
def
filterChangesShh(filterId: FilterId): List[SshMessage]
Polling method for a Whisper filter.
Polling method for a Whisper filter.
Note: calling shh_getMessages will reset the buffer for this method to avoid duplicate messages.
Invokes the shh_getfilterchanges JSON-RPC endpoint.
- returns
List of messages since the last poll; could be Nil if nothing changed since the last poll
-
def
gasPrice: Ether
Invokes the eth_gasprice JSON-RPC endpoint.
Invokes the eth_gasprice JSON-RPC endpoint.
- returns
the current price per gas in wei
-
def
hasIdentity(identityAddress: Address): Boolean
Checks if the client hold the private keys for a given identity.
Checks if the client hold the private keys for a given identity.
Invokes the shh_hasidentity JSON-RPC endpoint.
- returns
returns true if this client holds the private key for that identity
-
def
hashRate(hashRate: String, clientId: String): Boolean
Used for submitting mining hash rate
Used for submitting mining hash rate
Invokes the eth_submithashrate JSON-RPC endpoint.
- returns
true if submitting successfully
-
def
hashRate: BigInteger
Query the hash rate.
Query the hash rate.
Invokes the eth_hashrate JSON-RPC endpoint.
- returns
number of hashes per second that the node is mining at
-
def
isListening: Boolean
Invokes the net_listening JSON-RPC endpoint.
Invokes the net_listening JSON-RPC endpoint.
- returns
true if this client is actively listening for network connections
-
def
isMining: Boolean
Invokes the eth_mining JSON-RPC endpoint.
-
def
isSyncing: Boolean
Invokes the eth_syncing JSON-RPC endpoint.
-
def
logs(filterId: FilterId): List[LogResult[_]]
Invokes the eth_getfilterlogs JSON-RPC endpoint.
Invokes the eth_getfilterlogs JSON-RPC endpoint.
- returns
List of all log items with the matching filter id
-
def
logs(ethFilter: EthFilter): List[LogResult[_]]
Invokes the eth_getlogs JSON-RPC endpoint.
Invokes the eth_getlogs JSON-RPC endpoint.
- returns
List of all log items matching a given filter object
-
def
messages(filterId: FilterId): List[SshMessage]
Invokes the shh_getmessages JSON-RPC endpoint.
Invokes the shh_getmessages JSON-RPC endpoint.
- returns
all Whisper messages matching a filter
-
def
newBlockFilter: FilterId
Creates a filter in the node, to notify when the state changes (logs).
Creates a filter in the node, to notify when the state changes (logs). To check if the state has changed, call
filterChanges
.Invokes the eth_newblockfilter JSON-RPC endpoint.
- returns
filter id
-
def
newFilter(shhFilter: ShhFilter): FilterId
Create filter that notifies the client when whisper message is received that matches the filter options.
Create filter that notifies the client when whisper message is received that matches the filter options.
Invokes the shh_newfilter JSON-RPC endpoint.
- returns
The newly created filter as a BigInteger
-
def
newFilter(ethFilter: EthFilter): FilterId
Creates a filter object, based on filter options, to notify when the state changes (logs).
Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call
filterChanges
.Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:
- [] "anything" - [A] "A in first position (and anything after)" - [null, B] "anything in first position AND B in second position (and anything after)" - [A, B] "A in first position AND B in second position (and anything after)" - [ [A, B], [A, B] ] "(A OR B) in first position AND (A OR B) in second position (and anything after)"
Invokes the eth_newfilter JSON-RPC endpoint.
- returns
filter id
-
def
newGroup: Address
New Whisper group.
New Whisper group.
Invokes the shh_newgroup JSON-RPC endpoint.
- returns
address of the new group
-
def
newIdentity: Address
Invokes the shh_newidentity JSON-RPC endpoint.
Invokes the shh_newidentity JSON-RPC endpoint.
- returns
address of the new whisper identity
- def newPendingTransactionFilter: FilterId
-
def
nextNonce(address: Address): Nonce
Get the next available nonce before creating a transaction
-
def
nonce(address: Address, defaultBlockParameter: DefaultBlockParameter): Nonce
Invokes the eth_gettransactioncount JSON-RPC endpoint.
Invokes the eth_gettransactioncount JSON-RPC endpoint.
- returns
the number of transactions sent from an address
- See also
See Glossary
-
def
peerCount: BigInteger
Invokes the net_peercount JSON-RPC endpoint.
Invokes the net_peercount JSON-RPC endpoint.
- returns
number of peers currently connected to this client
-
def
post(shhPost: ShhPost): Boolean
Sends a whisper message.
Sends a whisper message.
Invokes the shh_post JSON-RPC endpoint.
- returns
true if the message was sent
-
def
sendRawTransaction(signedTransactionData: SignedData): TransactionHash
Invokes the eth_sendrawtransaction JSON-RPC endpoint.
Invokes the eth_sendrawtransaction JSON-RPC endpoint.
- returns
new message call transaction or a contract creation for signed transactions
-
def
sendTransaction(transaction: Transaction): TransactionHash
Invokes the eth_sendtransaction JSON-RPC endpoint.
Invokes the eth_sendtransaction JSON-RPC endpoint.
- returns
a new contract if the
Transaction.data
-
def
sha3(data: String): Keccak256Hash
Invokes the web3_sha3 JSON-RPC endpoint.
Invokes the web3_sha3 JSON-RPC endpoint.
- data
the data to convert into an SHA3 hash
- returns
Keccak-256 hash (not the standardized SHA3-256 hash) of the given data
-
def
sign(address: Address, sha3HashOfDataToSign: String): Signature
Calculates an Ethereum-specific signature with:
Calculates an Ethereum-specific signature with:
sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))
By adding a prefix to the message makes the calculated signature recognisable as an Ethereum-specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.
Note: the address to sign with must be unlocked.
Invokes the eth_sign JSON-RPC endpoint.
- returns
Signature
-
def
storageAt(address: Address, position: BigInteger, defaultBlockParameter: DefaultBlockParameter): String
Invokes the eth_getstorageat JSON-RPC endpoint.
Invokes the eth_getstorageat JSON-RPC endpoint.
- returns
the value from a storage position at a given address
-
def
transactionByBlockHashAndIndex(blockHash: BlockHash, transactionIndex: BigInteger): Optional[Transaction]
Invokes the eth_gettransactionbyblockhashandindex JSON-RPC endpoint.
Invokes the eth_gettransactionbyblockhashandindex JSON-RPC endpoint.
- returns
Some containing transaction information by block hash and transaction index position, or None if no matching transaction was found
-
def
transactionByBlockNumberAndIndex(defaultBlockParameter: DefaultBlockParameter, transactionIndex: BigInteger): Optional[Transaction]
Invokes the eth_gettransactionbyblocknumberandindex JSON-RPC endpoint.
Invokes the eth_gettransactionbyblocknumberandindex JSON-RPC endpoint.
- returns
Some containing transaction information by block hash and transaction index position, or None if no matching transaction was found
-
def
transactionByHash(transactionHash: TransactionHash): Optional[Transaction]
Invokes the eth_gettransactionbyhash JSON-RPC endpoint.
Invokes the eth_gettransactionbyhash JSON-RPC endpoint.
- returns
Future containing Some(transaction object), or None when no transaction was found
-
def
transactionReceipt(transactionHash: TransactionHash): Optional[TransactionReceipt]
Invokes the eth_gettransactionreceipt JSON-RPC endpoint.
Invokes the eth_gettransactionreceipt JSON-RPC endpoint.
- returns
the receipt of a transaction, identified by transaction hash. (Note: receipts are not available for pending transactions.)
-
def
uncleByBlockHashAndIndex(blockHash: BlockHash, transactionIndex: BigInteger): Block
Invokes the eth_getunclebyblockhashandindex JSON-RPC endpoint.
Invokes the eth_getunclebyblockhashandindex JSON-RPC endpoint.
- returns
information about a uncle of a block by hash and uncle index position
-
def
uncleByBlockNumberAndIndex(defaultBlockParameter: DefaultBlockParameter, transactionIndex: BigInteger): Block
Invokes the eth_getunclebyblocknumberandindex JSON-RPC endpoint.
Invokes the eth_getunclebyblocknumberandindex JSON-RPC endpoint.
- returns
information about a uncle of a block by hash and uncle index position
-
def
uncleCountByBlockHash(blockHash: BlockHash): BigInteger
Invokes the eth_getunclecountbyblockhash JSON-RPC endpoint.
Invokes the eth_getunclecountbyblockhash JSON-RPC endpoint.
- returns
the number of uncles in a block from a block matching the given block hash
-
def
uncleCountByBlockNumber(defaultBlockParameter: DefaultBlockParameter): BigInteger
Invokes the eth_getunclecountbyblocknumber JSON-RPC endpoint.
Invokes the eth_getunclecountbyblocknumber JSON-RPC endpoint.
- returns
the number of uncles in a block from a block matching the given block number
-
def
uninstallFilter(filterId: FilterId): Boolean
Uninstalls a filter with given id.
Uninstalls a filter with given id. Should always be called when watch is no longer needed.
Note: Filters time out when they aren't requested with filterChanges for a period of time.
Invokes the eth_uninstallfilter JSON-RPC endpoint.
- returns
true if the filter was successfully uninstalled
-
def
uninstallShhFilter(filterId: FilterId): Boolean
Uninstalls a Whisper filter with the given id.
Uninstalls a Whisper filter with the given id. Should always be called when watch is no longer needed.
Note: Filters time out when they aren't requested with filterChanges for a period of time.
Invokes the shh_uninstallfilter JSON-RPC endpoint.
- returns
true if the filter was successfully uninstalled
-
def
versionNet: String
Invokes the net_version JSON-RPC endpoint.
Invokes the net_version JSON-RPC endpoint.
- returns
the current network id
-
def
versionProtocol: String
Invokes the eth_protocolversion JSON-RPC endpoint.
Invokes the eth_protocolversion JSON-RPC endpoint.
- returns
ethereum protocol version used by this client
-
def
versionShh: String
Invokes the shh_version JSON-RPC endpoint.
Invokes the shh_version JSON-RPC endpoint.
- returns
the current whisper protocol version.
-
def
versionWeb3J: String
Invokes the web3_clientversion JSON-RPC endpoint.
Invokes the web3_clientversion JSON-RPC endpoint.
- returns
the Web3J client version used by this client
- val web3j: Web3j
-
def
work(nonce: Nonce, headerPowHash: Keccak256Hash, mixDigest: Digest): Boolean
Used for submitting a proof-of-work solution.
Used for submitting a proof-of-work solution.
Invokes the eth_submitwork JSON-RPC endpoint.
- returns
true if the provided solution is valid
-
def
work: EthGetWork
Invokes the eth_getwork JSON-RPC endpoint.
Invokes the eth_getwork JSON-RPC endpoint.
- returns
the hash of the current block, the seedHash, and the boundary condition to be met ("target"). The Array with the following properties: DATA, 32 Bytes - current block header pow-hash DATA, 32 Bytes - the seed hash used for the DAG. DATA, 32 Bytes - the boundary condition ("target"), 2^^256 / difficulty.
Deprecated Value Members
-
def
hexFrom(databaseName: String, keyName: String): String
Retrieves binary data from the local database.
Retrieves binary data from the local database.
Invokes the db_gethex JSON-RPC endpoint.
- returns
the retrieved value
- Annotations
- @deprecated
- Deprecated
(Since version ) deprecated
-
def
hexTo(databaseName: String, keyName: String, dataToStore: String): Boolean
Stores binary data in the local database.
Stores binary data in the local database.
Invokes the db_puthex JSON-RPC endpoint.
- returns
true if the value was stored
- Annotations
- @deprecated
- Deprecated
(Since version ) deprecated
-
def
stringFrom(databaseName: String, keyName: String): String
Obtains a string from the local database.
Obtains a string from the local database.
Invokes the db_getstring JSON-RPC endpoint.
- returns
previously stored value
- Annotations
- @deprecated
- Deprecated
(Since version ) deprecated
-
def
stringTo(databaseName: String, keyName: String, stringToStore: String): Boolean
Stores a string in the local database
Stores a string in the local database
Invokes the db_putstring JSON-RPC endpoint.
- returns
true if the value was stored
- Annotations
- @deprecated
- Deprecated
(Since version ) deprecated