public interface Transaction
You shall usually extend AbstractTransaction
rather than implementing
this interface.
Modifier and Type | Method and Description |
---|---|
void |
execute(Fork view)
Execute the transaction, possibly modifying the blockchain state.
|
com.exonum.binding.common.message.BinaryMessage |
getMessage()
Returns this transaction as a binary Exonum message.
|
default com.exonum.binding.common.hash.HashCode |
hash()
Returns a hash of this transaction — a SHA-256 hash of the transaction message.
|
default java.lang.String |
info()
Returns some information about this transaction in JSON format.
|
boolean |
isValid()
Returns true if this transaction is valid: its data holds the invariants,
it has a correct signature, etc.
|
boolean isValid()
This method is intended to check the internal consistency of a transaction. You shall not access any external objects in this method (e.g., files, network resources, databases).
If this method returns false, the transaction is considered incorrect, and Exonum discards it. Exonum never records invalid transactions into a blockchain.
void execute(Fork view) throws TransactionExecutionException
view
- a database view, which allows to modify the blockchain stateTransactionExecutionException
- if the transaction cannot be executed normally
and has to be rolled back. The transaction will be committed as failed (status "error"),
the error code with the optional description will be saved into the storage. The client
can request the error code to know the reason of the failure.java.lang.RuntimeException
- if an unexpected error occurs. A correct transaction implementation
must not throw such exceptions. The transaction will be committed as failed
(status "panic").default java.lang.String info()
default com.exonum.binding.common.hash.HashCode hash()
com.exonum.binding.common.message.BinaryMessage getMessage()
Copyright © 2018 Exonum. All rights reserved.