@FunctionalInterface public interface Transaction
| Modifier and Type | Method and 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.
|
void execute(TransactionContext context) throws TransactionExecutionException
context - a transaction execution context, which allows to access the information about
this transaction and modify the blockchain state through the included database forkTransactionExecutionException - 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")default String info()
By default, no information is provided. If needed, it can be easily implemented with Gson:
@Override
public String info() {
return JsonSerializer.json().toJson(this);
}
Copyright © 2019 Exonum. All rights reserved.