hyperledger / fabric-admin-sdk Goto Github PK
View Code? Open in Web Editor NEWFabric SDK for Admin Capability services
License: Apache License 2.0
Fabric SDK for Admin Capability services
License: Apache License 2.0
github.com/hyperledger/fabric is not intended to be consumed as a library. Doing so has the following problems:
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:
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
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
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.
create tar files.
no need to start via docker.
The github.com/pkg/errors project has been archived and is no longer maintained. Since this is used for error wrapping, which is provided by the standard Go libraries since Go 1.13, I suggest avoiding using the GitHub errors package and using the standard Go libraries instead:
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
how is about configDecoder.js
?
#- varcheck
#- gocyclo
#- bodyclose
#- misspell
#- nakedret
#- unconvert
# - goconst
# - gocritic
# - noctx
# - whitespace
# - dupl
to improve our code quantity with lint options above.
Query installed chaincode packages on a specific peer.
Hi @xiaohui249 , could you please init a commit for java implementation?
To avoid duplicate woks, pre discussed with @denyeart and @bestbeforetoday offline, we hope to transform this repo to labs.
create a labs rfc and transform this repo to labs.
N/A
N/A
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
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
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:
(Write your answer here.)
(Describe your proposed solution here.)
(Write your answer here.)
(Write your answer here.)
As a user of the admin SDK
I want to inspect blockconfig from orderer node (not from peer)
So that I can get the blcokconfig from a orderer cluster when it has no peer.
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
As gateway sdk will drop off admin capacity, we plan to recover admin capacity related things with this project proposal.
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)
n/A
we need
n/A
n/A
as title, nominate @channingduan as maintainer for this project.
duan helps with init features of golang code.
ref to https://github.com/hyperledger/fabric-admin-sdk/pulls?q=is%3Apr+is%3Aclosed+author%3Achanningduan
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
so far we just need release but not packaging npm/java hence we don't need release token.
n/A
(Write your answer here.)
// Definition of a chaincode in https://github.com/hyperledger/fabric-admin-sdk/blob/main/pkg/chaincode/lifecycle.go
type Definition struct {
ChannelName string
PackageID string
Name string
Version string
EndorsementPlugin string
ValidationPlugin string
Sequence int64
ValidationParameter []byte
InitRequired bool
Collections *peer.CollectionConfigPackage
}
it sames SignaturePolicy is in Collections Field, can give a demo for this?
(Write your answer here.)
(Describe your proposed solution here.)
(Write your answer here.)
(Write your answer here.)
项目中使用了osn是否2.3版本以下的fabric不考虑支持了?
go lint support in CI
we have some packages without test case or test coverage is less than 50%
(Write your answer here.)
we hope improve code quality by unit test case.
(Describe your proposed solution here.)
(Write your answer here.)
(Write your answer here.)
Error: internal/configtxgen/encoder/encoder.go:14:2: SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead. (staticcheck)
"github.com/golang/protobuf/proto"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.