How to Create Text Map or Map Pair Key and Other Questions

Dear Community,

I’m just in the midst of learning to explore the Daml Hub Workspace for the DA Marketplace Sample App.

As per the Docs, I did follow the steps for the Deployment, and Live Data. I’m stuck at the Live Data for the “Add Contract” - which I’ve scrolled down and selected. This is under “da-marketplace-0.1.23.dit”

I did select the DA.Finance.Asset:AssetDeposit

However, I have the following Error after clicking “Submit” and I realize that I don’t have the following Text Map or Map Pair Key for:

  1. Account ID

  2. Observers

  3. Signatories ID

  4. Asset ID

  5. Ctrl

How to get the Text Map or Map Pair Key for the above?

Also, I would like to ask:

This Asset Deposit allows me to Create a New Digital Currency Asset and I can directly Deposit to a Bank (but the Bank must be set up as Identities and the next step under Ledger Settings) ? → If the answer is No, can you please guide which Contract is to issue New Digital Currency Asset under “da-marketplace-0.1.23.dit”

I noticed that there are 3 items - Admin, User, and Public. If I send it to the Bank (for example), is this under Public?

The server I saw on my Daml Console is running using Canton, which means I need to send an invite to them like, for example, a Bank to connect with me? Hence, to send an invite there is another Smart Contract for this, right?

I think that’s about it for now.

Looking forward to having your guidance for the above.

Thank you.

Hi @Sim_J,

Could you please refer to the documentation you are trying to follow?

Regarding Admin, User and Public, they sound like the default parties on any Daml Hub ledger. You can invite any other user, who will have their own party created upon connecting to your ledger. Please find more information on how other parties can interact with a Daml Hub ledger here:

Kind Regards,
Mate

Hi @Mate_Varga

Thanks for getting back to me… Here is the Doc I followed in the Console Hub → https://hub.daml.com/docs/quickstart/

Thanks for the links provided.

I will revert back should I face any difficulties or problems

Hi @Mate_Varga,

Would like to inform you that for the Identities, I’ve read and did create a new Credential under Service Accounts using as UserAdmin but when I try to apply it into the “Add Contract”, still not working.

We go one step at a time per the screenshot:

For the Account ID - as per the screenshot below, I’ve insert the Credential created for the Service Account (using under UserAdmin)

For the Asset ID - as per the screenshot below, I did insert the Credential created but I don’t know what to put for “Label” (as in what? - currency/unit?), “Version” and “Quantity” (what is the min and max amount?).

For the Observers - as per the screenshot below, I did insert the Credential created and hit the Submit button and I got the Error:

DAML_AUTHORIZATION_ERROR(8,4388e261): Interpretation error: Error: node NodeId(0) (2dc773f8f72eab25fc704f0dd0871980ad422f23d33097c1a5f4ea2c3a49b8bf:DA.Finance.Asset:AssetDeposit) has no signatories

How to resolve the above including the Signatories?

Kindly guide me, thank you.

Hi @Sim_J ,

The issue you’re running into specifically there is that the Signatories are looking for Party IDs, the Service Account credentials are used to fetch JWT tokens for authorization in interacting with the ledger through various web services.

For the marketplace sample app, as the DA.Finance templates are a bit complicated to work with in the Live Data view, it’s recommended to at least at first interact with the app via the UI which you can access by clicking the “subdomain” link at the bottom left of the Ledger page.

Screenshot 2023-06-06 at 7.12.33 PM

It will require you to paste in the User Admin’s JWT token which you can find on the Identities tab. The JWT can be copied by pressing “JWT” next to “Copy” on the right:

For basic depositing of assets, you’ll first want an Issuer (to create the Instrument type that will be deposited), a Custodian that will deposit the assets, and an Investor to receive the assets.

Here’s a quick runthrough of the process of getting the marketplace setup.

You’ll want to create a few parties on the Identities tab: Custodian, Issuer and Investor, then download the parties.json file.

Next, upload the parties.json file in the “Load Parties” on the login page of the UI of the app, then click “Quick Setup”

Set up roles for the parties you’ve created so your market looks like this:

Next, go back to the login screen and log in as the Issuer by selecting them in the dropdown:

On the Issuer’s page, click “Add Custodian” on the right and add a relationship with the Custodian we created on the Quick Setup.

Next go to the “Issue Asset” page, and create an asset.

Log out, then log back in as the Investor, and add the Custodian as a Market relationship in the same way you did for the Issuer.

Now you can either log in as the Custodian and deposit assets to the investor, or since the Custodian has an auto-accept trigger, go to the Investor’s wallet and press the “Deposit” button to issue funds:


After that process, you can take a look at the Live View and see what contracts were created and how they’re filled in. Hopefully that will get you started.

1 Like

Hey @alex.graham,

Thanks so much for your revert because thinking we will be switching to a new version soon this Wednesday, that’s why I thought I will not get a reply.

Thanks so much for your step-by-step guidance on the above. Yes, I admit that the DA Finance template is really complicated and what’s more, I’m new and still on the learning curve.

Sure, I will follow the above step-by-step guide above from you.

If anything I will revert back.

Thanks again.

This is an amazing response Alex. Timely, clear and concise. Thanks from all of us!

2 Likes

Hi @alex.graham,

Would like to inform you that I’ve done the following as guided by you. Herewith are the following feedbacks and questions to you:

  • Able to Assign 3 Role → Issuer, Custodian and Investor

  • Able to Issue Asset → GBP (Great British Pound)


Question - Under Investor (Market Relationships), unable to “Add Custodian”, I think this has been created?

  • Able to Deposit the Asset of GBP 15000


  • Able to try to “Withdraw” as you can see the differences in the Balance Amount of the Asset

Question - Would like to ask for this Withdraw, is there any selection or connected to external wallet? Because I don’t see there’s a wallet section to add. Although it can be withdraw but where is the balance go? Like for example, here in the screenshots, I’ve withdraw the £500 (from £15000), where can I see that the £500 go?

  • Able to view the details in Live Data.

I think that’s the above about it. Looking forward to your response to my questions above as I’m in my learning path.

Thank you.

Hey @Sim_J ,

I’m glad you got things working.

As this is just an example app to show what’s possible with Daml, there is no connection with any external wallet services. Withdrawing the funds will just split the AssetDeposit contract into two contracts - the withdraw amount and the remainder, and the withdraw amount will be archived from the ledger. This is meant to simulate the funds being “withdrawn” from the ledger and transferred to a third party service.

Connections with outside services are possible using Python-based off-ledger automation running in Hub - however this is not available to free tier users and is only available to users with an enterprise license. As @Dave mentioned in this thread, you can fill in this form to get more info on obtaining an enterprise license.

As for your other question, it does look like the relationship already existed. This may be because you already formed a relationship with the custodian as another role with the same party.

Hey @alex.graham,

Thanks for your revert. About that Withdraw concept, I understand. As for the question, is it possible to work on the role within the same party in ready-production?

I will fill up the form but the pricing is like a “pay as you use” concept?

I can’t speak to anything pricing related, I’m sure someone will contact you to discuss those details once you submit the form.

For “As for the question, is it possible to work on the role within the same party in ready-production?”

What do you mean by this? I’m not sure I understand what you are trying to accomplish.

Sorry for the confusion.

Meaning, that if using the ready-production, the same organization cannot be in 3 roles - Issuer/Custodian/Investor? Or do I need to invite another organization as an Investor?

I’m not sure what you mean by “ready-production”, but you can certainly have a party act as multiple roles. If you have multiple entities (say, a bank, a lender, and a borrower), you’d want each entity to have their own party.

With the way Daml privacy works, if you have access to a party, you can see any contracts that they are a signatory or observer on - so for example, you wouldn’t want the borrower to see customer information that the bank has access to.

You can see this in the Live View by clicking on the various parties and seeing which contracts they are able to view.

Again, sorry for the confusion. Okay, noted on the Party itself can act as multiple roles. However, for me to have access to a Party to view all the contracts and how the way they interact, this is meant for the Enterprise User, right? By the way, I have filled up the form successfully. I hope and looking forward to having their reply soon. Thanks

1 Like

You should be able to view the data for the parties you have created in the Live View. If a user of your app creates a party, you will not have access to their data unless you include one one of your parties as a signatory or observer.

It can be useful for other reasons to have an operator type party (often the built in UserAdmin party in Hub) as a signatory on contracts. This would prevent, for example, a user creating an AssetDeposit contract on their own - if the operator party under your control is a signatory on the contracts, the user cannot create it themselves so if you only allow operations on AssetDeposits with your operator as a signatory, you can be confident that these AssetDeposits are valid.

I see. Noted with thanks. I’ve learned a lot from you.

Sorry, I know you’re under the Forum Community Group. I did send a Form for the Enterprise Plan but have yet to receive their reply. Is there another alternative way to contact them?

Thanks. I’ll keep the above of your guidance in mind.