0
votes

I am making a system in Corda in which a person can put his insurance policy details in the Corda network and can sell this to another person. Means policy belongs to one person at a time. I could not figure out which type of state Insurance Policy should be? How should I represent Policy in Corda?

I am facing two issues :

1.) which state type to use for creating Policy because, If a make Corda as a simple ContractState then how would I add it in only the seller's vault because firstly seller wants it to be visible in its own vault only, so as per my guessings there should be only one party involved in the transaction which is seller itself.

2.) How to send it to another person because now two parties will be involved in the transaction.

1

1 Answers

0
votes

1- You can use linearState as a linearID can be used to refer to states (any version can be fetched from vault) and you can track the evolution of state till the version you were having it in your vault. It's better than using contract state in a sense that that can be referred to by only stateRef and you'll be able to fetch just a specific version of state.

2- You'll have to use an ownerOfPolicy field and can set assign the party to it. Also, in participants list you can just return the owner of state. And use (define it) a command, say transfer and define rules in it that only the owner can make this transfer. This way once the transfer is made it will be present in (now) owner's vault only for the subsequent evolution steps for the same state.