Hyperledger composer How to allow create in transaction Access Control

0 votes

I want to allow users to create an asset but the catch is that the users can do it only kin transaction. And the users outside transaction should not be allowed to do it. How can I implement this?

Nov 8, 2018 in Blockchain by slayer
• 29,350 points
739 views

1 answer to this question.

0 votes

This is how you can do it:

/**
@returns {boolean} boolean true/false
*/
function isInTransactionF() {
    var isInTransaction = true ;  // Boolean
    if(isInTransaction) {
    // if( Boolean(isInTransaction)) { // alternative
      return true; 
    } else{
      return false;
    }   
}

You can call console.log to see the returned result

console.log("The return result is " + isInTransactionF() );`  // true

You can also restrict a participant to create an asset ONLY through a certain transaction class, something like this:

rule CreateAssetThruTxn {
    description: "sample""
    participant(p): "com.example.User"
    operation: CREATE
    resource(r): "com.example.UserAsset"
    transaction(tx): "com.example.AssetCreate"
    condition:(true)
    action: ALLOW 
}

answered Nov 8, 2018 by Omkar
• 69,210 points

Related Questions In Blockchain

0 votes
1 answer

How to control a malicious user in hyperledger fabric?

Fabric is an implementation of blockchain. Blockchain ...READ MORE

answered Jun 29, 2018 in Blockchain by Omkar
• 69,210 points
852 views
0 votes
1 answer

How to control visibility of assets in Hyperledger Fabric?

you can use proof of Authority consensus ...READ MORE

answered Jul 10, 2018 in Blockchain by digger
• 26,740 points
637 views
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,102 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,237 views
+1 vote
1 answer

I am unable to change port of composer-rest-server. Please help!

Use full format for running a business ...READ MORE

answered Mar 27, 2018 in Blockchain by Christine
• 15,790 points
960 views
+1 vote
1 answer
0 votes
1 answer

Hyperledger Fabric: How to access transaction ID in invoke function?

You can access transaction ID in Invoke ...READ MORE

answered Nov 5, 2018 in Blockchain by Omkar
• 69,210 points
2,189 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