Decorators in Hyperledger Composer Modeling Language

0 votes

I need an asset that would be defined dynamically with N amount of properties which aren't known at this moment and would be defined by the end user.

I assume that this could be done by using decorators in the modeling language, but I didn't find any examples that fully explains how to use them including Front-End interaction.

To be more clear I need an advice on how is it possible to implement something like this as a result:

asset $CustomNameFromFrontEnd {
o String id
o $TypeFromFrontEnd1 $PropertyNameFromFrontEnd1
o $TypeFromFrontEnd2 $PropertyNameFromFrontEnd2
…
o $TypeFromFrontEndN $PropertyNameFromFrontEndN
}
Sep 19, 2018 in Blockchain by digger
• 26,740 points
683 views

1 answer to this question.

0 votes

Define you CustomAsset like mentioned below and you should have no problem:

enum FieldType {
 o String
 o Double
 o Boolean
 o Integer
 o DateTime
 o Long
}

concept customFieldName {
 o String customFieldName
}

concept customFieldValue {
 o FieldType customFieldValue
}

concept customField {
 o customFieldName customFieldName
 o customFieldValue customFieldValue
}

asset CustomAsset identified by id {
 o String id
 o String assetName
 o customField[] customFields
}

transaction CreateCustomAsset {
 o CustomAsset customAsset
}
answered Sep 19, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 26,740 points
2,436 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,455 views
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,740 points
1,008 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,927 views
0 votes
1 answer

Can i use HTTP GET to call external service in Hyperledger Composer?

Right now, the Hyperledger Composer supports only ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,370 points
560 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,370 points
898 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP