Giter Club home page Giter Club logo

fabric-admin-sdk's Introduction

fabric-admin-sdk's People

Contributors

1gezhanghao avatar bestbeforetoday avatar channingduan avatar davidkhala avatar dependabot[bot] avatar goel-sahil avatar samuelvenzi avatar samyuan1990 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fabric-admin-sdk's Issues

TypeScript features implementation

Channel

  • Create new channel
  • Update channel
  • Peer join channel
  • List channel
  • inspect channel config

Chaincode

  • Chaincode package ccaas
  • chaincode package java
  • chaincode package golang
  • chaincode package nodejs
  • Chaincode install
  • Go: Chaincode queryinstalled
  • Chaincode getinstalledpackage
  • Chaincode calculatepackageid
  • Chaincode approveformyorg
  • Chaincode queryapproved
  • Chaincode checkcommitreadiness
  • Chaincode commit
  • Chaincode querycommitted

tools

  • configtxGen
  • gate policy
  • peer discovery
  • generate connection profile for sdk

Avoid importing core Fabric as a library in Go implementation

github.com/hyperledger/fabric is not intended to be consumed as a library. Doing so has the following problems:

  • Risks breakage as Fabric implementation code may change at any time.
  • Pulls in a huge number of largely unnecessary indirect dependencies.
  • Causes compatibility issues due to ties to Fabric version, and its dependencies and their versions.

The primary reason Fabric is being used as a library seems to be for the protocol buffer utilities within Fabric. Unlike the utilities within Fabric, the protocol buffer message formats are well defined (if complicated) and versioned as public API. The protobuf message construction and manipulation required by the admin API as actually not too difficult and should remain stable.

A good alternative to importing Fabric internals might be to:

  1. Include code in this admin API implementation to build and manipulate protocol buffer messages.
  2. Where there is significant commonality between the code implemented in within this API, Fabric itself, and possibly other packages, extract those common pieces of code to a library module (such as hyperledger/fabric-lib-go) and make use of is in all relevant packages.

can't work with fabric2.5 beta

I tested some functions in golang sdk against fabric v2.4 and v2.5beta version
the test results are as follows

function fabric2.4.6 fabric2.5 beta
channel.CreateChannel
channel.ListChannel
channel.GetConfigBlock (use orderer as EndorserClient) not support not support
channel.GetConfigBlock (use peer as EndorserClient)
channel.JoinChannel
installcc (external mode, metadata.json {"type":"ccaas", ... } )
installcc (external mode, metadata.json {"type":"external", ... } ) not support

CreateChannel、ListChannel use osn http API can work well
but all tested functions for peer Node same can't work with fabric 2.5
and not has a channel.GetConfigBlockFromOrderer function

Chaincode: Get installed package

As a user of the admin SDK
I want to get an installed chaincode package from a peer
So that I have an API equivalent to the peer lifecycle chaincode getinstalledpackage CLI command

Use non-deprecated protocol buffer APIs in Go implementation

In 2020, a new protocol buffer API was released for Go, and the old protocol buffer API was deprecated:

https://go.dev/blog/protobuf-apiv2

The Fabric protocol buffer bindings published at github.com/hyperledger/fabric-protos-go are based on the deprecated protobuf APIv1. The bindings published at github.com/hyperledger/fabric-protos-go-apiv2 are based on the new protobuf APIv2 and are the ones currently recommended for use by client applications:

https://hyperledger.github.io/fabric-protos/

Since the newer bindings are also used by the Fabric Gateway client API, use of the deprecated bindings could cause compatibility issues for applications that want to make use of both fabric-gateway and fabric-admin-sdk.

Chaincode: Query approved definition

As a user of the admin SDK
I want to query an org's approved chaincode definition
So that I have an API equivalent to the peer lifecycle chaincode queryapproved CLI command

repo infrastructure

  • #6
  • #7
  • #11
  • #12
  • github action for go release
  • github action for java ci/cd
  • github action for java e2e testing base on test-network
  • github action for java release
  • github action for nodejs(or typescript) ci/cd
  • github action for nodejs(or typescript) e2e testing base on test-network
  • github action for nodejs(or typescript) release

Try to enable go lint with options

#- varcheck
  #- gocyclo
  #- bodyclose
  #- misspell
  #- nakedret
  #- unconvert
  # - goconst
  # - gocritic
  # - noctx
  # - whitespace
  # - dupl

to improve our code quantity with lint options above.

Transfer to Hyperledger labs

Is your proposal related to a problem?

To avoid duplicate woks, pre discussed with @denyeart and @bestbeforetoday offline, we hope to transform this repo to labs.

Describe the solution you'd like

create a labs rfc and transform this repo to labs.

Describe alternatives you've considered

N/A

Additional context

N/A

Chaincode package docs and examples

As a user of the admin SDK
I want godoc including code examples for the chaincode package
So that I can learn how to use the API effectively

to support GetConfigBlockFromOrdererByNumber

For an exist channel , when a new org need to be added to channel:
the channel's configBlock is updated first, then the org's peers join the channel

code may like as follows

//code update the configblock
...
...

//code to get the latest configblock
block, err = channel.GetConfigBlockFromOrderer(context.Background(), orderer0.Conn, orderer0.Signer, channelID, orderer0.KeyPair)                                                                                                         
if err != nil {                                                                                                                                                                                                                           
        logger.Error(err)                                                                                                                                                                                                                 
        return err                                                                                                                                                                                                                        
}  
//code to make peer join the channel
err := channel.JoinChannel(block, peerCli.Signer, peer.NewEndorserClient(peerCli.Conn))                                                                                                                                           
if err != nil {                                                                                                                                                                                                                   
        logger.Error(err)                                                                                                                                                                                                                 
        return err                                                                                                                                                                                              
}                                                                                                                                                                                                                                 

JoinChannel(...) will give an error: unsuccessful response received with status 500 (INTERNAL_SERVER_ERROR): cannot create ledger from genesis block: expected block number=0, received block number=1

So when a peer join the channl it will always need the number 0 ConfigBlock, is it correct?
but channel.GetConfigBlockFromOrderer(...) always return the latest ConfigBlock
so we need a func like channel.GetConfigBlockFromOrdererByNumber(0) or channel.GetFirstConfigBlockFromOrderer() to get the first ConfigBlock to support peer join

Avoid need for sleeps after creating channel using API

The end-to-end test suite currently contains arbitrary sleeps to give the network time to become stable before completing chaincode lifecycle deployment. These sleeps only appear to be required when the channel is created using the admin API. When the channel is created using the test-network scripts, chaincode deployment seems to work without sleeps.

Maybe it would be good to either:

  1. Have the channel commands (perhaps optionally) check completion of configuration before returning so the system is in a fully usable state immediately after creation completes; or
  2. Extend the channel API to allow client code to check for a stable system state.

update CI with fabric 2.5

Is your proposal related to a problem?

(Write your answer here.)

Describe the solution you'd like

(Describe your proposed solution here.)

Describe alternatives you've considered

(Write your answer here.)

Additional context

(Write your answer here.)

to support list channels peer has joined

As a user of the admin SDK
I want to list channels that a peer joined
So that I can know which channels the peer node has joined.

peer cli command is as follows

List of channels peer has joined.

Usage:
  peer channel list [flags]

Flags:
  -h, --help   help for list

Global Flags:
      --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
      --clientauth                          Use mutual TLS when communicating with the orderer endpoint
      --connTimeout duration                Timeout for client to connect (default 3s)
      --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
  -o, --orderer string                      Ordering service endpoint
      --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer
      --tls                                 Use TLS when communicating with the orderer endpoint
      --tlsHandshakeTimeShift duration      The amount of time to shift backwards for certificate expiration checks during TLS handshakes with the orderer endpoint

fabric-admin-sdk draft proposal

Project Name

fabric-admin-sdk

motivation

As gateway sdk will drop off admin capacity, we plan to recover admin capacity related things with this project proposal.

schedule(Thursdays night, BJT)

host(@davidkhala / @SamYuan1990 , @xiaohui249 , @Peng-Du )

languages: go, java, nodejs, typescript

identified features

  • chain code lifecycle
  • system chain code(as list all chain code)
  • channel operators
  1. new channel
  2. channel update(new org join into specific channel)
  3. peer join channel
  4. peer exit channel
  5. list channel
  6. inspect channel config
  • gate policy?(common/policydsl/policyparser.go, tool for operator)
  • peer discovery(optional, as ping test among peer networks when gateway disabled or fabric version below 2.5)
  • base on peer discovery result, generate connection profile for sdk if possible?(optional)

Avoid use of deprecated x509 package in Go implementation

Error: pkg/tools/tools.go:122:21: SA1019: x509.DecryptPEMBlock has been deprecated since Go 1.16 because it shouldn't be used: Legacy PEM encryption as specified in RFC 1423 is insecure by design. Since it does not authenticate the ciphertext, it is vulnerable to padding oracle attacks that can let an attacker recover the plaintext. (staticcheck)

CI pipeline for github release with tag

Is your proposal related to a problem?

When we need to release with tag, we hope to use github action to create release in automatic.
GHAs below may able to used
https://github.com/ncipollo/release-action

Describe the solution you'd like

so far we just need release but not packaging npm/java hence we don't need release token.

Describe alternatives you've considered

n/A

Additional context

(Write your answer here.)

BFT support after smart BFT in fabric.

Is your proposal related to a problem?

(Write your answer here.)

Describe the solution you'd like

(Describe your proposed solution here.)

Describe alternatives you've considered

(Write your answer here.)

Additional context

(Write your answer here.)

Test coverage

Is your proposal related to a problem?

we have some packages without test case or test coverage is less than 50%

(Write your answer here.)

Describe the solution you'd like

we hope improve code quality by unit test case.

(Describe your proposed solution here.)

Describe alternatives you've considered

(Write your answer here.)

Additional context

(Write your answer here.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.