In DAML is there any library which support HTTP Push, HTTP Pull requests?

How I can execute my API from inside Daml? In DAML is there any library that supports HTTP Push, and HTTP Pull requests?

Hi @Iqra_Mustafa1,

The short answer is no, there is no way to do that from Daml.

Think of a Daml ledger as a “passive” ledger on which external clients can add entries according to a set of rules. The set of rules is written using the Daml language. When someone wants to write something on the ledger, they have to follow the rules, but more importantly they have to be able to prove that they have followed the rules. This means that other people need to be able to look at the state of the ledger before that additional entry, and then replay the entire computation of all of the rules involved.

If those rules, aka Daml code, allowed you to reach out to an external API, there would be no way for other people to double-check that you have followed the rules, as they couldn’t know what response you got from the API.

This is the same reason why you can’t generate a random number within Daml.

If you need changes to your ledger to trigger external events like HTTP API calls, you’ll have to program that yourself by building an application that listens to the transaction stream, either through the gRPC API or the JSON API.


Can you please elaborate on “here you talk about rules”? What are these rules/ what it means.

And how do people on the network check whether these rules are being followed? Is there any mechanism available in DAML?

The rules I was talking about there is all the Daml logic encoded in choices. Other parties verifying those rules happens automatically as part of the Daml protocol for any action that involves more than one Party.