Skip to content
Discussions/App Development/Is there a way to make sure I have a valid token with @daml/ledger without attempting to write to the ledger?Forum ↗

Is there a way to make sure I have a valid token with @daml/ledger without attempting to write to the ledger?

App Development3 posts464 views1 likesLast activity Jan 2021
AN
anthonyOP
Jan 2021

The problem I have at the moment is that when I generate a token for use with daml-on-fabric (which by default has no authorization) then any token I generate for an unknown submitting party doesn’t produce an error until I try to write to the ledger.

This means in my o_beer application I can currently start a fabric network, deploy my app, create a token for an unknown party, and read from the ledger without error (just an empty response) until I try to write. I’d really like to test the token immediately after I create it to ensure that the token is valid and without having to try to write something to the ledger every time I create a token.

I also realize this may not be the best way and I should probably be using a certificate authority or something to have an authenticated Fabric ledger. If that’s the case are there any existing applications with a workflow that outlines these steps?

CO
cocreature
Jan 2021

If you have an admin token (which is trivial to get if your ledger has authorization disabled) you could query the parties endpoint and see if the party has been allocated.

I’m a bit surprised that read requests for unallocated parties succeed but I can reproduce that locally with daml sandbox --implicit-party-allocation=false over the gRPC API so it’s not a bug in Fabric or in the JSON API.

AN
anthony
Jan 2021

Github issue addressing unallocated party reads:

github.com/digital-asset/daml

Read requests (for example on the ACS service or transaction service) succeed even if the party you are reading as has...

Also found this wonderful doc that discusses identity management and might be informative for others.

← Back to Discussions