1

I am trying to build Chaincode in Hyperledger composer where I need to have the concept of token. So I am thinking to create one specific type of participant which will initially hold the tokens. And then this TokenHolder Participant will then transfer Tokens to other participants.

Then I thought maybe creating a participant may not be a good solution. So I am now seeking your expert advice on this issue.

How can you solve this issue? Or if anyone already solved this then lets share and discuss.

1 Answers1

1

Sounds like a Token may be an Asset - you could create your Asset called token with an Relationship (Owner) field. Perhaps the default value for the Owner would be your "Token Administrator" and then as each token Asset is "issued" then you update the Owner field. Perhaps something like this, which I based on the Trade Network sample - but you should look at other samples from the Composer github repo, and also general samples elsewhere on the internet.

/**
 * tkn-net
 */
namespace org.acme.tknnet 
asset Token identified by tknID {
  o String tknID
  o String description
  o String issueGeneration
  o String status
  --> Buyer owner 
}

participant Buyer identified by buyerId {
  o String buyerId
  o String email
  o String organisationName
  o String firstName
  o String lastName
}

transaction IssueToken {
  --> Token openToken
  --> Buyer newOwner
}
R Thatcher
  • 5,550
  • 1
  • 7
  • 15