I am trying to Create a java services which can directly create particpants , ledgers and query it .
but in the Ping pong example provided , it runs only in local host .
is there any other example you have that shows connection and management to DABLCloud.
Hi @vinoz1990, welcome to the forum! I’ve moved your post to a new thread in the questions section.
Welcome @vinoz1990 to the forum!
Hi @vinoz1990, these are a whole number of examples that work with DABL. Eg
As for your original question, DABL currently only exposes the HTTP JSON API. It does not expose the gRPC Ledger API which is used by the Java bindings in the ping pong example. If you want to call the HTTP JSON API from Java, you can use your favorite HTTP library for that. The Java codegen and bindings we provide are currently not suited for this.
Thanks a lot , Party JWT Tokens generated expire after 24 hours , What is the recommended way to get as far none expiring JWT Tokens for ledger access.
Hi @vinoz1990. DABL in particular supports service accounts as documented here: https://docs.projectdabl.com/api/#service-accounts. The process amounts to requesting a long lived (thirty day) credential pair via the settings page which can be exchanged for an access token repeatedly, by performing a POST, like curl -v -X POST https://login.projectdabl.com/sa/login -u $CRED_ID:$CRED
. Note that the resulting access token will still only be valid for a day, and will encode a party with a randomized value, though it is possible to request another long lived credential for the same service account. The idea is that that service account credential can be stored within your application configuration and used by programs to authenticate themselves.
Just to add to Max’s answer. If you decode the JWT you will see in the payload that there is an expiry time attribute (“exp”) in UNIX epoch seconds (seconds since Jan1 1970) which is checked by the ledger when presented. You can use this as a marker to define when you need to renew (i.e. re-request) a token for your service.
For example, a sample JWT from a test ledger is:
{
“typ”: “JWT”,
“alg”: “RS256”,
“kid”: “a-s-955b7428-bc3a-4453-8fc2-dccd2a60c890”
}
{
“iss”: “projectdabl.com/sa”,
“sub”: “”,
“exp”: 1597686887,
“ledgerId”: “”,
“party”: “”,
“rights”: [
“read”,
“write:create”,
“write:exercise”
]
}
which has an expiry date: 08/17/2020:13:54:47
Edward
A post was split to a new topic: How do you use the different tokens provided by DABL?