Is anyone familiar with a Java API designed to create a party on the Ledger (either via gRPC or JSON API)?
Tried looking for it in the docs and the closest thing i could find is this but it looks like the user management section allows only partial provisioning and not the actual party creation
I tried running Bernhard code but failed on query the Ledger for existing party:
// query the ledger for parties
PartyManagementServiceOuterClass.ListKnownPartiesResponse parties = pms.listKnownParties(PartyManagementServiceOuterClass.ListKnownPartiesRequest.newBuilder().build());
I got this Exception - do you understand it?
Caused by: io.grpc.StatusRuntimeException: INTERNAL: http2 exception
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262) ~[grpc-stub-1.44.0.jar:1.44.0]
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243) ~[grpc-stub-1.44.0.jar:1.44.0]
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156) ~[grpc-stub-1.44.0.jar:1.44.0]
at com.daml.ledger.api.v1.admin.PartyManagementServiceGrpc$PartyManagementServiceBlockingStub.listKnownParties(PartyManagementServiceGrpc.java:474) ~[bindings-java-2.0.0.jar:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyClient.allocateParty(CustomerPolicyClient.java:136) ~[classes/:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyClient.sendCustomerPolicyRequest(CustomerPolicyClient.java:84) ~[classes/:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyRequestApplication.run(CustomerPolicyRequestApplication.java:28) ~[classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:777) ~[spring-boot-2.6.4.jar:2.6.4]
... 10 common frames omitted
Caused by: io.netty.handler.codec.http2.Http2Exception: First received frame was not SETTINGS. Hex dump for first 5 bytes: 1503010002
at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:108) ~[netty-codec-http2-4.1.74.Final.jar:4.1.74.Final]
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.verifyFirstFrameIsSettings(Http2ConnectionHandler.java:338) ~[netty-codec-http2-4.1.74.Final.jar:4.1.74.Final]
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:239) ~[netty-codec-http2-4.1.74.Final.jar:4.1.74.Final]
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:438) ~[netty-codec-http2-4.1.74.Final.jar:4.1.74.Final]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510) ~[netty-codec-4.1.74.Final.jar:4.1.74.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:449) ~[netty-codec-4.1.74.Final.jar:4.1.74.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279) ~[netty-codec-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) ~[netty-transport-4.1.74.Final.jar:4.1.74.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[netty-common-4.1.74.Final.jar:4.1.74.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.74.Final.jar:4.1.74.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.74.Final.jar:4.1.74.Final]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
mmmm… I believe you’re right. I have changed the channel fetch to be TLS supported as below but fails on other thing (during the listKnownParties command)
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262) ~[grpc-stub-1.44.0.jar:1.44.0]
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243) ~[grpc-stub-1.44.0.jar:1.44.0]
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156) ~[grpc-stub-1.44.0.jar:1.44.0]
at com.daml.ledger.api.v1.admin.PartyManagementServiceGrpc$PartyManagementServiceBlockingStub.listKnownParties(PartyManagementServiceGrpc.java:474) ~[bindings-java-2.0.0.jar:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyClient.allocateParty(CustomerPolicyClient.java:149) ~[classes/:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyClient.sendCustomerPolicyRequest(CustomerPolicyClient.java:86) ~[classes/:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyRequestApplication.run(CustomerPolicyRequestApplication.java:28) ~[classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:777) ~[spring-boot-2.6.4.jar:2.6.4]
... 10 common frames omitted
If you are trying to do this against Daml Hub, unfortunately the admin endpoints are not publicly available because we don’t grant admin tokens to users. It’s on our roadmap to improve this situation; we definitely understand this is a pain point!