Complete Part 1 before proceeding.The tutorial illustrates the external signing process using two external parties, Alice and Bob,
leveraging the same Ping Daml Template used in Part 1 of the tutorial.
In Part 1 Alice created a Ping contract.
In Part 2 Bob exercises the Respond choice on the contract and archives it.
The majority of the work involved in external transaction signing was completed in Part 1.
The key addition in Part 2 is utilizing the Ping contract created earlier through explicit disclosure and executing the Respond choice on that contract. The overall process remains similar to Part 1.
This tutorial is for demo purposes.
The code snippets should not be used directly in a production environment.
This tutorial does not repeat the material covered in Part 1 regarding transaction preparation, validation, signing, and execution, as these steps remain largely the same.
Instead, it highlights the key differences from Part 1.
The only significant difference with Part 1 in the metadata is: input_contracts.
This field now contains the input Ping contract. It is also included in the hash of the transaction.
Like in Part 1, the transaction must be validated, hashed and signed.
The hash computation and signature is performed by the execute_and_get_contract_id function provided at the end of Part 1, as shown in the next section.
execute_and_get_contract_id( prepared_exercise_transaction, responder, responder_private_key, responder_fingerprint, hashing_scheme_version,)# The contract was archived by exercising the choice, we get an archived event this timecontract_events = get_events(responder, contract_id)if contract_events.HasField("archived"): print( f"Ping contract with ID {contract_events.archived.archived_event.contract_id} has been archived" )else: raise Exception("Expected an archive event")
By querying the event service and filtering for the contract ID, an archived event is observed, confirming that the contract has been successfully archived.This concludes the external signing tutorial.
The code used in this tutorial is available in the examples/08-interactive-submission folder and can be run with