Hi everyone,
I’m working with DAML (using Canton and Daml Script), and I have a quick question about how to access transaction metadata, specifically:
- Transaction ID
- Transaction hash (if available)
- Ledger offsets or node hashes
- Any other unique identifier tied to the transaction or contract creation
For example, I’ve created a contract and received a response like this (simplified below):
{
“contractId”: “00897293…”,
“payload”: {
“instrumentId”: “Bill-002”,
…
},
“completionOffset”: “00000000000000000a”
}
While I do get the contractId
and completionOffset
, I’m trying to extract metadata that refers specifically to the transaction itself (not the payload), like the transaction hash, transaction ID, etc.
My key questions:
- How can I retrieve the transaction hash or transaction ID that corresponds to each contract creation or command?
- Is there a way to listen to or log transactions programmatically, e.g., using the JSON API or gRPC?
- Do I need to rely on Ledger API calls like
GetTransactions
to get this metadata? - Can I extract this information using Daml Script or
canton console
?
I want to refer to contracts by their transaction context and not by my own input data or labels.
Any advice, examples, or documentation links would be greatly appreciated!
Thanks in advance