Listing of all running parties available via RPC?

(Steve B) #1

Using the RPC interface I can access an individual party/node via CordaRPCClient, but I was looking for a way to get a list of all running nodes; my thinking was perhaps via the controller/nmu node? I noticed there is a getallidentities fun on InMemoryIdentitySevice, but that doesn’t return anything when called from a client RPC (I didn’t expect it to).

I’m writing a client which starts flows etc, but I was curious if there is a way of discovering the active nodes rather than knowing their absolute names in advance and having to call partyfromName with a known name (string)?


(Roger Willis) #2

Hi there, in Corda M13 there is the following which can be accessed via the RPC client:

 * Returns all parties currently visible on the network with their advertised services and an observable of future updates to the network.
fun networkMapFeed(): DataFeed<List<NodeInfo>, NetworkMapCache.MapChange>

You can see that it returns a list of NodeInfo objects.

Also from the ServiceHub (inside a flow) you can access data regarding parties on the network using the networkMapCache. API docs here: Typical usage:

val notary = serviceHub.networkMapCache.getAnyNotary()

(Steve B) #3

Thanks for the useful and speedy reply. Yes, I saw the networkMapCache.getAnyNotary call, but the new facility in M13 to access from the RPClient is perfect. Thanks again.