Package com.exonum.binding.core.service
Interface ExecutionContext
-
public interface ExecutionContextAn 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 classExecutionContext.BuilderTransaction context builder.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static ExecutionContext.Builderbuilder()Returns the builder of the transaction context.Optional<com.exonum.binding.common.crypto.PublicKey>getAuthorPk()Returns public key of the transaction author; orOptional.empty()if no transaction message corresponds to this context.BlockchainDatagetBlockchainData()Returns the database access object allowing R/W operations.default PrefixedgetServiceData()Returns the prefixed database access for the executing service.intgetServiceId()Returns the numeric id of the service instance.StringgetServiceName()Returns the name of the service instance.Optional<com.exonum.binding.common.hash.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 Detail
-
getServiceData
default Prefixed 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
Optional<com.exonum.binding.common.hash.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
Optional<com.exonum.binding.common.crypto.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
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
static ExecutionContext.Builder builder()
Returns the builder of the transaction context.
-
-