DA-Marketplace / External Integration

Dear Sirs,

What are the possibilities for an application running on DAML Hub, to connect to external sources
for data exchange. For example in a DA-Marketplace based application, I would like to update the
clients with their JWT tokens on a daily basis.

Again, I might want to restrict an account based on its overall balance, which I maintain elsewhere.
How can I pass this information on to the DAML application through a REST API for example?

Thank you

Hi Ivan,

Welcome to the forums!

When it comes to connecting to external sources, Daml Hub supports integrations. A standard integration will model the surface of a 3rd-party API through Daml contracts, which can then be acted upon on ledger. A good example of this is the Exberry integration, which is also used by the Marketplace app - GitHub - digital-asset/daml-dit-integration-exberry

The caveat here is that integrations can only be published by Digital Asset for security reasons. If there’s a specific 3rd-party API you’d like to see integrated, let us know, and we might look into developing it and making it available on Hub.

The other option is to write something similar to an integration, but that is hosted by you outside of Hub, and connects to your ledger through the HTTP JSON API to add external data into contracts.

I would like to update the clients with their JWT tokens on a daily basis.

I’m not totally sure what you’re asking for, but Daml Hub’s authentication system works best with users interactively logging in to your app’s UI hosted on Hub. Redistributing JWTs yourself is not officially supported at this time. Is there a feature ask here?

I might want to restrict an account based on its overall balance, which I maintain elsewhere

Also interested in more details about this. How would you expect the account to be restricted? Is it only for trading, or also for deposits/withdrawals?

Re: maintaining the balance, I would suggest inverting the control here, and managing the balance only on ledger as the source of truth. Then the balance can be reported downstream to other components of your system. Without knowing the details of how your entire system is architectured, I can’t say whether this is feasible for you or not, but trying to synchronize balances both on-ledger and off-ledger is going to be tricky.

Hi Alex,
Thank you for your comprehensive reply. To make matters concrete : A client prefers to see the prices and commodities available through another platform. He would like to see the contracts prices available for trade on our DAML Hub application. So in this case there has to be a two way channel by some means to communicate with the DAML application and that platform. It would appear that the HTTP JSON API route is the best bet. Let me have a look, and I shall come back to you.

Hi Alex,

Further to the above, you had mentioned that a program like that provided by Exberry
would be ideal in connecting to an external service. I would like to know if, in the event
that we develop such a program, whether it has to be made publicly available for others? I do understand
that DAML Hub will know as they have to clear it, but do we have to say put the code on Github?

Hi Ivan,

At this time private integrations are not supported in Daml Hub. In this case, having your program be hosted externally and communicating with the ledger via the HTTP JSON API seems like the best approach

Thanks Alex for your advice. I’ll study the JSON API approach.