Package com.exonum.binding.service
Interface Node
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.exonum.binding.common.crypto.PublicKey
getPublicKey()
Returns the service public key of this node.com.exonum.binding.common.hash.HashCode
submitTransaction(RawTransaction rawTransaction)
Creates a transaction from the given parameters, signs it with the node service key, and then submits it into Exonum network.<ResultT> ResultT
withSnapshot(java.util.function.Function<Snapshot,ResultT> snapshotFunction)
Performs a given function with a snapshot of the current database state.
-
-
-
Method Detail
-
submitTransaction
com.exonum.binding.common.hash.HashCode submitTransaction(RawTransaction rawTransaction) throws InternalServerError
Creates a transaction from the given parameters, signs it with the node service key, and then submits it into Exonum network. This node does not execute the transaction immediately, but broadcasts it to all the nodes in the network. Then each node verifies the transaction and, if it is correct, adds it to the pool of unconfirmed transactions. The transaction is executed later asynchronously.Incorrect transactions (e.g., the payload of which cannot be deserialized by the target service, or which have unknown message id) are rejected by the network.
Be aware that each node has its own service key pair, therefore invocations of this method on different nodes will produce different transactions.- Parameters:
rawTransaction
- transaction parameters to include in transaction message- Returns:
- hash of the transaction message created by the framework
- Throws:
InternalServerError
- if this node failed to process the transactionjava.lang.NullPointerException
- if the transaction is null- See Also:
Blockchain.getTxMessages()
-
withSnapshot
<ResultT> ResultT withSnapshot(java.util.function.Function<Snapshot,ResultT> snapshotFunction)
Performs a given function with a snapshot of the current database state.- Type Parameters:
ResultT
- a type the function returns- Parameters:
snapshotFunction
- a function to execute- Returns:
- the result of applying the given function to the database state
-
getPublicKey
com.exonum.binding.common.crypto.PublicKey getPublicKey()
Returns the service public key of this node. The corresponding private key is used for signing transactions insubmitTransaction(RawTransaction)
.This key is stored under "service_public_key" key in the node configuration file.
- Throws:
java.lang.IllegalStateException
- if the node proxy is closed
-
-