• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Preetam007/hyperledger_composer_file_storage: Hyperledger composer image/pdf/.do ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Preetam007/hyperledger_composer_file_storage

开源软件地址:

https://github.com/Preetam007/hyperledger_composer_file_storage

开源编程语言:

JavaScript 100.0%

开源软件介绍:

Screenshots

alt text

alt text

composer-storage-ways

Test environment and random stuff for hyperledger fabric and composer

Prerequisites

  • Install following as a global variable
  • Install composer-cli
  • Install composer-rest-server
  • npm install -g <aboveStuff>

1. Setup Fabric for the first time

These commands will kill and remove all running containers, and should remove all previously created Hyperledger Fabric chaincode images: Use only if you want to remove all data and get a HARD RESET.

  • Removes all docker instances, cleans images, causes you to lose all data stored on docker
  • If other applications are using docker, better to remove the fabric related containers individually.
docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q)
  • Remove all current composer cards
composer card list
composer card delete -n <card_name>
  • Run fabric for the first time. Creates a PeerAdmin card that is used for all instances of chain-code. Also removes all your current data, cards etc

All the scripts will be in the directory /fabric-tools.

cd ~/fabric-tools
./stopFabric.sh
./teardownFabric.sh
./downloadFabric.sh
./startFabric.sh
./createPeerAdminCard.sh
  • Confirm that fabric has started docker ps will show 4 containers running

  • Confirm a PeerAdmin card has been created

composer card list should show PeerAdmin@hlfv1 with no business network assigned

  • Initial Setup is complete. Time to launch a chain code instance

2. Launch a business network/ chaincode instance

  • Generate the Business Network Archive (BNA) file from the root directory:
cd ~/hyperledger_composer_file_storage
composer archive create -t dir -n .
  • Successfully created a file called [email protected] in root directory

  • Install the runtime instance for the .bna file. This HAS to use the PeerAdmin@hlfv1 card

composer network install --card PeerAdmin@hlfv1 -a composer-file-storage-ways\@0.0.1.bna
  • Start a network and create a new networkAdmin card for the business network
composer network start --card PeerAdmin@hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --file networkadmin.card --networkName composer-file-storage-ways --networkVersion '0.0.1'
  • Import the new networkadmin.card generated
composer card import --file networkadmin.card
  • A card admin@composer-file-storage-ways should be visible with composer-file-storage-ways as network assigned
composer card list
  • Activate the card by setting the certificate
composer network ping --card admin@composer-file-storage-ways
  • To remove everything and start from scratch, follow step 1

3. Close fabric safely and save its state

  • Go to the folder containing the docker-composer.yaml file
cd ~/fabric-tools/fabric-scrips/hlfv1
docker-compose stop

4. Restart a previously deployed network

cd ~/fabric-tools/fabric-scrips/hlfv1/composer
docker-compose start
  • Takes a few minutes to start. docker ps should show 5-6 containers running

  • To update an instance with new chaincode we use

https://hyperledger.github.io/composer/reference/composer.network.update.html

composer network update -a [email protected] -c admin@composer-file-storage-ways

5. Other useful commands

Card commands

Option feature is to delete existing cards. Network and System admin cards should not be removed unless a hard reset is reuired

composer card list
composer card list --name <cardName>
composer card delete -n <cardName>

API endpoint lists

User add API

  • Create a new user (Base64 string way)

/api/v0/users

Drug Assets API (ipfs way)

  • Create a new drug (POST)

/api/v0/assets

Drug Assets API (off-chain external cloud storage way)

// pending




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap