G-d willing
Hello,
I would like to know how can I, using Daml, sync data between 2 different ledgers.
For example, let’s say I have 2 DAR files that are running on 2 different sandboxes. The first DAR represents my catalog, and the second represents stores’ inventory.
For example, in my first repo I have:
template Product
with
owner: Party
name: Text
serialNumber : Text
where
signatory owner
in my second repo I have:
template Inventory
with
store : Party
productSerialNumber : Text
amountInStock : Int
where
signatory store
Is it possible to fetch data from my inventory repo into my catalog using daml commands? For example, I would like to show a boolean value indicating when a specific product is available in stock somewhere
Thanks,
There is nothing that does what you’re suggesting directly. You could however, write your own ledger client that connects to the ledger API of both ledgers.
However, I’d suggest a different option:
Use the same ledger for both. In the simplest case you can use the same participant and domain for both.
For more complex projects you may want to use two or more participants connected to the domain which allows you to exchange data between the two projects through the usual mechanisms you have in Daml for data sharing (i.e., making another party a signatory or observer).
If a single option isn’t an option for some reason, you can take a look at the early access features for composing multiple domains.
G-d willing
Thanks @cocreature for your reply. I am aware of the [quote=“cocreature, post:2, topic:6576”]
you can take a look at the early access features for composing multiple domains.
[/quote] which you mentioned.
But I am not sure I understood your first option completely. Can you please explain it? Keep in mind that I am not interested in making one DAR file a dependency inside the other, as this does not serve the purpose I am after.
You don’t need to make the DARs depend on each other. Just upload them to the same participant and have your ledger client connect to the ledger API of that participant and read data from both DARs.
G-d willing
I know this option of using 3rd application that will communicate between the two - this is not what I want.
There isn’t anything built into Daml for connecting otherwise separate ledgers. If that’s really your goal, then you have to go the route of going through writing your own ledger client.