public static class ServiceHub.DefaultImpls
A service hub is the starting point for most operations you can do inside the node. You are provided with one
when a class annotated with interface CordaService
is constructed, and you have access to one inside flows. Most RPCs
simply forward to the services found here after some access checking.
The APIs are organised roughly by category, with a few very important top level APIs available on the ServiceHub itself. Inside a flow, it's safe to keep a reference to services found here on the stack: checkpointing will do the right thing (it won't try to serialise the internals of the service).
In unit test environments, some of those services may be missing or mocked out.
interface CordaService
Modifier and Type | Method and Description |
---|---|
static SignedTransaction |
addSignature(ServiceHub $this,
SignedTransaction signedTransaction,
java.security.PublicKey publicKey)
Helper method to append an additional signature to an existing (partially)
class SignedTransaction . |
static SignedTransaction |
addSignature(ServiceHub $this,
SignedTransaction signedTransaction)
Helper method to append an additional signature for an existing (partially)
class SignedTransaction
using the default identity signing key of the node. |
static TransactionSignature |
createSignature(ServiceHub $this,
SignedTransaction signedTransaction,
java.security.PublicKey publicKey)
Helper method to create an additional signature for an existing (partially)
class SignedTransaction . Additional
class SignatureMetadata , including the
platform version used during signing and the cryptographic signature scheme use, is added to the signature. |
static TransactionSignature |
createSignature(ServiceHub $this,
SignedTransaction signedTransaction)
Helper method to create a signature for an existing (partially)
class SignedTransaction
using the default identity signing key of the node. The legal identity key is used to sign. Additional
class SignatureMetadata , including the
platform version used during signing and the cryptographic signature scheme use, is added to the signature. |
static TransactionSignature |
createSignature(ServiceHub $this,
FilteredTransaction filteredTransaction,
java.security.PublicKey publicKey)
Helper method to create a signature for a FilteredTransaction. Additional
class SignatureMetadata , including the
platform version used during signing and the cryptographic signature scheme use, is added to the signature. |
static TransactionSignature |
createSignature(ServiceHub $this,
FilteredTransaction filteredTransaction)
Helper method to create a signature for a FilteredTransaction
using the default identity signing key of the node. The legal identity key is used to sign. Additional
class SignatureMetadata , including the platform version used during signing and the cryptographic signature scheme use,
is added to the signature. |
static CordappContext |
getAppContext(ServiceHub $this)
|
static void |
recordTransactions(ServiceHub $this,
boolean notifyVault,
java.lang.Iterable<net.corda.core.transactions.SignedTransaction> txs)
Stores the given
class SignedTransaction s in the local transaction storage and then sends them to the vault for
further processing if notifyVault is true. This is expected to be run within a database transaction. |
static void |
recordTransactions(ServiceHub $this,
boolean notifyVault,
SignedTransaction first,
net.corda.core.transactions.SignedTransaction remaining)
Stores the given
class SignedTransaction s in the local transaction storage and then sends them to the vault for
further processing if notifyVault is true. This is expected to be run within a database transaction. |
static void |
recordTransactions(ServiceHub $this,
SignedTransaction first,
net.corda.core.transactions.SignedTransaction remaining)
Stores the given
class SignedTransaction s in the local transaction storage and then sends them to the vault for
further processing. This is expected to be run within a database transaction. |
static void |
recordTransactions(ServiceHub $this,
java.lang.Iterable<net.corda.core.transactions.SignedTransaction> txs)
Stores the given
class SignedTransaction s in the local transaction storage and then sends them to the vault for
further processing. This is expected to be run within a database transaction. |
static SignedTransaction |
signInitialTransaction(ServiceHub $this,
TransactionBuilder builder,
java.security.PublicKey publicKey)
Helper method to construct an initial partially signed transaction from a
class TransactionBuilder
using keys stored inside the node. Signature metadata is added automatically. |
static SignedTransaction |
signInitialTransaction(ServiceHub $this,
TransactionBuilder builder)
Helper method to construct an initial partially signed transaction from a TransactionBuilder
using the default identity key contained in the node. The legal identity key is used to sign.
|
static SignedTransaction |
signInitialTransaction(ServiceHub $this,
TransactionBuilder builder,
java.lang.Iterable<? extends java.security.PublicKey> signingPubKeys)
Helper method to construct an initial partially signed transaction from a
class TransactionBuilder
using a set of keys all held in this node. |
static LedgerTransaction |
specialise(ServiceHub $this,
LedgerTransaction ltx) |
static <T extends ContractState> |
toStateAndRef(ServiceHub $this,
StateRef stateRef)
Converts the given
class StateRef into a class StateAndRef object. |
public static void recordTransactions(ServiceHub $this, boolean notifyVault, java.lang.Iterable<net.corda.core.transactions.SignedTransaction> txs)
Stores the given class SignedTransaction
s in the local transaction storage and then sends them to the vault for
further processing if notifyVault is true. This is expected to be run within a database transaction.
txs
- The transactions to record.notifyVault
- indicate if the vault should be notified for the update.class SignedTransaction
public static void recordTransactions(ServiceHub $this, boolean notifyVault, SignedTransaction first, net.corda.core.transactions.SignedTransaction remaining)
Stores the given class SignedTransaction
s in the local transaction storage and then sends them to the vault for
further processing if notifyVault is true. This is expected to be run within a database transaction.
class SignedTransaction
public static void recordTransactions(ServiceHub $this, SignedTransaction first, net.corda.core.transactions.SignedTransaction remaining)
Stores the given class SignedTransaction
s in the local transaction storage and then sends them to the vault for
further processing. This is expected to be run within a database transaction.
class SignedTransaction
public static void recordTransactions(ServiceHub $this, java.lang.Iterable<net.corda.core.transactions.SignedTransaction> txs)
Stores the given class SignedTransaction
s in the local transaction storage and then sends them to the vault for
further processing. This is expected to be run within a database transaction.
class SignedTransaction
public static <T extends ContractState> StateAndRef<T> toStateAndRef(ServiceHub $this, StateRef stateRef)
Converts the given class StateRef
into a class StateAndRef
object.
class StateRef
,
class StateAndRef
public static SignedTransaction signInitialTransaction(ServiceHub $this, TransactionBuilder builder, java.security.PublicKey publicKey)
Helper method to construct an initial partially signed transaction from a class TransactionBuilder
using keys stored inside the node. Signature metadata is added automatically.
builder
- The class TransactionBuilder
to seal with the node's signature.
Any existing signatures on the builder will be preserved.publicKey
- The PublicKey matched to the internal java.security.PrivateKey to use in signing this transaction.
If the passed in key is actually a CompositeKey the code searches for the first child key hosted within this node
to sign with.class TransactionBuilder
public static SignedTransaction signInitialTransaction(ServiceHub $this, TransactionBuilder builder)
Helper method to construct an initial partially signed transaction from a TransactionBuilder using the default identity key contained in the node. The legal identity key is used to sign.
builder
- The TransactionBuilder to seal with the node's signature.
Any existing signatures on the builder will be preserved.public static SignedTransaction signInitialTransaction(ServiceHub $this, TransactionBuilder builder, java.lang.Iterable<? extends java.security.PublicKey> signingPubKeys)
Helper method to construct an initial partially signed transaction from a class TransactionBuilder
using a set of keys all held in this node.
builder
- The class TransactionBuilder
to seal with the node's signature.
Any existing signatures on the builder will be preserved.signingPubKeys
- A list of PublicKeys used to lookup the matching java.security.PrivateKey and sign.class SignedTransaction
with the new node signature attached.class TransactionBuilder
public static TransactionSignature createSignature(ServiceHub $this, SignedTransaction signedTransaction, java.security.PublicKey publicKey)
Helper method to create an additional signature for an existing (partially) class SignedTransaction
. Additional
class SignatureMetadata
, including the
platform version used during signing and the cryptographic signature scheme use, is added to the signature.
signedTransaction
- The class SignedTransaction
to which the signature will apply.publicKey
- The PublicKey matching to a signing java.security.PrivateKey hosted in the node.
If the PublicKey is actually a class CompositeKey
the first leaf key found locally will be used
for signing.class TransactionSignature
generated by signing with the internally held java.security.PrivateKey.class SignedTransaction
,
class SignatureMetadata
public static TransactionSignature createSignature(ServiceHub $this, SignedTransaction signedTransaction)
Helper method to create a signature for an existing (partially) class SignedTransaction
using the default identity signing key of the node. The legal identity key is used to sign. Additional
class SignatureMetadata
, including the
platform version used during signing and the cryptographic signature scheme use, is added to the signature.
signedTransaction
- The SignedTransaction to which the signature will apply.class SignedTransaction
,
class SignatureMetadata
public static SignedTransaction addSignature(ServiceHub $this, SignedTransaction signedTransaction, java.security.PublicKey publicKey)
Helper method to append an additional signature to an existing (partially) class SignedTransaction
.
signedTransaction
- The class SignedTransaction
to which the signature will be added.publicKey
- The PublicKey matching to a signing java.security.PrivateKey hosted in the node.
If the PublicKey is actually a class CompositeKey
the first leaf key found locally will be used
for signing.class SignedTransaction
with the addition of the new signature.class SignedTransaction
public static SignedTransaction addSignature(ServiceHub $this, SignedTransaction signedTransaction)
Helper method to append an additional signature for an existing (partially) class SignedTransaction
using the default identity signing key of the node.
signedTransaction
- The class SignedTransaction
to which the signature will be added.class SignedTransaction
with the addition of the new signature.class SignedTransaction
public static TransactionSignature createSignature(ServiceHub $this, FilteredTransaction filteredTransaction, java.security.PublicKey publicKey)
Helper method to create a signature for a FilteredTransaction. Additional class SignatureMetadata
, including the
platform version used during signing and the cryptographic signature scheme use, is added to the signature.
filteredTransaction
- the class FilteredTransaction
to which the signature will apply.publicKey
- The PublicKey matching to a signing java.security.PrivateKey hosted in the node.
If the PublicKey is actually a class CompositeKey
the first leaf key found locally will be used
for signing.class TransactionSignature
generated by signing with the internally held java.security.PrivateKey.class SignatureMetadata
public static TransactionSignature createSignature(ServiceHub $this, FilteredTransaction filteredTransaction)
Helper method to create a signature for a FilteredTransaction
using the default identity signing key of the node. The legal identity key is used to sign. Additional
class SignatureMetadata
, including the platform version used during signing and the cryptographic signature scheme use,
is added to the signature.
filteredTransaction
- the FilteredTransaction to which the signature will apply.class TransactionSignature
generated by signing with the internally held identity java.security.PrivateKey.class SignatureMetadata
public static CordappContext getAppContext(ServiceHub $this)
CordappProvider.getAppContext
public static LedgerTransaction specialise(ServiceHub $this, LedgerTransaction ltx)