public class WireTransaction
extends TraversableTransaction
A transaction ready for serialisation, without any signatures attached. A WireTransaction is usually wrapped
by a class SignedTransaction
that carries the signatures over this payload.
The identity of the transaction is the Merkle tree root of its components (see class MerkleTree
).
For privacy purposes, each part of a transaction should be accompanied by a nonce. To avoid storing a random number (nonce) per component, an initial privacySalt is the sole value utilised, so that all component nonces are deterministically computed.
A few notes about backwards compatibility:
A wire transaction can be backwards compatible, in the sense that if an old client receives a componentGroups with
more elements than expected, it will normally deserialise the required objects and omit any checks in the optional
new fields. Moreover, because the Merkle tree is constructed from the received list of class ComponentGroup
, which internally
deals with bytes, any client can compute the Merkle tree and on the same time relay a class WireTransaction
object even
if she is unable to read some of the "optional" component types. We stress that practically, a new type of
class WireTransaction
should only be considered compatible if and only if the following rules apply:
Modifier and Type | Class and Description |
---|---|
static class |
WireTransaction.Companion |
Modifier and Type | Field and Description |
---|---|
static WireTransaction.Companion |
Companion |
Constructor and Description |
---|
WireTransaction(java.util.List<? extends net.corda.core.transactions.ComponentGroup> componentGroups,
PrivacySalt privacySalt,
DigestService digestService)
A transaction ready for serialisation, without any signatures attached. A WireTransaction is usually wrapped
by a
class SignedTransaction that carries the signatures over this payload.
The identity of the transaction is the Merkle tree root of its components (see class MerkleTree ). |
WireTransaction(java.util.List<? extends net.corda.core.transactions.ComponentGroup> componentGroups) |
WireTransaction(java.util.List<? extends net.corda.core.transactions.ComponentGroup> componentGroups,
PrivacySalt privacySalt)
Old version of
class WireTransaction constructor for ABI compatibility. |
WireTransaction(java.util.List<net.corda.core.contracts.StateRef> inputs,
java.util.List<? extends net.corda.core.crypto.SecureHash> attachments,
java.util.List<? extends net.corda.core.contracts.TransactionState<? extends net.corda.core.contracts.ContractState>> outputs,
java.util.List<? extends net.corda.core.contracts.Command<?>> commands,
Party notary,
TimeWindow timeWindow,
PrivacySalt privacySalt)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
FilteredTransaction |
buildFilteredTransaction(java.util.function.Predicate<java.lang.Object> filtering)
Build filtered transaction using provided filtering functions.
|
void |
checkSignature(TransactionSignature sig)
Checks that the given signature matches one of the commands and that it is a correct signature over the tx.
|
boolean |
equals(java.lang.Object other) |
SecureHash |
getId()
The transaction id is represented by the root hash of Merkle tree over the transaction components.
|
MerkleTree |
getMerkleTree()
Builds whole Merkle tree for a transaction.
Briefly, each component group has its own sub Merkle tree and all of the roots of these trees are used as leaves
in a top level Merkle tree.
Note that ordering of elements inside a
class ComponentGroup matters when computing the Merkle root.
On the other hand, insertion group ordering does not affect the top level Merkle tree construction, as it is
actually an ordered Merkle tree, where its leaves are ordered based on the group ordinal in enum ComponentGroupEnum .
If any of the groups is an empty list or a null object, then SecureHash.Companion.getAllOnesHash is used as its hash.
Also, privacySalt is not a Merkle tree leaf, because it is already "inherently" included via the component nonces. |
PrivacySalt |
getPrivacySalt() |
java.util.Set<java.security.PublicKey> |
getRequiredSigningKeys()
Public keys that need to be fulfilled by signatures in order for the transaction to be valid.
|
int |
hashCode() |
LedgerTransaction |
toLedgerTransaction(ServicesForResolution services)
Looks up identities and attachments from storage to generate a
class LedgerTransaction . A transaction is expected to
have been fully resolved using the resolution flow by this point. |
LedgerTransaction |
toLedgerTransaction(Function1<? super java.security.PublicKey,net.corda.core.identity.Party> resolveIdentity,
Function1<? super net.corda.core.crypto.SecureHash,? extends net.corda.core.contracts.Attachment> resolveAttachment,
Function1<? super net.corda.core.contracts.StateRef,? extends net.corda.core.contracts.TransactionState<?>> resolveStateRef,
Function1<? super net.corda.core.contracts.TransactionState<? extends net.corda.core.contracts.ContractState>,? extends net.corda.core.crypto.SecureHash> resolveContractAttachment)
Deprecated.
|
java.lang.String |
toString() |
getAttachments, getAvailableComponentGroups, getCommands, getComponentGroups, getDigestService, getInputs, getNetworkParametersHash, getNotary, getOutputs, getReferences, getTimeWindow
getInputs, getNetworkParametersHash, getReferences
checkBaseInvariants, filterOutRefs, filterOutputs, findOutRef, findOutput, getInputs, getNotary, getOutput, getOutputStates, getOutputs, getReferences, outRef, outRef, outRefsOfType, outputsOfType, toString
getId
public static WireTransaction.Companion Companion
public WireTransaction(java.util.List<? extends net.corda.core.transactions.ComponentGroup> componentGroups, PrivacySalt privacySalt, DigestService digestService)
A transaction ready for serialisation, without any signatures attached. A WireTransaction is usually wrapped
by a class SignedTransaction
that carries the signatures over this payload.
The identity of the transaction is the Merkle tree root of its components (see class MerkleTree
).
For privacy purposes, each part of a transaction should be accompanied by a nonce. To avoid storing a random number (nonce) per component, an initial privacySalt is the sole value utilised, so that all component nonces are deterministically computed.
A few notes about backwards compatibility:
A wire transaction can be backwards compatible, in the sense that if an old client receives a componentGroups with
more elements than expected, it will normally deserialise the required objects and omit any checks in the optional
new fields. Moreover, because the Merkle tree is constructed from the received list of class ComponentGroup
, which internally
deals with bytes, any client can compute the Merkle tree and on the same time relay a class WireTransaction
object even
if she is unable to read some of the "optional" component types. We stress that practically, a new type of
class WireTransaction
should only be considered compatible if and only if the following rules apply:
public WireTransaction(java.util.List<? extends net.corda.core.transactions.ComponentGroup> componentGroups)
public WireTransaction(java.util.List<? extends net.corda.core.transactions.ComponentGroup> componentGroups, PrivacySalt privacySalt)
Old version of class WireTransaction
constructor for ABI compatibility.
class WireTransaction
public WireTransaction(java.util.List<net.corda.core.contracts.StateRef> inputs, java.util.List<? extends net.corda.core.crypto.SecureHash> attachments, java.util.List<? extends net.corda.core.contracts.TransactionState<? extends net.corda.core.contracts.ContractState>> outputs, java.util.List<? extends net.corda.core.contracts.Command<?>> commands, Party notary, TimeWindow timeWindow, PrivacySalt privacySalt)
public SecureHash getId()
The transaction id is represented by the root hash of Merkle tree over the transaction components.
public java.util.Set<java.security.PublicKey> getRequiredSigningKeys()
Public keys that need to be fulfilled by signatures in order for the transaction to be valid.
public LedgerTransaction toLedgerTransaction(ServicesForResolution services)
Looks up identities and attachments from storage to generate a class LedgerTransaction
. A transaction is expected to
have been fully resolved using the resolution flow by this point.
class LedgerTransaction
public LedgerTransaction toLedgerTransaction(Function1<? super java.security.PublicKey,net.corda.core.identity.Party> resolveIdentity, Function1<? super net.corda.core.crypto.SecureHash,? extends net.corda.core.contracts.Attachment> resolveAttachment, Function1<? super net.corda.core.contracts.StateRef,? extends net.corda.core.contracts.TransactionState<?>> resolveStateRef, Function1<? super net.corda.core.contracts.TransactionState<? extends net.corda.core.contracts.ContractState>,? extends net.corda.core.crypto.SecureHash> resolveContractAttachment)
Looks up identities, attachments and dependent input states using the provided lookup functions in order to
construct a class LedgerTransaction
. Note that identity lookup failure does not cause an exception to be thrown.
This invocation doesn't check various rules like no-downgrade or package namespace ownership.
class LedgerTransaction
public FilteredTransaction buildFilteredTransaction(java.util.function.Predicate<java.lang.Object> filtering)
Build filtered transaction using provided filtering functions.
public MerkleTree getMerkleTree()
Builds whole Merkle tree for a transaction.
Briefly, each component group has its own sub Merkle tree and all of the roots of these trees are used as leaves
in a top level Merkle tree.
Note that ordering of elements inside a class ComponentGroup
matters when computing the Merkle root.
On the other hand, insertion group ordering does not affect the top level Merkle tree construction, as it is
actually an ordered Merkle tree, where its leaves are ordered based on the group ordinal in enum ComponentGroupEnum
.
If any of the groups is an empty list or a null object, then SecureHash.Companion.getAllOnesHash
is used as its hash.
Also, privacySalt is not a Merkle tree leaf, because it is already "inherently" included via the component nonces.
public void checkSignature(TransactionSignature sig)
Checks that the given signature matches one of the commands and that it is a correct signature over the tx.
public java.lang.String toString()
public boolean equals(java.lang.Object other)
public int hashCode()
public PrivacySalt getPrivacySalt()