Package com.exonum.binding.core.service
Interface ExecutionContext
public interface ExecutionContext
An execution context. The context provides access to the blockchain data
for the executing service, and also contains the required information for the transaction
execution.
The context is provided by the framework and users shouldn't create context instances manually except in tests.
- See Also:
Transaction
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ExecutionContext.Builder
Transaction context builder. -
Method Summary
Modifier and Type Method Description static ExecutionContext.Builder
builder()
Returns the builder of the transaction context.java.util.Optional<PublicKey>
getAuthorPk()
Returns public key of the transaction author; orOptional.empty()
if no transaction message corresponds to this context.BlockchainData
getBlockchainData()
Returns the database access object allowing R/W operations.default Prefixed
getServiceData()
Returns the prefixed database access for the executing service.int
getServiceId()
Returns the numeric id of the service instance.java.lang.String
getServiceName()
Returns the name of the service instance.java.util.Optional<HashCode>
getTransactionMessageHash()
Returns SHA-256 hash of the transaction message that carried the payload of the transaction; orOptional.empty()
if no message corresponds to this context.
-
Method Details
-
getServiceData
Returns the prefixed database access for the executing service. Allows R/W operations.A shortcut for
context.getBlockchainData().getExecutingServiceData()
.- See Also:
getBlockchainData()
-
getBlockchainData
BlockchainData getBlockchainData()Returns the database access object allowing R/W operations.- See Also:
getServiceData()
-
getTransactionMessageHash
java.util.Optional<HashCode> getTransactionMessageHash()Returns SHA-256 hash of the transaction message that carried the payload of the transaction; orOptional.empty()
if no message corresponds to this context.Each transaction message is uniquely identified by its hash; the messages are persisted in the blockchain and can be fetched by this hash.
-
getAuthorPk
java.util.Optional<PublicKey> getAuthorPk()Returns public key of the transaction author; orOptional.empty()
if no transaction message corresponds to this context.The corresponding transaction message, if any, is guaranteed to have a correct
CryptoFunctions.ed25519()
signature with this public key. -
getServiceName
java.lang.String getServiceName()Returns the name of the service instance.- See Also:
ServiceInstanceSpec.getName()
-
getServiceId
int getServiceId()Returns the numeric id of the service instance.- See Also:
ServiceInstanceSpec.getId()
-
builder
Returns the builder of the transaction context.
-