public class SignedTransaction implements TransactionWithSignatures
SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for
a public key (including composite keys) that is mentioned inside a transaction command. SignedTransaction is the top level transaction type
and the type most frequently passed around the network and stored. The identity of a transaction is the hash of Merkle root
of a WireTransaction, therefore if you are storing data keyed by WT hash be aware that multiple different STs may
map to the same key (and they could be different in important ways, like validity!). The signatures on a
SignedTransaction might be invalid or missing: the type does not imply validity.
A transaction ID should be the hash of the class WireTransaction
Merkle tree root. Thus adding or removing a signature does not change it.
class WireTransaction
TransactionWithSignatures.DefaultImpls
Modifier and Type | Field and Description |
---|---|
static net.corda.core.transactions.SignedTransaction.Companion |
Companion
Deprecated.
|
Constructor and Description |
---|
SignedTransaction(SerializedBytes<net.corda.core.transactions.CoreTransaction> txBits,
java.util.List<net.corda.core.crypto.TransactionSignature> sigs)
SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for
a public key (including composite keys) that is mentioned inside a transaction command. SignedTransaction is the top level transaction type
and the type most frequently passed around the network and stored. The identity of a transaction is the hash of Merkle root
of a WireTransaction, therefore if you are storing data keyed by WT hash be aware that multiple different STs may
map to the same key (and they could be different in important ways, like validity!). The signatures on a
SignedTransaction might be invalid or missing: the type does not imply validity.
A transaction ID should be the hash of the
class WireTransaction Merkle tree root. Thus adding or removing a signature does not change it. |
SignedTransaction(CoreTransaction ctx,
java.util.List<net.corda.core.crypto.TransactionSignature> sigs) |
Modifier and Type | Method and Description |
---|---|
FilteredTransaction |
buildFilteredTransaction(java.util.function.Predicate<java.lang.Object> filtering)
Helper function to directly build a
class FilteredTransaction using provided filtering functions,
without first accessing the SignedTransaction.getTx . |
SerializedBytes<net.corda.core.transactions.CoreTransaction> |
component1() |
java.util.List<net.corda.core.crypto.TransactionSignature> |
component2()
a list of signatures from individual
|
SignedTransaction |
copy(SerializedBytes<net.corda.core.transactions.CoreTransaction> txBits,
java.util.List<net.corda.core.crypto.TransactionSignature> sigs)
SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for
a public key (including composite keys) that is mentioned inside a transaction command. SignedTransaction is the top level transaction type
and the type most frequently passed around the network and stored. The identity of a transaction is the hash of Merkle root
of a WireTransaction, therefore if you are storing data keyed by WT hash be aware that multiple different STs may
map to the same key (and they could be different in important ways, like validity!). The signatures on a
SignedTransaction might be invalid or missing: the type does not imply validity.
A transaction ID should be the hash of the
class WireTransaction Merkle tree root. Thus adding or removing a signature does not change it. |
boolean |
equals(java.lang.Object p) |
CoreTransaction |
getCoreTransaction()
Lazily calculated access to the deserialised/hashed transaction data.
|
SecureHash |
getId()
The id of the contained
class WireTransaction . |
java.util.List<net.corda.core.contracts.StateRef> |
getInputs()
Helper to access the inputs of the contained transaction.
|
java.util.ArrayList<java.lang.String> |
getKeyDescriptions(java.util.Set<? extends java.security.PublicKey> keys)
Get a human readable description of where signatures are required from, and are missing, to assist in debugging
the underlying cause.
|
SecureHash |
getNetworkParametersHash()
Helper to access the network parameters hash for the contained transaction.
|
Party |
getNotary()
Helper to access the notary of the contained transaction.
|
NotaryChangeWireTransaction |
getNotaryChangeTx()
Deprecated.
|
java.util.List<net.corda.core.contracts.StateRef> |
getReferences()
Helper to access the unspendable inputs of the contained transaction.
|
java.util.Set<java.security.PublicKey> |
getRequiredSigningKeys()
Specifies all the public keys that require signatures for the transaction to be valid.
|
java.util.List<net.corda.core.crypto.TransactionSignature> |
getSigs()
a list of signatures from individual
|
WireTransaction |
getTx()
Returns the contained
class WireTransaction , or throws if this is a notary change or contract upgrade transaction. |
SerializedBytes<net.corda.core.transactions.CoreTransaction> |
getTxBits() |
int |
hashCode() |
boolean |
isNotaryChangeTransaction()
Deprecated.
|
SignedTransaction |
plus(TransactionSignature sig)
Alias for
SignedTransaction.withAdditionalSignature to let you use Kotlin operator overloading. |
SignedTransaction |
plus(java.util.Collection<net.corda.core.crypto.TransactionSignature> sigList)
Alias for
SignedTransaction.withAdditionalSignatures to let you use Kotlin operator overloading. |
BaseTransaction |
resolveBaseTransaction(ServicesForResolution servicesForResolution)
Resolves the underlying base transaction and then returns it, handling any special case transactions such as
class NotaryChangeWireTransaction . |
ContractUpgradeLedgerTransaction |
resolveContractUpgradeTransaction(ServicesForResolution services)
If
SignedTransaction.getCoreTransaction is a class ContractUpgradeWireTransaction , loads the input states and resolves it to a
class ContractUpgradeLedgerTransaction so the signatures can be verified. |
NotaryChangeLedgerTransaction |
resolveNotaryChangeTransaction(ServicesForResolution services)
If transaction is a
class NotaryChangeWireTransaction , loads the input states and resolves it to a
class NotaryChangeLedgerTransaction so the signatures can be verified. |
NotaryChangeLedgerTransaction |
resolveNotaryChangeTransaction(ServiceHub services)
If transaction is a
class NotaryChangeWireTransaction , loads the input states and resolves it to a
class NotaryChangeLedgerTransaction so the signatures can be verified. |
TransactionWithSignatures |
resolveTransactionWithSignatures(ServicesForResolution services)
Resolves the underlying transaction with signatures and then returns it, handling any special case transactions
such as
class NotaryChangeWireTransaction . |
LedgerTransaction |
toLedgerTransaction(ServiceHub services,
boolean checkSufficientSignatures)
Checks the transaction's signatures are valid, optionally calls
TransactionWithSignatures.verifyRequiredSignatures to
check all required signatures are present, and then calls WireTransaction.toLedgerTransaction
with the passed in interface ServiceHub to resolve the dependencies, returning an unverified
LedgerTransaction. |
java.lang.String |
toString() |
void |
verify(ServiceHub services,
boolean checkSufficientSignatures)
Checks the transaction's signatures are valid, optionally calls
TransactionWithSignatures.verifyRequiredSignatures to check
all required signatures are present. Resolves inputs and attachments from the local storage and performs full
transaction verification, including running the contracts. |
SignedTransaction |
withAdditionalSignature(java.security.KeyPair keyPair,
SignatureMetadata signatureMetadata) |
SignedTransaction |
withAdditionalSignature(TransactionSignature sig)
Returns the same transaction but with an additional (unchecked) signature.
|
SignedTransaction |
withAdditionalSignatures(java.lang.Iterable<net.corda.core.crypto.TransactionSignature> sigList)
Returns the same transaction but with an additional (unchecked) signatures.
|
checkSignaturesAreValid, getKeyDescriptions, getMissingSigners, getRequiredSigningKeys, getSigs, verifyRequiredSignatures, verifySignaturesExcept, verifySignaturesExcept
getId
public static net.corda.core.transactions.SignedTransaction.Companion Companion
public SignedTransaction(SerializedBytes<net.corda.core.transactions.CoreTransaction> txBits, java.util.List<net.corda.core.crypto.TransactionSignature> sigs)
SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for
a public key (including composite keys) that is mentioned inside a transaction command. SignedTransaction is the top level transaction type
and the type most frequently passed around the network and stored. The identity of a transaction is the hash of Merkle root
of a WireTransaction, therefore if you are storing data keyed by WT hash be aware that multiple different STs may
map to the same key (and they could be different in important ways, like validity!). The signatures on a
SignedTransaction might be invalid or missing: the type does not imply validity.
A transaction ID should be the hash of the class WireTransaction
Merkle tree root. Thus adding or removing a signature does not change it.
sigs
- a list of signatures from individual (non-composite) public keys. This is passed as a list of signatureswhen verifying composite key signatures, but may be used as individual signatures where a single key is expected tosign.sigs
- a list of signatures from individual (non-composite) public keys. This is passed as a list of signatures
when verifying composite key signatures, but may be used as individual signatures where a single key is expected to
sign.class WireTransaction
public SignedTransaction(CoreTransaction ctx, java.util.List<net.corda.core.crypto.TransactionSignature> sigs)
public SecureHash getId()
The id of the contained class WireTransaction
.
class WireTransaction
public CoreTransaction getCoreTransaction()
Lazily calculated access to the deserialised/hashed transaction data.
public WireTransaction getTx()
Returns the contained class WireTransaction
, or throws if this is a notary change or contract upgrade transaction.
class WireTransaction
public FilteredTransaction buildFilteredTransaction(java.util.function.Predicate<java.lang.Object> filtering)
Helper function to directly build a class FilteredTransaction
using provided filtering functions,
without first accessing the SignedTransaction.getTx
.
class FilteredTransaction
,
SignedTransaction.getTx
public java.util.List<net.corda.core.contracts.StateRef> getInputs()
Helper to access the inputs of the contained transaction.
public java.util.List<net.corda.core.contracts.StateRef> getReferences()
Helper to access the unspendable inputs of the contained transaction.
public Party getNotary()
Helper to access the notary of the contained transaction.
public SecureHash getNetworkParametersHash()
Helper to access the network parameters hash for the contained transaction.
public java.util.Set<java.security.PublicKey> getRequiredSigningKeys()
Specifies all the public keys that require signatures for the transaction to be valid.
public java.util.ArrayList<java.lang.String> getKeyDescriptions(java.util.Set<? extends java.security.PublicKey> keys)
Get a human readable description of where signatures are required from, and are missing, to assist in debugging the underlying cause.
Note that the results should not be serialised, parsed or expected to remain stable between Corda versions.
public SignedTransaction withAdditionalSignature(java.security.KeyPair keyPair, SignatureMetadata signatureMetadata)
public SignedTransaction withAdditionalSignature(TransactionSignature sig)
Returns the same transaction but with an additional (unchecked) signature.
public SignedTransaction withAdditionalSignatures(java.lang.Iterable<net.corda.core.crypto.TransactionSignature> sigList)
Returns the same transaction but with an additional (unchecked) signatures.
public SignedTransaction plus(TransactionSignature sig)
Alias for SignedTransaction.withAdditionalSignature
to let you use Kotlin operator overloading.
public SignedTransaction plus(java.util.Collection<net.corda.core.crypto.TransactionSignature> sigList)
Alias for SignedTransaction.withAdditionalSignatures
to let you use Kotlin operator overloading.
public LedgerTransaction toLedgerTransaction(ServiceHub services, boolean checkSufficientSignatures)
Checks the transaction's signatures are valid, optionally calls TransactionWithSignatures.verifyRequiredSignatures
to
check all required signatures are present, and then calls WireTransaction.toLedgerTransaction
with the passed in interface ServiceHub
to resolve the dependencies, returning an unverified
LedgerTransaction.
This allows us to perform validation over the entirety of the transaction's contents. WireTransaction only contains StateRef for the inputs and hashes for the attachments, rather than ContractState instances for the inputs and Attachment instances for the attachments.
TransactionWithSignatures.verifyRequiredSignatures
,
WireTransaction.toLedgerTransaction
,
interface ServiceHub
public void verify(ServiceHub services, boolean checkSufficientSignatures)
Checks the transaction's signatures are valid, optionally calls TransactionWithSignatures.verifyRequiredSignatures
to check
all required signatures are present. Resolves inputs and attachments from the local storage and performs full
transaction verification, including running the contracts.
TransactionWithSignatures.verifyRequiredSignatures
public BaseTransaction resolveBaseTransaction(ServicesForResolution servicesForResolution)
Resolves the underlying base transaction and then returns it, handling any special case transactions such as
class NotaryChangeWireTransaction
.
class NotaryChangeWireTransaction
public TransactionWithSignatures resolveTransactionWithSignatures(ServicesForResolution services)
Resolves the underlying transaction with signatures and then returns it, handling any special case transactions
such as class NotaryChangeWireTransaction
.
class NotaryChangeWireTransaction
public NotaryChangeLedgerTransaction resolveNotaryChangeTransaction(ServicesForResolution services)
If transaction is a class NotaryChangeWireTransaction
, loads the input states and resolves it to a
class NotaryChangeLedgerTransaction
so the signatures can be verified.
public NotaryChangeLedgerTransaction resolveNotaryChangeTransaction(ServiceHub services)
If transaction is a class NotaryChangeWireTransaction
, loads the input states and resolves it to a
class NotaryChangeLedgerTransaction
so the signatures can be verified.
public ContractUpgradeLedgerTransaction resolveContractUpgradeTransaction(ServicesForResolution services)
If SignedTransaction.getCoreTransaction
is a class ContractUpgradeWireTransaction
, loads the input states and resolves it to a
class ContractUpgradeLedgerTransaction
so the signatures can be verified.
public java.lang.String toString()
public NotaryChangeWireTransaction getNotaryChangeTx()
Returns the contained class NotaryChangeWireTransaction
, or throws if this is a normal transaction.
class NotaryChangeWireTransaction
public boolean isNotaryChangeTransaction()
public SerializedBytes<net.corda.core.transactions.CoreTransaction> getTxBits()
public java.util.List<net.corda.core.crypto.TransactionSignature> getSigs()
a list of signatures from individual
(non-composite) public keys. This is passed as a list of signatureswhen verifying composite key signatures, but may be used as individual signatures where a single key is expected tosign.
public SerializedBytes<net.corda.core.transactions.CoreTransaction> component1()
public java.util.List<net.corda.core.crypto.TransactionSignature> component2()
a list of signatures from individual
(non-composite) public keys. This is passed as a list of signatureswhen verifying composite key signatures, but may be used as individual signatures where a single key is expected tosign.
public SignedTransaction copy(SerializedBytes<net.corda.core.transactions.CoreTransaction> txBits, java.util.List<net.corda.core.crypto.TransactionSignature> sigs)
SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for
a public key (including composite keys) that is mentioned inside a transaction command. SignedTransaction is the top level transaction type
and the type most frequently passed around the network and stored. The identity of a transaction is the hash of Merkle root
of a WireTransaction, therefore if you are storing data keyed by WT hash be aware that multiple different STs may
map to the same key (and they could be different in important ways, like validity!). The signatures on a
SignedTransaction might be invalid or missing: the type does not imply validity.
A transaction ID should be the hash of the class WireTransaction
Merkle tree root. Thus adding or removing a signature does not change it.
sigs
- a list of signatures from individual (non-composite) public keys. This is passed as a list of signatures
when verifying composite key signatures, but may be used as individual signatures where a single key is expected to
sign.class WireTransaction
public int hashCode()
public boolean equals(java.lang.Object p)