Hello DAML Community,
I am currently working on a DAML-based project involving tokenized instruments, and I have encountered an issue while attempting to buy units of a tokenized instrument. The error message I am receiving indicates that the contract is not active, and it appears that the fetch operation is being performed on an inactive contract.
Problem Description:
I am able to successfully create and tokenize instruments, but when attempting to execute the Buy command for a tokenized instrument, I get the following error:
{
“errors”: [
“NOT_FOUND: CONTRACT_NOT_ACTIVE(11,8226547d): Interpretation error: Error: Update failed due to fetch of an inactive contract …”,
],
“ledgerApiError”: {
“code”: 5,
“details”: [
{
“errorCodeId”: “CONTRACT_NOT_ACTIVE”,
“metadata”: {
“participant”: “‘participant1’”,
“category”: “11”,
“tid”: “c6f89defd498877856735777bd9fb5bc”,
“definite_answer”: “false”,
“commands”: “{readAs: , deduplicationPeriod: {duration: ‘PT168H’}, submittedAt: ‘2025-05-08T06:21:43.571735Z’, ledgerId: ‘participant1’, applicationId: ‘app’, submissionId: ‘8226547d-3f68-4326-a260-dd448f3a4580’, actAs: [‘Admin::12207c188703ce0486c8259f06cbbc6969b828d4c567015de3d540112fca46ae669d’, ‘Investor::1220b37fc68d69ab0bb1904e2b702c6126b890efc4ef30d0320cd720d4343f48e80f’], commandId: ‘19098422-a108-47ef-a58c-f81c1c5ff534’, workflowId: }”
},
“type”: “ErrorInfoDetail”
},
…
],
“message”: “CONTRACT_NOT_ACTIVE(11,8226547d): Interpretation error: Error: Update failed due to fetch of an inactive contract …”,
“status”: 404
}
}
Context:
- Ledger Setup: I am using separate configuration files for the Admin and Investor parties, running on different ledger instances:
participant1
(Admin’s ledger): Configured to run onport 8093
participant2
(Investor’s ledger): Configured to run onport 8094
- Workflow:
- Admin creates a new instrument (
Instrument
template). - Admin tokenizes the instrument using the
CreateTokenized
choice and adds the Investor as a viewer. - The Investor attempts to buy units from the tokenized instrument using the
Buy
choice, but this results in the error.
- Admin creates a new instrument (
Possible Cause:
Based on the error, it seems that:
- The Buy command is being issued from
participant2
(Investor’s ledger), but the contract was created onparticipant1
(Admin’s ledger). - The contract may not be shared or visible between the two participants.
- The Admin and Investor parties might not have the correct actAs or readAs rights on the contract, or the contract may have been archived or consumed in a sub-transaction before the Buy command could be executed.
Question:
- How can I ensure that the Investor on
participant2
can correctly fetch and interact with the contract created onparticipant1
? - Do I need to explicitly share or divulge the contract between participants? If so, how can I achieve that in DAML?
- Are there any other common pitfalls when interacting with contracts across different participants that I should be aware of?
Relevant DAML Code:
Here is a simplified version of the code for context:
module Instrument where
template Instrument
with
issuer: Party
assetName: Text
instrumentId: Text
where
signatory issuer
template TokenizedInstrument
with
issuer: Party
assetName: Text
instrumentId: Text
where
signatory issuer
observer issuer
choice Buy : ContractId TokenizedInstrument
with
investor: Party
units: Decimal
controller investor, issuer
do
create TokenizedInstrument with
issuer = issuer
assetName = assetName
instrumentId = instrumentId
Configuration Files:
The configuration for Admin and Investor is as follows:
Admin:
server {
address = “0.0.0.0”
port = 8093
}
ledger-api {
address = “localhost”
port = 5111
}
ledger-id = “participant1”
Investor:
server {
address = “0.0.0.0”
port = 8094
}
ledger-api {
address = “localhost”
port = 5121
}
ledger-id = “participant2”
I suspect the problem might be related to how the contracts are shared or fetched across different ledger participants, or possibly missing rights for actAs/readAs. Any guidance or suggestions to resolve this issue would be greatly appreciated.
Thank you in advance for your help!