public class SignedTransaction implements NamedByHash
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
Constructor and Description |
---|
SignedTransaction(SerializedBytes<net.corda.core.transactions.WireTransaction> txBits,
java.util.List<? extends net.corda.core.crypto.DigitalSignature.WithKey> 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(WireTransaction wtx,
java.util.List<? extends net.corda.core.crypto.DigitalSignature.WithKey> sigs) |
Modifier and Type | Method and Description |
---|---|
void |
checkSignaturesAreValid()
Mathematically validates the signatures that are present on this transaction. This does not imply that
the signatures are by the right keys, or that there are sufficient signatures, just that they aren't
corrupt. If you use this function directly you'll need to do the other checks yourself. Probably you
want verifySignaturesExcept instead.
|
SerializedBytes<net.corda.core.transactions.WireTransaction> |
component1() |
java.util.List<net.corda.core.crypto.DigitalSignature.WithKey> |
component2() |
SignedTransaction |
copy(SerializedBytes<net.corda.core.transactions.WireTransaction> txBits,
java.util.List<? extends net.corda.core.crypto.DigitalSignature.WithKey> 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) |
SecureHash |
getId()
The id of the contained
class WireTransaction . |
java.util.List<net.corda.core.crypto.DigitalSignature.WithKey> |
getSigs() |
WireTransaction |
getTx()
Lazily calculated access to the deserialised/hashed transaction data.
|
SerializedBytes<net.corda.core.transactions.WireTransaction> |
getTxBits() |
int |
hashCode() |
SignedTransaction |
plus(DigitalSignature.WithKey sig)
Alias for
SignedTransaction.withAdditionalSignature to let you use Kotlin operator overloading. |
SignedTransaction |
plus(java.util.Collection<? extends net.corda.core.crypto.DigitalSignature.WithKey> sigList)
Alias for withAdditionalSignatures to let you use Kotlin operator overloading.
|
LedgerTransaction |
toLedgerTransaction(ServiceHub services,
boolean checkSufficientSignatures)
Checks the transaction's signatures are valid, optionally calls
SignedTransaction.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. |
LedgerTransaction |
toLedgerTransaction(ServiceHub services)
Checks the transaction's signatures are valid, optionally calls
SignedTransaction.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
SignedTransaction.verifyRequiredSignatures
to check all required signatures are present, calls WireTransaction.toLedgerTransaction
with the passed in interface ServiceHub to resolve the dependencies and return an unverified
LedgerTransaction, then verifies the LedgerTransaction. |
void |
verify(ServiceHub services)
Checks the transaction's signatures are valid, optionally calls
SignedTransaction.verifyRequiredSignatures
to check all required signatures are present, calls WireTransaction.toLedgerTransaction
with the passed in interface ServiceHub to resolve the dependencies and return an unverified
LedgerTransaction, then verifies the LedgerTransaction. |
WireTransaction |
verifyRequiredSignatures()
Verifies the signatures on this transaction and throws if any are missing. In this context, "verifying" means
checking they are valid signatures and that their public keys are in the contained transactions
BaseTransaction.mustSign property.
|
WireTransaction |
verifySignaturesExcept(java.security.PublicKey allowedToBeMissing)
Verifies the signatures on this transaction and throws if any are missing which aren't passed as parameters.
In this context, "verifying" means checking they are valid signatures and that their public keys are in
the contained transactions BaseTransaction.mustSign property.
|
SignedTransaction |
withAdditionalSignature(DigitalSignature.WithKey sig)
Returns the same transaction but with an additional (unchecked) signature.
|
SignedTransaction |
withAdditionalSignatures(java.lang.Iterable<? extends net.corda.core.crypto.DigitalSignature.WithKey> sigList)
Returns the same transaction but with an additional (unchecked) signatures.
|
getId
public SignedTransaction(SerializedBytes<net.corda.core.transactions.WireTransaction> txBits, java.util.List<? extends net.corda.core.crypto.DigitalSignature.WithKey> 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 SignedTransaction(WireTransaction wtx, java.util.List<? extends net.corda.core.crypto.DigitalSignature.WithKey> sigs)
public WireTransaction getTx()
Lazily calculated access to the deserialised/hashed transaction data.
public SecureHash getId()
The id of the contained class WireTransaction
.
class WireTransaction
public WireTransaction verifyRequiredSignatures()
Verifies the signatures on this transaction and throws if any are missing. In this context, "verifying" means checking they are valid signatures and that their public keys are in the contained transactions BaseTransaction.mustSign property.
public WireTransaction verifySignaturesExcept(java.security.PublicKey allowedToBeMissing)
Verifies the signatures on this transaction and throws if any are missing which aren't passed as parameters. In this context, "verifying" means checking they are valid signatures and that their public keys are in the contained transactions BaseTransaction.mustSign property.
Normally you would not provide any keys to this function, but if you're in the process of building a partial transaction and you want to access the contents before you've signed it, you can specify your own keys here to bypass that check.
public void checkSignaturesAreValid()
Mathematically validates the signatures that are present on this transaction. This does not imply that the signatures are by the right keys, or that there are sufficient signatures, just that they aren't corrupt. If you use this function directly you'll need to do the other checks yourself. Probably you want verifySignaturesExcept instead.
public SignedTransaction withAdditionalSignature(DigitalSignature.WithKey sig)
Returns the same transaction but with an additional (unchecked) signature.
public SignedTransaction withAdditionalSignatures(java.lang.Iterable<? extends net.corda.core.crypto.DigitalSignature.WithKey> sigList)
Returns the same transaction but with an additional (unchecked) signatures.
public SignedTransaction plus(DigitalSignature.WithKey sig)
Alias for SignedTransaction.withAdditionalSignature
to let you use Kotlin operator overloading.
public SignedTransaction plus(java.util.Collection<? extends net.corda.core.crypto.DigitalSignature.WithKey> sigList)
Alias for withAdditionalSignatures to let you use Kotlin operator overloading.
public LedgerTransaction toLedgerTransaction(ServiceHub services, boolean checkSufficientSignatures)
Checks the transaction's signatures are valid, optionally calls SignedTransaction.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.
SignedTransaction.verifyRequiredSignatures
,
WireTransaction.toLedgerTransaction
,
interface ServiceHub
public LedgerTransaction toLedgerTransaction(ServiceHub services)
Checks the transaction's signatures are valid, optionally calls SignedTransaction.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.
SignedTransaction.verifyRequiredSignatures
,
WireTransaction.toLedgerTransaction
,
interface ServiceHub
public void verify(ServiceHub services, boolean checkSufficientSignatures)
Checks the transaction's signatures are valid, optionally calls SignedTransaction.verifyRequiredSignatures
to check all required signatures are present, calls WireTransaction.toLedgerTransaction
with the passed in interface ServiceHub
to resolve the dependencies and return an unverified
LedgerTransaction, then verifies the LedgerTransaction.
SignedTransaction.verifyRequiredSignatures
,
WireTransaction.toLedgerTransaction
,
interface ServiceHub
public void verify(ServiceHub services)
Checks the transaction's signatures are valid, optionally calls SignedTransaction.verifyRequiredSignatures
to check all required signatures are present, calls WireTransaction.toLedgerTransaction
with the passed in interface ServiceHub
to resolve the dependencies and return an unverified
LedgerTransaction, then verifies the LedgerTransaction.
SignedTransaction.verifyRequiredSignatures
,
WireTransaction.toLedgerTransaction
,
interface ServiceHub
public java.lang.String toString()
public SerializedBytes<net.corda.core.transactions.WireTransaction> getTxBits()
public java.util.List<net.corda.core.crypto.DigitalSignature.WithKey> getSigs()
public SerializedBytes<net.corda.core.transactions.WireTransaction> component1()
public java.util.List<net.corda.core.crypto.DigitalSignature.WithKey> component2()
public SignedTransaction copy(SerializedBytes<net.corda.core.transactions.WireTransaction> txBits, java.util.List<? extends net.corda.core.crypto.DigitalSignature.WithKey> 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)