问题
I have a network with 5 nodes, where node 1 is Company ABC and node 2 to node 5 are customer1, customer2 , customer3 etc. If customer1 uses Company ABC's product and if he gets a profit , he has to pay certain amount to Company ABC. The profit formula varies from customer to customer and customers should not see other customers profit formula.
One customer can use the formula as A * B , where another customer can use as A+B*10
I referred the link:
When deploying Corda nodes across the network, which JARs have to be exactly the same?
My doubts.
In my scenario , where should I write the formula ? In contract or flow or should I put in a state? Which is recommended ?
Will it be feasible to maintain so many node level jars ?
Can I deploy a contract which is available only in subset of nodes ?
回答1:
1) This logic should go into the flow if you wish to keep the calculation private from customers. All nodes will be utilising the same contract, but your flows can be abstracted out of the CorDapp with the implementation local to the node.
2) Yes, the state and contract will remain the same across all the CorDapps. Only the flows will differ. This will probably end up being a common scenario as any calls to external systems will happen within the flow and you can anticipate how this will differ across entities.
3) You just need to think about designing your contract such that it won't reject any of the values calculated by your profit function and distribute this same contract to everyone.
Take a look at this example CorDapp, it shows different business logic per node
来源:https://stackoverflow.com/questions/51058472/how-to-deploy-a-cordapp-with-a-business-logic-which-is-private-to-selected-parti