Interface Transaction
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Transaction
An Exonum transaction.- See Also:
- Exonum Transactions, Exonum Services
-
-
Method Summary
Modifier and Type Method Description void
execute(TransactionContext context)
Execute the transaction, possibly modifying the blockchain state.default String
info()
Returns the information about this transaction in JSON format.
-
-
-
Method Detail
-
execute
void execute(TransactionContext context) throws TransactionExecutionException
Execute the transaction, possibly modifying the blockchain state.- Parameters:
context
- a transaction execution context, which allows to access the information about this transaction and modify the blockchain state through the included database fork- Throws:
TransactionExecutionException
- 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 failureRuntimeException
- if an unexpected error occurs. A correct transaction implementation must not throw such exceptions. The transaction will be committed as failed (status "panic")
-
info
default String info()
Returns the information about this transaction in JSON format. For example, it is included in the blockchain explorer response to a transaction request as 'content.debug'.By default, no information is provided. If needed, it can be easily implemented with Gson:
@Override public String info() { return JsonSerializer.json().toJson(this); }
-
-