I learned how to use the gRPC UI to explore the Ledger API. Here are my notes (using Daml SDK 2.4.0.)
You do not need a Daml model to try out the
In one terminal window, start the Daml Sandbox ledger with
In a second terminal window, start the gRPC UI with
grpcui -plaintext localhost:6865.
At this point,
grpcuishould launch a browser window. You will know that it is working if the UI includes a dropdown box with the various Ledger API services listed.
In the dropdown, select the “VersionService” and press the Invoke button.
After pressing Invoke, you should see a JSON-formatted response with the version number and other information.
In the “Service name” dropdown, select the “PartyManagementService”.
In the “Method name” dropdown, select “AllocateParty.”
In the “Request Data” section, set the
display_name. I used “owner” and “owner” for both.
Press the Invoke button and look at the Response Data.
Compare the Response Data with the documentation for the AllocatePartyResponse.
Create a simple Daml model. For example,
daml new intro4 --template daml-intro-4.
cdinto the project folder and run
Load your model into the Sandbox ledger. For example,
daml ledger upload-dar .daml/dist/intro4-1.0.0.dar.
Run one of the scripts in your Daml model. For example,
daml script --dar .daml/dist/intro4-1.0.0.dar --ledger-host localhost --ledger-port 6865 --script-name SimpleIou:test_iou
In the gRPC UI, explore the results of running your script. For example, running the PartyManagementService’s ListKnownParties method shows me that the parties Alice, Bob, Charlie, and Dora have all been created.
Use the gRPC UI and the TransactionService’s GetTransactionTrees method to see the transactions visible to a party.
Where did the value for the
filters_by_partykey come from? That was available in the result of the call to ListKnownParties.
After pressing the Invoke button, you should see a collection of GetTransactionTreeResult objects.
You can use the CommandService’s SubmitAndWaitTransaction method to create contracts and exercise choices. However, this can be very tedious and may be of limited utility.