### Install Objx Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/stretchr/objx/README.md Install the Objx package using the go get command. ```bash go get github.com/stretchr/objx ``` -------------------------------- ### Install Ginkgo Source: https://github.com/hyperledger/fabric/blob/main/integration/README.rst Installs the Ginkgo testing framework using go get. Ensure Go is installed and configured. ```bash go get github.com/onsi/ginkgo/v2 ``` -------------------------------- ### Install Afero Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/spf13/afero/README.md Use go get to install the latest version of the Afero library. ```bash $ go get github.com/spf13/afero ``` -------------------------------- ### Install go-colorable Package Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/mattn/go-colorable/README.md Standard installation command for the go-colorable package using go get. ```bash $ go get github.com/mattn/go-colorable ``` -------------------------------- ### Install Color Package Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/fatih/color/README.md Install the color package using go get. ```bash go get github.com/fatih/color ``` -------------------------------- ### Install Fabric Components using Short Arguments Source: https://github.com/hyperledger/fabric/blob/main/docs/source/install.md Executes the `install-fabric.sh` script using shortened arguments for components. This example installs Docker images, samples, and binaries. ```shell ./install-fabric.sh d s b ``` -------------------------------- ### Install mapstructure Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/go-viper/mapstructure/v2/README.md Install the mapstructure library using go get. ```shell go get github.com/go-viper/mapstructure/v2 ``` -------------------------------- ### Install go-isatty Package Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/mattn/go-isatty/README.md Use this command to install the go-isatty package using go get. ```bash go get github.com/mattn/go-isatty ``` -------------------------------- ### Install Fabric Components using install-fabric.sh Source: https://github.com/hyperledger/fabric/blob/main/docs/source/install.md Executes the `install-fabric.sh` script to download specified Fabric components. This example installs Docker images, samples, and binaries. ```shell ./install-fabric.sh docker samples binary ``` -------------------------------- ### Install Viper Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/spf13/viper/README.md Install the Viper library using go get. Viper uses Go Modules for dependency management. ```shell go get github.com/spf13/viper ``` -------------------------------- ### Install Cobra Library Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/spf13/cobra/README.md Install the latest version of the Cobra library using go get. ```go go get -u github.com/spf13/cobra@latest ``` -------------------------------- ### Install and Run Local Go Doc Site Source: https://github.com/hyperledger/fabric/blob/main/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md Installs and runs a local Go Doc site using pkgsite. Ensure you have the latest version installed. ```sh go install golang.org/x/pkgsite/cmd/pkgsite@latest pkgsite ``` -------------------------------- ### Install YAML Package Source: https://github.com/hyperledger/fabric/blob/main/vendor/go.yaml.in/yaml/v3/README.md Install the go.yaml.in/yaml/v3 package using the go get command. ```bash go get go.yaml.in/yaml/v3 ``` -------------------------------- ### Install Gorilla Mux Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/gorilla/mux/README.md Install the gorilla/mux package using the go get command. Ensure your Go toolchain is correctly configured. ```shell go get -u github.com/gorilla/mux ``` -------------------------------- ### Install Fabric Prerequisites on Linux Source: https://github.com/hyperledger/fabric/blob/main/docs/source/prereqs.md Installs Git, cURL, and Docker Compose on Ubuntu/Debian-based systems using apt-get. Ensures essential tools are available for Fabric setup. ```shell sudo apt-get install git curl docker-compose -y ``` -------------------------------- ### Install uniseg Package Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/rivo/uniseg/README.md Use 'go get' to install the uniseg package. This is the standard way to add external Go packages to your project. ```bash go get github.com/rivo/uniseg ``` -------------------------------- ### Go Bitset Installation Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/bits-and-blooms/bitset/README.md Provides the command to install the bitset library using the Go build tool. ```bash go get github.com/bits-and-blooms/bitset ``` -------------------------------- ### Install Ginkgo Locally Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md Installs the Ginkgo binary locally using Go modules. ```go go install ./... ``` -------------------------------- ### Example: List Channel Details Source: https://github.com/hyperledger/fabric/blob/main/docs/source/create_channel/create_channel_participation.md An example of the `osnadmin channel list` command with a specific channel name and orderer address. ```bash osnadmin channel list --channelID channel1 -o HOST2:7081 --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY ``` -------------------------------- ### Basic Expression Example Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/expr-lang/expr/README.md An example demonstrating a simple expression evaluation with string formatting and array access. ```Go package main import ( "fmt" "github.com/expr-lang/expr" ) func main() { env := map[string]interface{}{ "greet": "Hello, %v!", "names": []string{"world", "you"}, "sprintf": fmt.Sprintf, } code := `sprintf(greet, names[0])` program, err := expr.Compile(code, expr.Env(env)) if err != nil { panic(err) } output, err := expr.Run(program, env) if err != nil { panic(err) } fmt.Println(output) } ``` -------------------------------- ### Install Dependencies Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/spf13/viper/README.md Installs project dependencies using make. Alternatively, Nix and direnv are recommended for an optimal developer experience. ```shell make deps ``` -------------------------------- ### Complete Mux Server Example Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/gorilla/mux/README.md Provides a full, runnable example of a basic web server using Gorilla Mux. It demonstrates setting up a router and handling a root path request. ```go package main import ( "net/http" "log" "github.com/gorilla/mux" ) func YourHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Gorilla!\n")) } func main() { r := mux.NewRouter() // Routes consist of a path and a handler function. r.HandleFunc("/", YourHandler) // Bind to a port and pass our router in log.Fatal(http.ListenAndServe(":8000", r)) } ``` -------------------------------- ### Example: Create a channel Source: https://github.com/hyperledger/fabric/blob/main/docs/source/test_network.md Shows how to create a channel named 'channelName' after the network has been set up. ```bash network.sh createChannel -c channelName ``` -------------------------------- ### Example: Bring up network with channel creation and CA Source: https://github.com/hyperledger/fabric/blob/main/docs/source/test_network.md Demonstrates bringing up the Fabric network with Certificate Authorities enabled, creating a channel named 'mychannel', and using CouchDB as the state database. ```bash network.sh up createChannel -ca -c mychannel -s couchdb ``` -------------------------------- ### Basic Logging and Compression Example Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/gorilla/handlers/README.md Demonstrates how to use LoggingHandler for selective request logging and CompressHandler for gzipping responses. Requires importing 'net/http' and 'github.com/gorilla/handlers'. ```go import ( "net/http" "github.com/gorilla/handlers" ) func main() { r := http.NewServeMux() // Only log requests to our admin dashboard to stdout r.Handle("/admin", handlers.LoggingHandler(os.Stdout, http.HandlerFunc(ShowAdminDashboard))) r.HandleFunc("/", ShowIndex) // Wrap our server with our gzip handler to gzip compress all responses. http.ListenAndServe(":8000", handlers.CompressHandler(r)) } ``` -------------------------------- ### Serve Documentation Locally with Apache Source: https://github.com/hyperledger/fabric/blob/main/docs/source/docs_guide.md Commands to install Apache, copy built HTML documentation to the web server root, and access it via localhost. ```bash sudo apt-get install apache2 cd docs/build/html sudo cp -r * /var/www/html/ ``` -------------------------------- ### Network Bring Up Output Example Source: https://github.com/hyperledger/fabric/blob/main/docs/source/test_network.md Example output showing the creation of Docker networks, volumes, and Fabric peer and orderer containers when bringing up the test network. ```text Creating network "fabric_test" with the default driver Creating volume "net_orderer.example.com" with default driver Creating volume "net_peer0.org1.example.com" with default driver Creating volume "net_peer0.org2.example.com" with default driver Creating peer0.org2.example.com ... done Creating orderer.example.com ... done Creating peer0.org1.example.com ... done CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b6b117c81c7f hyperledger/fabric-peer:latest "peer node start" 2 seconds ago Up 1 second 0.0.0.0:7051->7051/tcp peer0.org1.example.com 703ead770e05 hyperledger/fabric-orderer:latest "orderer" 2 seconds ago Up Less than a second 0.0.0.0:7050->7050/tcp, 0.0.0.0:7053->7053/tcp orderer.example.com 718d43f5f312 hyperledger/fabric-peer:latest "peer node start" 2 seconds ago Up 1 second 7051/tcp, 0.0.0.0:9051->9051/tcp peer0.org2.example.com ``` -------------------------------- ### Install go.uber.org/multierr Source: https://github.com/hyperledger/fabric/blob/main/vendor/go.uber.org/multierr/README.md Install the latest version of the multierr library using the go get command. ```bash go get -u go.uber.org/multierr@latest ``` -------------------------------- ### Default Help Template Example Source: https://github.com/hyperledger/fabric/blob/main/vendor/gopkg.in/alecthomas/kingpin.v2/README.md Demonstrates the default help message output generated by Kingpin for a sample application. ```bash $ go run ./examples/curl/curl.go --help usage: curl [] [ ...] An example implementation of curl. Flags: --help Show help. -t, --timeout=5s Set connection timeout. -H, --headers=HEADER=VALUE Add HTTP headers to the request. Commands: help [...] Show help. get url Retrieve a URL. get file Retrieve a file. post [] POST a resource. ``` -------------------------------- ### Compact Help Template Example Source: https://github.com/hyperledger/fabric/blob/main/vendor/gopkg.in/alecthomas/kingpin.v2/README.md Demonstrates the compact help message generated by Kingpin for a CLI application with flags and commands. ```bash $ go run ./examples/curl/curl.go --help usage: curl [] [ ...] An example implementation of curl. Flags: --help Show help. -t, --timeout=5s Set connection timeout. -H, --headers=HEADER=VALUE Add HTTP headers to the request. Commands: help [...] get [] url file post [] ``` -------------------------------- ### Chaincode Install Error Example Source: https://github.com/hyperledger/fabric/blob/main/docs/source/test_network.md This example shows a typical error message encountered during chaincode installation, indicating a 'permission denied' error when accessing the Docker socket. It suggests reviewing SELinux configurations. ```text Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: Get "http://unix.sock/images/dev-peer0.org1.example.com-basic_1.0-c6a45e2d5563c883869149c3dbd941c22fbe27daa21f0552834f5a53fbb8058a-fe69b7bdc0bbe5769bbff0572aa6986343c77b61c84077999a9b65f29c5c0025/json": dial unix /host/var/run/docker.sock: connect: permission denied Chaincode installation on peer0.org1 has failed Deploying chaincode failed ``` -------------------------------- ### Install YAML Package Source: https://github.com/hyperledger/fabric/blob/main/vendor/go.yaml.in/yaml/v4/README.md Install the v4 of the YAML package for Go using the go get command. ```bash go get go.yaml.in/yaml/v4 ``` -------------------------------- ### Chaincode Install Success Output Source: https://github.com/hyperledger/fabric/blob/main/docs/source/commands/peerlifecycle.md Example output indicating a successful chaincode installation, including the package identifier. ```text 2019-03-13 13:48:53.691 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response: 2019-03-13 13:48:53.691 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: mycc:a7ca45a7cc85f1d89c905b775920361ed089a364e12a9b6d55ba75c965ddd6a9 ``` -------------------------------- ### Start the Peer Node Source: https://github.com/hyperledger/fabric/blob/main/docs/source/deploypeer/peerdeploy.md Navigate to the bin directory and execute the peer node start command to launch the peer. Ensure core.yaml is correctly configured and FABRIC_CFG_PATH is set. ```bash cd bin ./peer node start ``` -------------------------------- ### Using MemMapFs Backend Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/spf13/afero/README.md Shows how to initialize and use Afero's MemMapFs, an atomic and concurrent memory-backed filesystem. It's ideal for mocking and speeding up operations by avoiding disk I/O. ```Go mm := afero.NewMemMapFs() mm.MkdirAll("src/a", 0755) ``` -------------------------------- ### Go Bitset Basic Usage Example Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/bits-and-blooms/bitset/README.md Demonstrates basic bitset operations like setting, testing, clearing bits, and iterating through set bits. Also shows chaining of methods and intersection. ```go package main import ( "fmt" "math/rand" "github.com/bits-and-blooms/bitset" ) func main() { fmt.Printf("Hello from BitSet!\n") var b bitset.BitSet // play some Go Fish for i := 0; i < 100; i++ { card1 := uint(rand.Intn(52)) card2 := uint(rand.Intn(52)) b.Set(card1) if b.Test(card2) { fmt.Println("Go Fish!") } b.Clear(card1) } // Chaining b.Set(10).Set(11) for i, e := b.NextSet(0); e; i, e = b.NextSet(i + 1) { fmt.Println("The following bit is set:", i) } if b.Intersection(bitset.New(100).Set(10)).Count() == 1 { fmt.Println("Intersection works.") } else { fmt.Println("Intersection doesn't work???") } } ``` -------------------------------- ### Install and Use Crypt CLI for Remote Configuration Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/spf13/viper/README.md Instructions for installing the crypt CLI and using it to set and get configuration values in a key/value store. ```bash $ go get github.com/sagikazarmark/crypt/bin/crypt $ crypt set -plaintext /config/hugo.json /Users/hugo/settings/config.json ``` ```bash $ crypt get -plaintext /config/hugo.json ``` -------------------------------- ### Using OsFs Backend Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/spf13/afero/README.md Demonstrates the usage of Afero's OsFs backend, which wraps native OS calls. This allows for easy integration with the actual operating system's file system. ```Go appfs := afero.NewOsFs() appfs.MkdirAll("src/a", 0755) ``` -------------------------------- ### Installed Chaincodes JSON Output Source: https://github.com/hyperledger/fabric/blob/main/docs/source/commands/peerlifecycle.md Example of the JSON output from the `peer lifecycle chaincode queryinstalled --output json` command, detailing installed chaincodes with their package IDs and labels. ```json { "installed_chaincodes": [ { "package_id": "mycc_1:aab9981fa5649cfe25369fce7bb5086a69672a631e4f95c4af1b5198fe9f845b", "label": "mycc_1", "references": { "mychannel": { "chaincodes": [ { "name": "mycc", "version": "1" } ] } } } ] } ``` -------------------------------- ### Get Installed Chaincode Package Source: https://github.com/hyperledger/fabric/blob/main/docs/source/commands/peerlifecycle.md Retrieves an installed chaincode package from a peer using its package ID. Specify the output directory to save the package. The package ID is obtained from the `queryinstalled` command. ```bash peer lifecycle chaincode getinstalledpackage --package-id myccv1:a7ca45a7cc85f1d89c905b775920361ed089a364e12a9b6d55ba75c965ddd6a9 --output-directory /tmp --peerAddresses peer0.org1.example.com:7051 ``` -------------------------------- ### Preview Documentation Changes Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md Builds and serves the Ginkgo documentation locally using Jekyll. Ensure you have Bundler installed. ```bash bundle && bundle exec jekyll serve ``` -------------------------------- ### Typical Application Logging with Logfmt Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/go-kit/log/README.md Demonstrates basic structured logging using the logfmt format. This is suitable for typical application logs where readability is important. ```go w := log.NewSyncWriter(os.Stderr) logger := log.NewLogfmtLogger(w) logger.Log("question", "what is the meaning of life?", "answer", 42) ``` -------------------------------- ### Get Configuration Values with Viper Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/spf13/viper/README.md Examples of retrieving configuration values of different types using Viper's Get methods. It also shows how to check if a key is set using IsSet(). ```go viper.GetString("logfile") // case-insensitive Setting & Getting if viper.GetBool("verbose") { fmt.Println("verbose enabled") } ``` -------------------------------- ### Basic Test Script Example Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md Illustrates the syntax for creating a test case using a shell-like script and defining expected output. Comments are supported using '#'. ```shell # Create a new empty file with some data. watch / echo data >/file Output: create /file write /file ``` -------------------------------- ### Successful Peer Startup Message Source: https://github.com/hyperledger/fabric/blob/main/docs/source/deploypeer/peerdeploy.md This is an example of the log output you should expect when the peer node starts successfully. It indicates the peer's ID, network, and address. ```text [nodeCmd] serve -> INFO 017 Started peer with ID=[peer0.org1.example.com], network ID=[prod], address=[peer0.org1.example.com:7060] ``` -------------------------------- ### Install Fabric Binaries and Test Network Source: https://github.com/hyperledger/fabric/blob/main/RELEASING.md This script downloads and installs the Fabric binaries and then sets up and runs the test network. It configures environment variables for peer operations and demonstrates deploying and invoking a chaincode. ```bash curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh ./install-fabric.sh --fabric-version 2.5.0 --ca-version 1.5.6 cd fabric-samples/test-network ./network.sh up createChannel -ca -c mychannel -s couchdb ./network.sh deployCC -ccn basicgo -ccp ../asset-transfer-basic/chaincode-go/ -ccl go export PATH=${PWD}/../bin:$PATH export FABRIC_CFG_PATH=$PWD/../config/ export CORE_PEER_TLS_ENABLED=true export CORE_PEER_LOCALMSPID=Org1MSP export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp export CORE_PEER_ADDRESS=localhost:7051 peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n basicgo --peerAddresses localhost:7051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"function":"InitLedger","Args":[]}' peer chaincode query -C mychannel -n basicgo -c '{"Args":["GetAllAssets"]}' docker logs peer0.org1.example.com ./network.sh down ``` -------------------------------- ### Run Java Chaincode Server Container Source: https://github.com/hyperledger/fabric/blob/main/docs/source/cc_basic.md Example Docker run command to start a Java chaincode server container. It requires setting the CHAINCODE_SERVER_ADDRESS and CORE_CHAINCODE_ID_NAME environment variables. ```bash docker run --rm -d --name peer0org1_assettx_ccaas \ --network fabric_test \ -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:9999 \ -e CORE_CHAINCODE_ID_NAME= \ assettx_ccaas_image:latest ``` -------------------------------- ### Create Working Directory for Fabric Samples Source: https://github.com/hyperledger/fabric/blob/main/docs/source/install.md Creates a directory structure for Go projects and navigates into it. This is a recommended setup for Go developers. ```shell mkdir -p $HOME/go/src/github.com/ cd $HOME/go/src/github.com/ ``` -------------------------------- ### Bring up the Fabric test network with CA support Source: https://github.com/hyperledger/fabric/blob/main/docs/source/test_network.md Starts the Fabric test network using Certificate Authorities (CAs) for identity management. This is a more production-like setup than using cryptogen. ```bash ./network.sh up -ca ``` -------------------------------- ### Basic fsnotify Watcher Example Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/fsnotify/fsnotify/README.md This Go code demonstrates the fundamental usage of the fsnotify library. It shows how to create a new watcher, set up goroutines to listen for file system events and errors, and add a directory to monitor. The watcher is closed when the main function exits. Ensure you handle potential errors during watcher creation and path addition. ```go package main import ( "log" "github.com/fsnotify/fsnotify" ) func main() { // Create new watcher. watcher, err := fsnotify.NewWatcher() if err != nil { log.Fatal(err) } defer watcher.Close() // Start listening for events. go func() { for { select { case event, ok := <-watcher.Events: if !ok { return } log.Println("event:", event) if event.Has(fsnotify.Write) { log.Println("modified file:", event.Name) } case err, ok := <-watcher.Errors: if !ok { return } log.Println("error:", err) } } }() // Add a path. err = watcher.Add("/tmp") if err != nil { log.Fatal(err) } // Block main goroutine forever. <-make(chan struct{}) } ``` -------------------------------- ### Download and Make Fabric Install Script Executable Source: https://github.com/hyperledger/fabric/blob/main/docs/source/install.md Downloads the `install-fabric.sh` script from the official Hyperledger Fabric repository and makes it executable. This script automates the setup of your Fabric environment. ```shell curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh ``` -------------------------------- ### Sample Channel Configuration Rules Source: https://github.com/hyperledger/fabric/blob/main/docs/source/config_update.md Illustrates the 'rules' section within a channel configuration, specifically for signed_by. ```json { "rules": [ { "signed_by": 0 } ] } ``` -------------------------------- ### Start a Peer Node Source: https://github.com/hyperledger/fabric/blob/main/docs/source/commands/peernode.md Starts a peer node to interact with the network. Includes an option to start in chaincode development mode. ```bash peer node start --peer-chaincodedev ``` -------------------------------- ### Install Homebrew on macOS Source: https://github.com/hyperledger/fabric/blob/main/docs/source/prereqs.md Installs Homebrew, a package manager for macOS, which is recommended for managing prerequisites. The Xcode command line tools are installed automatically. ```shell /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Bring Up Test Network with a Channel Source: https://github.com/hyperledger/fabric/blob/main/docs/source/channel_update_tutorial.md Start the test network and create a channel named 'channel1' using the 'network.sh' script. ```bash ./network.sh up createChannel -c channel1 ``` -------------------------------- ### Install SoftHSM using Homebrew Source: https://github.com/hyperledger/fabric/blob/main/docs/source/dev-setup/devenv.md Install SoftHSM using Homebrew. This is required for running specific PKCS11 integration tests. Ensure version 2.5 is installed. ```bash brew install softhsm ``` -------------------------------- ### Install go-yaml CLI Tool Source: https://github.com/hyperledger/fabric/blob/main/vendor/go.yaml.in/yaml/v4/CONTRIBUTING.md Install the `go-yaml` CLI tool globally using `go install`. This tool is recommended for reporting bugs and inspecting YAML processing. ```bash go install go.yaml.in/yaml/v4/cmd/go-yaml@latest ``` -------------------------------- ### Query Installed Chaincodes Source: https://github.com/hyperledger/fabric/blob/main/docs/source/commands/peerlifecycle.md Use this command to list chaincodes installed on a peer. It requires the peer address. The output includes the package ID and label for each installed chaincode. ```bash peer lifecycle chaincode queryinstalled --peerAddresses peer0.org1.example.com:7051 ``` ```bash peer lifecycle chaincode queryinstalled --peerAddresses peer0.org1.example.com:7051 --output json ``` -------------------------------- ### Display Help for Fabric Install Script Source: https://github.com/hyperledger/fabric/blob/main/docs/source/install.md Shows the usage instructions and available options for the `install-fabric.sh` script. Use this to understand how to customize your Fabric installation. ```shell ./install-fabric.sh -h ``` -------------------------------- ### Get OpenTelemetry Go with go get Source: https://github.com/hyperledger/fabric/blob/main/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md Use 'go get' to download the OpenTelemetry Go project, which places it in your GOPATH. Ignore potential build constraint warnings. ```sh go get -d go.opentelemetry.io/otel ``` -------------------------------- ### Install a Chaincode Package Source: https://github.com/hyperledger/fabric/blob/main/docs/wrappers/peer_lifecycle_chaincode_postscript.md Install a packaged chaincode (`.tar.gz`) onto a peer using the `peer lifecycle chaincode install` command. The command returns a package identifier upon success. ```bash peer lifecycle chaincode install mycc.tar.gz --peerAddresses peer0.org1.example.com:7051 ``` ```text 2019-03-13 13:48:53.691 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response: 2019-03-13 13:48:53.691 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: mycc:a7ca45a7cc85f1d89c905b775920361ed089a364e12a9b6d55ba75c965ddd6a9 ``` -------------------------------- ### Install locafero Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/sagikazarmark/locafero/README.md Use this command to add the locafero library to your Go project. ```shell go get github.com/sagikazarmark/locafero ``` -------------------------------- ### Run golangci-lint locally Source: https://github.com/hyperledger/fabric/blob/main/vendor/github.com/Microsoft/go-winio/README.md Install and run golangci-lint from the command line in your repository root. Use flags to control the output verbosity. ```shell # use . or specify a path to only lint a package # to show all lint errors, use flags "--max-issues-per-linter=0 --max-same-issues=0" > golangci-lint run ./... ```