Hyperledger Fabric - Asset Management App
The Asset Management App tests the behavior of asset management chaincode. The app bootstraps a non-validating peer and constructs fabric confidential transactions to deploy, invoke and query the asset management chaincode as described below.
In particular, we consider a scenario in which we have the following parties:
- Alice is the chaincode deployer;
- Bob is the chaincode administrator;
- Charlie and Bob are asset owners;
that interact in the following way:
- Alice deploys and assigns the administrator role to Bob;
- Bob assigns the asset 'Picasso' to Charlie;
- Charlie transfers the ownership of 'Picasso' to Dave;
In the following sections, we describe in more detail the interactions described above that the asset management app exercises.
Alice deploys and assigns the administrator role to Bob
The following actions take place:
- Alice obtains, via an out-of-band channel, a TCert of Bob, let us call this certificate BobCert;
- Alice constructs a deploy transaction, as described in application-ACL.md, setting the transaction metadata to DER(BobCert).
- Alice submits the deploy transaction to the fabric network.
Bob is now the administrator of the chaincode.
Notice that, to assign ownership of assets, Bob has to use BobCert to authenticate his invocations.
Bob assigns the asset 'Picasso' to Charlie
- Bob obtains, via an out-of-band channel, a TCert of Charlie, let us call this certificate CharlieCert;
- Bob constructs an invoke transaction, as described in application-ACL.md using BobCert to gain access, to invoke the assign function passing as parameters ('Picasso', Base64(DER(CharlieCert))).
- Bob submits the transaction to the fabric network.
Charlie is now the owner of 'Picasso'.
Notice that, to transfer the ownership of 'Picasso', Charlie has to use CharlieCert to authenticate his invocations.
Charlie transfers the ownership of 'Picasso' to Dave
- Charlie obtains, via an out-of-band channel, a TCert of Dave, let us call this certificate DaveCert;
- Charlie constructs an invoke transaction, as described in application-ACL.md using CharlieCert, to invoke the transfer function passing as parameters ('Picasso', Base64(DER(DaveCert))).
- Charlie submits the transaction to the fabric network.
Dave is now the owner of 'Picasso'
How To run the Asset Management App
In order to run the Asset Management App, the following steps are required.
Create app's configuration file
The app needs a 'core.yaml' configuration file in order to bootstrap a non-validating peer. This configuration file can be copied from fabric/peer/core.yaml.
Setup the fabric network
We consider the fabric network as described here: https://github.com/hyperledger/fabric/blob/master/consensus/docker-compose-files/compose-consensus-4.md that consists of 4 validators and the membership service.
Before setting up the network, the fabric/peer/core.yaml file must be modified by setting the following properties as specified below:
- security.enabled = true
- security.privacy = true
Moreover, the 'core.yaml' file used to configure the app must point to the fabric network setup above. This can be done by replacing:
- '0.0.0.0' with 'vp0';
- 'localhost' with membersrvc.
Run the app
Once the network is up, do the following:
- From a vagrant terminal, run this command:
docker exec -it dockercomposefiles_cli_1 bash
- Change folder to:
- Build the app
- Run the app
If everything works as expected then you should see the output of the app without errors.
There is no documentation for this package.