Skip to content

Management Hyperledger Fabric blockchain network with golang restful API

Notifications You must be signed in to change notification settings

Akachain/akc-admin-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Akachain admin

The Akachain Admin Tool provides RESTful API for an administrator to interact with a Hyperledger Fabric network. The list of supported functions are:

Table of Contents

  1. MSP
    1. Enroll User
    2. Register User
    3. Revoke User
  2. Channel
    1. Create Channel
    2. Join Channel
    3. List Channel
  3. Chaincode
    1. Install Chaincode
    2. Approve Chaincode
    3. Commit Chaincode

MSP

Enroll User
curl --location --request POST 'http://localhost:4001/api/msp/enrollUser' \
--header 'Content-Type: application/json' \
--data-raw '{
  "userName": "admin",
  "enrollSecret": "adminpw",
  "orgName": "Org1"
}'
Register User
curl --location --request POST 'http://localhost:4001/api/msp/registerUser' \
--header 'Content-Type: application/json' \
--data-raw '{
  "orgName": 	"Org1",
  "affiliation": "Org1.affiliation1",
  "userName": "appUser",
  "type": "client",
  "attrs": [{ "name": "role", "value": "SuperAdmin", "ecert": true }, {...}]
}'
Revoke User
curl --location --request POST 'http://localhost:4001/api/msp/revokeUser' \
--header 'Content-Type: application/json' \
--data-raw '{
  "orgName": 	"Org1",
  "userName": "appUser",
}'

Channel

Create Channel
curl --location --request POST 'http://localhost:4001/api/channel/create' \
--header 'Content-Type: application/json' \
--data-raw '{
    "orgName": "Org1",
    "channelName": "mychannel",
    "channelConfig": "mychannel.tx"
}'
Join Channel
curl --location --request POST 'http://localhost:4001/api/channel/join' \
--header 'Content-Type: application/json' \
--data-raw '{
    "orgName": "Org1",
    "channelName": "mychannel",
    "peer": "peer0.example.com"
}'
List Channel
curl --location --request POST 'http://localhost:4001/api/channel/list' \
--header 'Content-Type: application/json' \
--data-raw '{
    "orgName": "Org1",
    "peer": "peer0.example.com"
}'

Chaincode

Install chaincode
curl --location --request POST 'http://localhost:4001/api/chaincode/install' \
--header 'Content-Type: application/json' \
--data-raw '{
    "orgName": "Org1",
    "chaincodeId": "abstore",
    "chaincodeVersion": "v1.0.0.0",
    "chaincodeType": "golang",
    "chaincodePath": "chaincodes/abstore/go"
}'
Approve chaincode
curl --location --request POST 'http://localhost:4001/api/chaincode/approve' \
--header 'Content-Type: application/json' \
--data-raw '{
    "orgName": "Org1",
    "chaincodeId": "abstore",
    "chaincodeVersion": "2",
    "packageId": "abstore:36d51e930bee55f6ca59e825263f7b7ff279de1dc6a3884f3d3876c658c114e9",
    "sequence": "1",
    "initRequired": false
}'
Commit chaincode
curl --location --request POST 'http://localhost:4001/api/chaincode/commit' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chaincodeId": "abstore",
    "chaincodeVersion": "2",
    "sequence": "2",
    "initRequired": false,
    "orgs": ["Org1", "Org2"]
}'

About

Management Hyperledger Fabric blockchain network with golang restful API

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published