Evaluate a transaction function and return its results. A transaction proposal will be evaluated on endorsing peers but the transaction will not be sent to the ordering service and so will not be committed to the ledger. This can be used for querying the world state.
Name of the transaction to invoke.
Optional
options: ProposalOptionsTransaction invocation options.
The result returned by the transaction function.
GatewayError Thrown if the gRPC service invocation fails.
Evaluate a transaction function and return its results. A transaction proposal will be evaluated on endorsing peers but the transaction will not be sent to the ordering service and so will not be committed to the ledger. This can be used for querying the world state.
This method is equivalent to:
contract.evaluate(name, { arguments: [ arg1, arg2 ] });
Name of the transaction to invoke.
Transaction arguments.
The result returned by the transaction function.
GatewayError Thrown if the gRPC service invocation fails.
Create a transaction proposal that can be evaluated or endorsed. Supports off-line signing flow.
Name of the transaction to invoke.
Optional
options: ProposalOptionsTransaction invocation options.
Submit a transaction to the ledger and return its result only after it is committed to the ledger. The transaction function will be evaluated on endorsing peers and then submitted to the ordering service to be committed to the ledger.
Name of the transaction to invoke.
Optional
options: ProposalOptionsTransaction invocation options.
The result returned by the transaction function.
EndorseError Thrown if the endorse invocation fails.
SubmitError Thrown if the submit invocation fails.
CommitStatusError Thrown if the commit status invocation fails.
CommitError Thrown if the transaction commits unsuccessfully.
Submit a transaction to the ledger and return immediately after successfully sending to the orderer. The transaction function will be evaluated on endorsing peers and then submitted to the ordering service to be committed to the ledger. The submitted transaction that is returned can be used to obtain to the transaction result, and to wait for it to be committed to the ledger.
Name of the transaction to invoke.
Optional
options: ProposalOptionsTransaction invocation options.
A submitted transaction, providing access to the transaction result and commit status.
GatewayError Thrown if the gRPC service invocation fails.
Submit a transaction to the ledger and return its result only after it is committed to the ledger. The transaction function will be evaluated on endorsing peers and then submitted to the ordering service to be committed to the ledger.
This method is equivalent to:
contract.submit(name, { arguments: [ arg1, arg2 ] });
Name of the transaction to be invoked.
Transaction arguments.
The result returned by the transaction function.
EndorseError Thrown if the endorse invocation fails.
SubmitError Thrown if the submit invocation fails.
CommitStatusError Thrown if the commit status invocation fails.
CommitError Thrown if the transaction commits unsuccessfully.
Represents a smart contract, and allows applications to:
For more complex transaction invocations, such as including private data, transactions can be evaluated or submitted using evaluate or submit respectively. The result of a submitted transaction can be accessed prior to its commit to the ledger using submitAsync.
Example: Evaluate transaction
Example: Submit transaction
Example: Async submit
A finer-grained transaction flow can be employed by using newProposal. This allows retry of individual steps in the flow in response to errors.
Example: Fine-grained submit transaction
Off-line signing
By default, proposal, transaction and commit status messages will be signed using the signing implementation specified when connecting the Gateway. In cases where an external client holds the signing credentials, a default signing implementation can be omitted and off-line signing can be carried out by:
Note that the message digest is created with the hash implementation specified by the hash option passed to the connect function used to create the Gateway instance. For off-line signing implementations that require the entire message content, a none (or no-op) hash implementation should be specified.
Example: Off-line signing