Can I have a single RPC server for multiple blockchains

+1 vote

I am evaluating MultiChain for an application of mine where I believe I will require four separate blockchains to begin with and may have to add more later on. For example, the first blockchain could be called Customers and contain KYC details for a single customer; the second could be called Agreements and contain details for an agreement between two or more customers; the third could be called Contracts and contain commercials for one or more transactions under a given Agreement; and, the last could be called Transactions and contain details for a single transaction under a specific Contract.

The reason I believe a blockchain would be useful for my application is that the participating parties are geographically separated, may not trust each other, but have to enter into transactions with each other; a scenario where I believe a blockchain should be able to address the trust-deficit.

I have been able to install MultiChain, create four different blockchains, replicate them across multiple machines and access them using the API. However, I have found that MultiChain starts a new RPC server for each blockchain. I would have preferred if multiple blockchains could be accessed using a single RPC server, something like querying multiple relational tables over the same database connection. I have gone through the documentation and the forum but haven't found if (and how) this can be achieved. Can someone shed light on whether this is possible, and if yes, how?

asked Mar 9, 2018 by manish.in
I'm just curious but why not use 4 different streams on the same blockchain?
I think manish.in not using as he said "The reason I believe a blockchain would be useful for my application is that the participating parties are geographically separated, may not trust each other". and stream data will sync on every node for every person or not ?
Streams on a single blockchain will sync to every node in the network. So unless, the parties on blockchain A are different than parties on blockchain B which are different than ... then it doesn't make sense to have 4 different chains.

That's how I read his question.

1 Answer

0 votes

Good question! Unfortunately for now you need a separate RPC server for each blockchain – this is how MultiChain is architected, with each instance supporting a single chain. However you might want to consider three other possibilities:

  • Using the same credentials for each node, so you just need to select the appropriate port when sending the API request.
  • Using a single blockchain, with four streams, each of which represents these different purposes. (Of course that only makes sense if each chain would have the same participants.)
  • Building a very small and simple JSON-RPC proxy that listens on a single port and re-routes the API requests to the appropriate chain, based on the chain_name field. This parameter is optional but is sent automatically by multichain-cli, and other applications can send it as well.
answered Mar 9, 2018 by MultiChain
Thanks for the response Steven. Chains may have different participants for now (and certainly in the future), but assuming that they are not, multiple streams within the same blockchain seems to be a promising option to continue.

Where can I find information on performing simple CRUD operations (getAll, getOne, update, insert, delete) on a stream, using a Java client?
Note that streams don't support a CRUD model, since they are an append-only list. However you should find this Java wrapper to be useful: https://github.com/SimplyUb/MultiChainJavaAPI
...