├── .github ├── pull_request_template.md ├── scripts │ └── installDeployKey.sh ├── settings.yml └── workflows │ ├── ci-checks.yml │ ├── gh-pages.yml │ ├── go-bindings.yml │ ├── java-bindings.yml │ ├── node-bindings.yml │ └── vulnerability-scan.yml ├── .gitignore ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── Makefile.apiv1 ├── README.md ├── RELEASING.md ├── bindings ├── README.md ├── go-apiv1 │ ├── .github │ │ └── settings.yml │ ├── .gitignore │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── doc.go │ ├── go.mod │ └── go.sum ├── go-apiv2 │ ├── .github │ │ └── settings.yml │ ├── .gitignore │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── doc.go │ ├── go.mod │ └── go.sum ├── java │ ├── .gitignore │ └── pom.xml └── node │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── buf.gen-apiv1.yaml ├── buf.gen.yaml ├── buf.yaml ├── common ├── collection.proto ├── common.proto ├── configtx.proto ├── configuration.proto ├── ledger.proto └── policies.proto ├── discovery └── protocol.proto ├── docs ├── .gitignore ├── 404.md ├── Gemfile ├── Gemfile.lock ├── README.md ├── _config.yaml ├── _includes │ ├── footer.html │ └── header.html └── index.md ├── gateway └── gateway.proto ├── gossip └── message.proto ├── ledger ├── queryresult │ └── kv_query_result.proto └── rwset │ ├── kvrwset │ └── kv_rwset.proto │ └── rwset.proto ├── msp ├── identities.proto ├── msp_config.proto └── msp_principal.proto ├── orderer ├── ab.proto ├── cluster.proto ├── clusterserver.proto ├── configuration.proto ├── etcdraft │ ├── configuration.proto │ └── metadata.proto └── smartbft │ └── configuration.proto ├── peer ├── chaincode.proto ├── chaincode_event.proto ├── chaincode_shim.proto ├── collection.proto ├── configuration.proto ├── events.proto ├── lifecycle │ ├── chaincode_definition.proto │ ├── db.proto │ └── lifecycle.proto ├── peer.proto ├── policy.proto ├── proposal.proto ├── proposal_response.proto ├── query.proto ├── resources.proto ├── signed_cc_dep_spec.proto ├── snapshot.proto └── transaction.proto ├── scripts └── generate_node_indexes.sh └── transientstore └── transientstore.proto /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.github/scripts/installDeployKey.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -eu 4 | 5 | repo="${1:?}" 6 | deploy_key="${2:?}" 7 | 8 | umask 077 9 | mkdir -p "${HOME}/.ssh" 10 | 11 | echo "${deploy_key}" | base64 --decode > "${HOME}/.ssh/${repo}_deploy_key" 12 | 13 | touch "${HOME}/.ssh/config" 14 | cat << CONFIG-EOF >> "${HOME}/.ssh/config" 15 | Host github.com-${repo} 16 | Hostname github.com 17 | User git 18 | IdentityFile ${HOME}/.ssh/${repo}_deploy_key 19 | IdentitiesOnly yes 20 | 21 | CONFIG-EOF 22 | -------------------------------------------------------------------------------- /.github/settings.yml: -------------------------------------------------------------------------------- 1 | repository: 2 | name: fabric-protos 3 | description: null 4 | homepage: https://wiki.hyperledger.org/display/fabric 5 | default_branch: main 6 | has_downloads: true 7 | has_issues: false 8 | has_projects: false 9 | has_wiki: false 10 | archived: false 11 | private: false 12 | allow_squash_merge: true 13 | allow_merge_commit: false 14 | allow_rebase_merge: true 15 | -------------------------------------------------------------------------------- /.github/workflows/ci-checks.yml: -------------------------------------------------------------------------------- 1 | name: Build checks 2 | 3 | on: 4 | workflow_call: 5 | outputs: 6 | publish_release: 7 | description: "'true' if this is a release build" 8 | value: ${{ jobs.check_release.outputs.publish_release }} 9 | binding_version: 10 | description: "Current binding version" 11 | value: ${{ jobs.check_version.outputs.binding_version }} 12 | 13 | env: 14 | BINDING_VERSION: 0.3.7 15 | 16 | jobs: 17 | check_release: 18 | name: Check release 19 | runs-on: ubuntu-latest 20 | outputs: 21 | publish_release: ${{ steps.check_release_tag.outputs.publish_release }} 22 | 23 | steps: 24 | - uses: actions/checkout@v4 25 | 26 | - name: Check release tag 27 | id: check_release_tag 28 | run: | 29 | git fetch --tags origin 30 | TAGS=$(git tag --points-at HEAD | { grep -c "^v${BINDING_VERSION}$" || :; }) 31 | if [ "${GITHUB_EVENT_NAME}" != "pull_request" ] && [ $TAGS -eq 1 ]; then 32 | echo "publish_release=true" >> $GITHUB_OUTPUT 33 | else 34 | echo "publish_release=false" >> $GITHUB_OUTPUT 35 | fi 36 | 37 | check_version: 38 | name: Check versions 39 | runs-on: ubuntu-latest 40 | outputs: 41 | binding_version: ${{ env.BINDING_VERSION }} 42 | 43 | steps: 44 | - uses: actions/checkout@v4 45 | 46 | - uses: actions/setup-java@v4 47 | with: 48 | distribution: temurin 49 | java-version: 21 50 | 51 | - name: Check package.json version 52 | working-directory: bindings/node 53 | run: | 54 | NODE_MODULE_VERSION=$(jq --raw-output .version package.json) 55 | echo "Expected version: ${BINDING_VERSION}" 56 | echo "package.json version: ${NODE_MODULE_VERSION}" 57 | [ "${NODE_MODULE_VERSION}" = "${BINDING_VERSION}" ] || exit 1 58 | 59 | - name: Check pom.xml version 60 | working-directory: bindings/java 61 | run: | 62 | POM_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout) 63 | echo "Expected version: ${BINDING_VERSION}" 64 | echo "pom.xml version: ${POM_VERSION}" 65 | [ "${POM_VERSION%-SNAPSHOT}" = "${BINDING_VERSION}" ] || exit 1 66 | 67 | lint: 68 | name: Lint 69 | runs-on: ubuntu-latest 70 | 71 | steps: 72 | - uses: actions/checkout@v4 73 | 74 | - name: Set up Go 75 | uses: actions/setup-go@v5 76 | with: 77 | go-version: stable 78 | cache: false 79 | 80 | - name: Cache build dependencies 81 | uses: actions/cache@v4 82 | env: 83 | cache-name: makefile-deps 84 | with: 85 | path: ~/.cache/fabric-protos 86 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 87 | restore-keys: | 88 | ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 89 | ${{ runner.os }}-${{ env.cache-name }}- 90 | 91 | - name: Run build 92 | run: make lint 93 | -------------------------------------------------------------------------------- /.github/workflows/gh-pages.yml: -------------------------------------------------------------------------------- 1 | name: GitHub Pages 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | ci_checks: 12 | name: Build checks 13 | uses: ./.github/workflows/ci-checks.yml 14 | 15 | build: 16 | name: Build documentation 17 | needs: ci_checks 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - name: Checkout (build) 22 | uses: actions/checkout@v4 23 | with: 24 | path: build 25 | 26 | - name: Checkout (publish) 27 | uses: actions/checkout@v4 28 | with: 29 | path: publish 30 | 31 | - name: Cache build dependencies 32 | uses: actions/cache@v4 33 | env: 34 | cache-name: makefile-deps 35 | with: 36 | path: ~/.cache/fabric-protos 37 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 38 | restore-keys: | 39 | ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 40 | ${{ runner.os }}-${{ env.cache-name }}- 41 | 42 | - name: Set up Go 43 | uses: actions/setup-go@v5 44 | with: 45 | go-version: stable 46 | cache: false 47 | 48 | - name: Run make 49 | run: make genprotos 50 | working-directory: build 51 | 52 | - name: Create GitHub pages commit 53 | run: | 54 | git config --global user.email "hyperledger-bot@hyperledger.org" 55 | git config --global user.name "hyperledger-bot" 56 | git checkout --orphan publish-pages 57 | git rm -rf . 58 | cp -a ../build/docs/. . 59 | git add -A 60 | git commit -m "Deploy to GitHub Pages" 61 | git status 62 | git log --name-status 63 | working-directory: publish 64 | 65 | - name: Push GitHub pages commit 66 | run: git push --force origin publish-pages:gh-pages 67 | if: github.event_name != 'pull_request' 68 | working-directory: publish 69 | -------------------------------------------------------------------------------- /.github/workflows/go-bindings.yml: -------------------------------------------------------------------------------- 1 | name: Go Bindings 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | tags: [ v** ] 7 | pull_request: 8 | branches: [ main ] 9 | workflow_dispatch: 10 | 11 | jobs: 12 | ci_checks: 13 | name: Build checks 14 | uses: ./.github/workflows/ci-checks.yml 15 | 16 | build: 17 | name: Build Go bindings 18 | needs: ci_checks 19 | runs-on: ubuntu-latest 20 | strategy: 21 | matrix: 22 | apiver: [apiv1, apiv2] 23 | 24 | steps: 25 | - name: Checkout (build) 26 | uses: actions/checkout@v4 27 | with: 28 | path: build 29 | 30 | - name: Checkout (publish) 31 | uses: actions/checkout@v4 32 | with: 33 | repository: ${{ matrix.apiver == 'apiv1' && 'hyperledger/fabric-protos-go' || 'hyperledger/fabric-protos-go-apiv2' }} 34 | path: publish-${{ matrix.apiver }} 35 | 36 | - name: Cache apiv1 build dependencies 37 | uses: actions/cache@v4 38 | if: matrix.apiver == 'apiv1' 39 | env: 40 | cache-name: makefile-deps 41 | with: 42 | path: ~/.cache/fabric-protos-apiv1 43 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile.apiv1') }} 44 | restore-keys: | 45 | ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Makefile.apiv1') }} 46 | ${{ runner.os }}-${{ env.cache-name }}- 47 | 48 | - name: Cache apiv2 build dependencies 49 | uses: actions/cache@v4 50 | if: matrix.apiver == 'apiv2' 51 | env: 52 | cache-name: makefile-deps 53 | with: 54 | path: ~/.cache/fabric-protos 55 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 56 | restore-keys: | 57 | ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 58 | ${{ runner.os }}-${{ env.cache-name }}- 59 | 60 | - name: Set up Go 61 | uses: actions/setup-go@v5 62 | with: 63 | go-version: stable 64 | check-latest: true 65 | cache: true 66 | cache-dependency-path: build/bindings/go-${{ matrix.apiver }}/go.sum 67 | 68 | - name: Run make 69 | run: make -f $MAKEFILE_NAME genprotos 70 | working-directory: build 71 | env: 72 | MAKEFILE_NAME: ${{ matrix.apiver == 'apiv1' && 'Makefile.apiv1' || 'Makefile' }} 73 | 74 | - name: Get commit message 75 | run: echo "COMMIT_MESSAGE=$(git log --format=%s -n 1 $GITHUB_SHA)" >> $GITHUB_OUTPUT 76 | id: get-commit-message 77 | working-directory: build 78 | 79 | - name: Create publish commit 80 | run: | 81 | git config --global user.email "hyperledger-bot@hyperledger.org" 82 | git config --global user.name "hyperledger-bot" 83 | # delete everything except the .git directory! 84 | find . -mindepth 1 -maxdepth 1 -name '.git' -prune -o -exec rm -rf {} \; 85 | cp -a ../build/bindings/$BINDINGS_DIR/. . 86 | git add -A 87 | git diff --cached --quiet || git commit -m "$COMMIT_MESSAGE" --no-edit 88 | git status 89 | git log --name-status 90 | working-directory: publish-${{ matrix.apiver }} 91 | env: 92 | BINDINGS_DIR: go-${{ matrix.apiver }} 93 | COMMIT_MESSAGE: ${{ steps.get-commit-message.outputs.COMMIT_MESSAGE }} 94 | 95 | - name: Set up apiv1 deploy key 96 | run: | 97 | ../build/.github/scripts/installDeployKey.sh fabric-protos-go $FABRIC_PROTOS_GO_DEPLOY_KEY 98 | touch "${HOME}/.ssh/known_hosts" 99 | ssh-keyscan -H github.com >> "${HOME}/.ssh/known_hosts" 100 | git remote set-url origin git@github.com-fabric-protos-go:hyperledger/fabric-protos-go.git 101 | if: github.event_name != 'pull_request' && matrix.apiver == 'apiv1' 102 | working-directory: publish-${{ matrix.apiver }} 103 | env: 104 | FABRIC_PROTOS_GO_DEPLOY_KEY: ${{ secrets.FABRIC_PROTOS_GO_DEPLOY_KEY }} 105 | 106 | - name: Set up apiv2 deploy key 107 | run: | 108 | ../build/.github/scripts/installDeployKey.sh fabric-protos-go-apiv2 $FABRIC_PROTOS_GO_APIV2_DEPLOY_KEY 109 | touch "${HOME}/.ssh/known_hosts" 110 | ssh-keyscan -H github.com >> "${HOME}/.ssh/known_hosts" 111 | git remote set-url origin git@github.com-fabric-protos-go-apiv2:hyperledger/fabric-protos-go-apiv2.git 112 | if: github.event_name != 'pull_request' && matrix.apiver == 'apiv2' 113 | working-directory: publish-${{ matrix.apiver }} 114 | env: 115 | FABRIC_PROTOS_GO_APIV2_DEPLOY_KEY: ${{ secrets.FABRIC_PROTOS_GO_APIV2_DEPLOY_KEY }} 116 | 117 | - name: Push GitHub publish commit 118 | run: | 119 | git push origin 120 | if: github.ref == 'refs/heads/main' 121 | working-directory: publish-${{ matrix.apiver }} 122 | 123 | - name: Tag commit 124 | run: | 125 | git tag v${BINDING_VERSION} 126 | git push origin v${BINDING_VERSION} 127 | if: needs.ci_checks.outputs.publish_release == 'true' 128 | working-directory: publish-${{ matrix.apiver }} 129 | env: 130 | BINDING_VERSION: ${{ needs.ci_checks.outputs.binding_version }} 131 | -------------------------------------------------------------------------------- /.github/workflows/java-bindings.yml: -------------------------------------------------------------------------------- 1 | name: Java Bindings 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | tags: [ v** ] 7 | pull_request: 8 | branches: [ main ] 9 | workflow_dispatch: 10 | 11 | jobs: 12 | ci_checks: 13 | name: Build checks 14 | uses: ./.github/workflows/ci-checks.yml 15 | 16 | build: 17 | name: Build Java bindings 18 | needs: ci_checks 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | 24 | - name: Cache build dependencies 25 | uses: actions/cache@v4 26 | env: 27 | cache-name: makefile-deps 28 | with: 29 | path: ~/.cache/fabric-protos 30 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 31 | restore-keys: | 32 | ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 33 | ${{ runner.os }}-${{ env.cache-name }}- 34 | 35 | - name: Set up Java for publishing to GitHub Packages 36 | uses: actions/setup-java@v4 37 | with: 38 | distribution: temurin 39 | java-version: 21 40 | cache: maven 41 | 42 | - name: Set up Go 43 | uses: actions/setup-go@v5 44 | with: 45 | go-version: stable 46 | cache: false 47 | 48 | - name: Run make 49 | run: make javabindings 50 | 51 | - name: Set prerelease version 52 | run: mvn --batch-mode versions:set -DnewVersion=${BINDING_VERSION}-dev-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT} 53 | if: needs.ci_checks.outputs.publish_release != 'true' 54 | working-directory: bindings/java 55 | env: 56 | BINDING_VERSION: ${{ needs.ci_checks.outputs.binding_version }} 57 | GITHUB_RUN_ID: ${{ github.run_id }} 58 | GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }} 59 | 60 | - name: Set release version 61 | run: mvn --batch-mode versions:set -DnewVersion=${BINDING_VERSION} 62 | if: needs.ci_checks.outputs.publish_release == 'true' 63 | working-directory: bindings/java 64 | env: 65 | BINDING_VERSION: ${{ needs.ci_checks.outputs.binding_version }} 66 | 67 | - name: Publish to GitHub Packages 68 | continue-on-error: true 69 | run: mvn -P github --batch-mode deploy 70 | if: github.event_name != 'pull_request' 71 | working-directory: bindings/java 72 | env: 73 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 74 | 75 | - name: Set up Java for publishing to Maven Central Repository 76 | uses: actions/setup-java@v4 77 | if: needs.ci_checks.outputs.publish_release == 'true' 78 | with: 79 | distribution: temurin 80 | java-version: 21 81 | cache: maven 82 | server-id: ossrh 83 | server-username: MAVEN_USERNAME 84 | server-password: MAVEN_PASSWORD 85 | gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} 86 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 87 | 88 | - name: Publish to the Maven Central Repository 89 | run: mvn -P ossrh --batch-mode deploy 90 | if: needs.ci_checks.outputs.publish_release == 'true' 91 | working-directory: bindings/java 92 | env: 93 | MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} 94 | MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} 95 | MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} 96 | -------------------------------------------------------------------------------- /.github/workflows/node-bindings.yml: -------------------------------------------------------------------------------- 1 | name: Node.js Bindings 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | tags: [ v** ] 7 | pull_request: 8 | branches: [ main ] 9 | workflow_dispatch: 10 | 11 | jobs: 12 | ci_checks: 13 | name: Build checks 14 | uses: ./.github/workflows/ci-checks.yml 15 | 16 | build: 17 | name: Build Node.js bindings 18 | needs: ci_checks 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | 24 | - name: Cache build dependencies 25 | uses: actions/cache@v4 26 | env: 27 | cache-name: makefile-deps 28 | with: 29 | path: ~/.cache/fabric-protos 30 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 31 | restore-keys: | 32 | ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Makefile') }} 33 | ${{ runner.os }}-${{ env.cache-name }}- 34 | 35 | - uses: actions/setup-node@v4 36 | with: 37 | node-version: 20 38 | cache: npm 39 | cache-dependency-path: bindings/node/package-lock.json 40 | registry-url: https://registry.npmjs.org/ 41 | 42 | - name: Set up Go 43 | uses: actions/setup-go@v5 44 | with: 45 | go-version: stable 46 | cache: false 47 | 48 | - name: Run make 49 | run: make nodebindings 50 | 51 | - run: npm version ${BINDING_VERSION}-dev.${GITHUB_RUN_ID}.${GITHUB_RUN_ATTEMPT} 52 | name: npm version 53 | if: needs.ci_checks.outputs.publish_release != 'true' 54 | working-directory: bindings/node 55 | env: 56 | BINDING_VERSION: ${{ needs.ci_checks.outputs.binding_version }} 57 | GITHUB_RUN_ID: ${{ github.run_id }} 58 | GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }} 59 | 60 | - run: | 61 | [ "${NPM_CONFIG_DRY_RUN}" == "true" ] && echo "Dry run" 62 | npm publish --access public --tag ${NPM_PUBLISH_TAG} 63 | name: npm publish 64 | working-directory: bindings/node 65 | env: 66 | NPM_CONFIG_DRY_RUN: ${{ ( github.ref == 'refs/heads/main' || needs.ci_checks.outputs.publish_release == 'true' ) && 'false' || 'true' }} 67 | NPM_PUBLISH_TAG: ${{ ( needs.ci_checks.outputs.publish_release == 'true' ) && 'next' || 'next-unstable' }} 68 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 69 | -------------------------------------------------------------------------------- /.github/workflows/vulnerability-scan.yml: -------------------------------------------------------------------------------- 1 | name: "Security vulnerability scan" 2 | 3 | on: 4 | schedule: 5 | - cron: "20 02 * * 0" 6 | workflow_dispatch: 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | go: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: actions/setup-go@v5 17 | with: 18 | go-version: stable 19 | check-latest: true 20 | cache: false 21 | - name: Scan 22 | run: make scan-go 23 | 24 | node: 25 | runs-on: ubuntu-latest 26 | steps: 27 | - uses: actions/checkout@v4 28 | - uses: actions/setup-go@v5 29 | with: 30 | go-version: stable 31 | cache: false 32 | - uses: actions/setup-node@v4 33 | with: 34 | node-version: 20 35 | - name: Scan 36 | run: make scan-node 37 | 38 | java: 39 | runs-on: ubuntu-latest 40 | steps: 41 | - uses: actions/checkout@v4 42 | - uses: actions/setup-go@v5 43 | with: 44 | go-version: stable 45 | cache: false 46 | - uses: actions/setup-java@v4 47 | with: 48 | java-version: 21 49 | distribution: temurin 50 | cache: maven 51 | - name: Scan 52 | run: make scan-java 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #SPDX-License-Identifier: Apache-2.0 2 | 3 | .DS_Store 4 | *~ 5 | *# 6 | .#* 7 | .*.sw* 8 | /build 9 | .idea 10 | .vscode 11 | 12 | /docs/protos.md 13 | /google 14 | /bindings/go-apiv1/**/*.pb.go 15 | /bindings/go-apiv2/**/*.pb.go 16 | /bindings/java/src 17 | /bindings/node/src 18 | /bindings/node/bom.json 19 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | 3 | # Fabric Maintainers 4 | * @hyperledger/fabric-core-maintainers 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Code of Conduct Guidelines 2 | ========================== 3 | 4 | Please review the Hyperledger [Code of Conduct](https://wiki.hyperledger.org/community/hyperledger-project-code-of-conduct) 5 | before participating. It is important that we keep things civil. 6 | 7 | Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | We welcome contributions to the Hyperledger Fabric Project in many forms, and there's always plenty to do! 4 | 5 | Please visit the [contributors guide](http://hyperledger-fabric.readthedocs.io/en/latest/CONTRIBUTING.html) in the docs to learn how to make contributions to this exciting project. 6 | 7 | ## Community 8 | 9 | - [Hyperledger Community](https://www.hyperledger.org/community) 10 | - [Hyperledger mailing lists and archives](http://lists.hyperledger.org/) 11 | - [Hyperledger Fabric Wiki](https://wiki.hyperledger.org/display/Fabric) 12 | - [Hyperledger Wiki](https://wiki.hyperledger.org/) 13 | - [Hyperledger Code of Conduct](https://wiki.hyperledger.org/display/HYP/Hyperledger+Code+of+Conduct) 14 | 15 | Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. 16 | -------------------------------------------------------------------------------- /Makefile.apiv1: -------------------------------------------------------------------------------- 1 | # Adapted from https://github.com/bufbuild/buf-example/blob/main/Makefile 2 | 3 | SHELL := /usr/bin/env bash -o pipefail 4 | 5 | # This controls the location of the cache. 6 | PROJECT := fabric-protos-apiv1 7 | 8 | # This controls the remote HTTPS git location to compare against for breaking changes in CI. 9 | # 10 | # Most CI providers only clone the branch under test and to a certain depth, so when 11 | # running buf breaking in CI, it is generally preferable to compare against 12 | # the remote repository directly. 13 | # 14 | # Basic authentication is available, see https://buf.build/docs/inputs#https for more details. 15 | HTTPS_GIT := https://github.com/hyperledger/fabric-protos.git 16 | 17 | # This controls the remote SSH git location to compare against for breaking changes in CI. 18 | # 19 | # CI providers will typically have an SSH key installed as part of your setup for both 20 | # public and private repositories. Buf knows how to look for an SSH key at ~/.ssh/id_rsa 21 | # and a known hosts file at ~/.ssh/known_hosts or /etc/ssh/known_hosts without any further 22 | # configuration. We demo this with CircleCI. 23 | # 24 | # See https://buf.build/docs/inputs#ssh for more details. 25 | SSH_GIT := ssh://git@github.com/hyperledger/fabric-protos.git 26 | 27 | # This controls the version of buf to install and use. 28 | BUF_VERSION := 1.32.2 29 | # If true, Buf is installed from source instead of from releases 30 | BUF_INSTALL_FROM_SOURCE := false 31 | 32 | PROTOC_VERSION := 3.19.4 33 | PROTOC_GEN_GO_VERSION := v1.3.2 34 | 35 | ### Everything below this line is meant to be static, i.e. only adjust the above variables. ### 36 | 37 | UNAME_OS := $(shell uname -s) 38 | UNAME_ARCH := $(shell uname -m) 39 | ifeq ($(UNAME_OS),Darwin) 40 | PLATFORM := osx 41 | PROTOC_ARCH := x86_64 42 | else 43 | PROTOC_ARCH := $(UNAME_ARCH) 44 | endif 45 | ifeq ($(UNAME_OS),Linux) 46 | PLATFORM := linux 47 | endif 48 | # Buf will be cached to ~/.cache/buf-example. 49 | CACHE_BASE := $(HOME)/.cache/$(PROJECT) 50 | # This allows switching between i.e a Docker container and your local setup without overwriting. 51 | CACHE := $(CACHE_BASE)/$(UNAME_OS)/$(UNAME_ARCH) 52 | # The location where buf will be installed. 53 | CACHE_BIN := $(CACHE)/bin 54 | # Marker files are put into this directory to denote the current version of binaries that are installed. 55 | CACHE_VERSIONS := $(CACHE)/versions 56 | 57 | # Update the $PATH so we can use buf directly 58 | export PATH := $(abspath $(CACHE_BIN)):$(PATH) 59 | # Update GOBIN to point to CACHE_BIN for source installations 60 | export GOBIN := $(abspath $(CACHE_BIN)) 61 | # This is needed to allow versions to be added to Golang modules with go get 62 | export GO111MODULE := on 63 | 64 | # BUF points to the marker file for the installed version. 65 | # 66 | # If BUF_VERSION is changed, the binary will be re-downloaded. 67 | BUF := $(CACHE_VERSIONS)/buf/$(BUF_VERSION) 68 | $(BUF): 69 | @rm -f $(CACHE_BIN)/buf 70 | @mkdir -p $(CACHE_BIN) 71 | ifeq ($(BUF_INSTALL_FROM_SOURCE),true) 72 | $(eval BUF_TMP := $(shell mktemp -d)) 73 | cd $(BUF_TMP); go install github.com/bufbuild/buf/cmd/buf@v$(BUF_VERSION) 74 | @rm -rf $(BUF_TMP) 75 | else 76 | curl -sSL \ 77 | "https://github.com/bufbuild/buf/releases/download/v$(BUF_VERSION)/buf-$(UNAME_OS)-$(UNAME_ARCH)" \ 78 | -o "$(CACHE_BIN)/buf" 79 | chmod +x "$(CACHE_BIN)/buf" 80 | endif 81 | @rm -rf $(dir $(BUF)) 82 | @mkdir -p $(dir $(BUF)) 83 | @touch $(BUF) 84 | 85 | # PROTOC points to the marker file for the installed version. 86 | # 87 | # If PROTOC_VERSION is changed, the binary will be re-downloaded. 88 | PROTOC := $(CACHE_VERSIONS)/protoc/$(PROTOC_VERSION) 89 | $(PROTOC): 90 | @rm -f $(CACHE_BIN)/protoc 91 | @mkdir -p $(CACHE_BIN) 92 | $(eval PROTOC_TMP := $(shell mktemp -d)) 93 | curl -sSL \ 94 | "https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-$(PLATFORM)-$(PROTOC_ARCH).zip" \ 95 | -o "$(PROTOC_TMP)/protoc.zip" 96 | unzip -o "$(PROTOC_TMP)/protoc.zip" -d "$(CACHE)" bin/protoc 97 | unzip -o "$(PROTOC_TMP)/protoc.zip" -d "$(CACHE)" include/* 98 | @rm -rf $(PROTOC_TMP) 99 | chmod +x "$(CACHE_BIN)/protoc" 100 | @rm -rf $(dir $(PROTOC)) 101 | @mkdir -p $(dir $(PROTOC)) 102 | @touch $(PROTOC) 103 | 104 | # PROTOC_GEN_GO points to the marker file for the installed version. 105 | # 106 | # If PROTOC_GEN_GO_VERSION is changed, the binary will be re-downloaded. 107 | PROTOC_GEN_GO := $(CACHE_VERSIONS)/protoc-gen-go/$(PROTOC_GEN_GO_VERSION) 108 | $(PROTOC_GEN_GO): 109 | @rm -f $(CACHE_BIN)/protoc-gen-go 110 | @mkdir -p $(CACHE_BIN) 111 | $(eval PROTOC_GEN_GO_TMP := $(shell mktemp -d)) 112 | cd $(PROTOC_GEN_GO_TMP); go install github.com/golang/protobuf/protoc-gen-go@$(PROTOC_GEN_GO_VERSION) 113 | @rm -rf $(PROTOC_GEN_GO_TMP) 114 | @rm -rf $(dir $(PROTOC_GEN_GO)) 115 | @mkdir -p $(dir $(PROTOC_GEN_GO)) 116 | @touch $(PROTOC_GEN_GO) 117 | 118 | .DEFAULT_GOAL := all 119 | 120 | .PHONY: all 121 | all: genprotos 122 | 123 | # deps allows us to install deps without running any checks. 124 | 125 | .PHONY: deps 126 | deps: $(BUF) $(PROTOC) $(PROTOC_GEN_GO) 127 | 128 | .PHONY: genprotos 129 | genprotos: $(BUF) $(PROTOC) $(PROTOC_GEN_GO) 130 | buf generate --template buf.gen-apiv1.yaml 131 | 132 | .PHONY: cleandep 133 | cleandep: 134 | rm -rf $(CACHE_BASE) 135 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hyperledger Fabric gRPC Service Definitions 2 | 3 | This repository contains the [grpc] service and [protocol buffer][protobuf] definitions for the Hyperledger Fabric project. 4 | Tools like `protoc` can transform these definitions into code that can be used by clients and libraries to interact with Fabric. 5 | 6 | Language bindings for Go, Node and Java are generated from the protocol buffer definitions within this repository, and published for use by other projects. For more information, please see the [documentation](https://hyperledger.github.io/fabric-protos/). 7 | 8 | Issues and pull requests related to any of the published language bindings should be raised in this repository. 9 | 10 | ## Building and testing 11 | 12 | ### Build using make 13 | 14 | The following Makefile targets are available: 15 | 16 | - `make lint` - run [Buf] linter and breaking change detection 17 | - `make javabindings` - run Java bindings code generation 18 | - `make nodebindings` - run Node.js bindings code generation 19 | 20 | Note: there is a separate Makefile for the original version of Go protocol buffers APIv1, which you can specifiy using `make -f Makefile.apiv1 ...` 21 | 22 | See [A new Go API for Protocol Buffers][apiv2] for details of the Go protocol buffers APIv1 and APIv2. 23 | 24 | [Buf]: https://github.com/bufbuild/buf 25 | [grpc]: https://grpc.io/docs/guides/ 26 | [protobuf]: https://github.com/protocolbuffers/protobuf/ 27 | [apiv2]: https://go.dev/blog/protobuf-apiv2 28 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Releasing 2 | 3 | The following artifacts are created or updated as a result of pushing changes to the `main` branch, and when tagging a new release: 4 | 5 | - Go repositories 6 | - [fabric-protos-go](https://github.com/hyperledger/fabric-protos-go) 7 | - [fabric-protos-go-apiv2](https://github.com/hyperledger/fabric-protos-go-apiv2) 8 | - npm module 9 | - [@hyperledger/fabric-protos](https://www.npmjs.com/package/@hyperledger/fabric-protos) 10 | - Java libraries 11 | - GitHub packages: [fabric-protos](https://github.com/hyperledger/fabric-protos/packages/1412970) 12 | - Maven central repository: [fabric-protos](https://search.maven.org/artifact/org.hyperledger.fabric/fabric-protos) (tagged release only) 13 | 14 | ## Before releasing 15 | 16 | The following tasks are required before releasing: 17 | 18 | - Update version numbers if required (see below for details) 19 | 20 | ## Create release 21 | 22 | Creating a GitHub release on the [releases page](https://github.com/hyperledger/fabric-protos/releases) will trigger the build to publish the new release. 23 | 24 | When drafting the release, create a new tag for the new version (with a `v` prefix), e.g. `vX.Y.Z` 25 | 26 | The CI actions triggered from a tag will set publish_release to 'true' causing downstream artifacts to be published. 27 | 28 | See previous releases for examples of the title and description. 29 | 30 | **Important:** make sure you target the correct branch when creating a release (see below for version details) 31 | 32 | ## After releasing 33 | 34 | The following tasks are required after releasing: 35 | 36 | - Update version numbers to the next **patch** release (see below for details) 37 | 38 | # Versioning 39 | 40 | The Hyperledger Fabric protobufs and generated bindings follow the [Go module version numbering system](https://go.dev/doc/modules/version-numbers) 41 | 42 | **Important:** Current releases are all in the unstable v0.x.x range. A v0 version makes **no stability or backward compatibility guarantees**. 43 | 44 | ## Updating version numbers 45 | 46 | Use the following version numbers on each branch: 47 | 48 | - the `0.1.x` branch is intended for Fabric 2.4 releases and should be versioned as `v0.1.x` 49 | - the `0.2.x` branch is intended for Fabric 2.5 releases and should be versioned as `v0.2.x` 50 | - the `main` branch is intended for Fabric 3.0 releases and should be versioned as `v0.3.x` 51 | 52 | The following files need to be modified when updating the version number, and these are checked by the build process to ensure they match a tagged release: 53 | 54 | - The `BINDING_VERSION` variable in `.github/workflows/ci-checks.yml` 55 | - The `version` element in `bindings/java/pom.xml` 56 | - The `version` property in `bindings/node/package.json` 57 | (The `bindings/node/package-lock.json` should also be updated with the new version.) 58 | 59 | **Note:** there is no file to update for the Go bindings, since these are versioned by the release tag. 60 | -------------------------------------------------------------------------------- /bindings/README.md: -------------------------------------------------------------------------------- 1 | # Fabric protos bindings 2 | 3 | The template projects in this directory are used to publish langauge specific bindings for the Fabric protos. 4 | -------------------------------------------------------------------------------- /bindings/go-apiv1/.github/settings.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | repository: 6 | name: fabric-protos-go 7 | description: Generated Go bindings for fabric-protos 8 | homepage: https://hyperledger.github.io/fabric-protos/ 9 | default_branch: main 10 | has_downloads: false 11 | has_issues: false 12 | has_projects: false 13 | has_wiki: false 14 | archived: false 15 | private: false 16 | allow_squash_merge: true 17 | allow_merge_commit: false 18 | allow_rebase_merge: true 19 | -------------------------------------------------------------------------------- /bindings/go-apiv1/.gitignore: -------------------------------------------------------------------------------- 1 | #SPDX-License-Identifier: Apache-2.0 2 | .idea 3 | .vscode 4 | -------------------------------------------------------------------------------- /bindings/go-apiv1/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Code of Conduct Guidelines 2 | ========================== 3 | 4 | Please review the Hyperledger [Code of Conduct](https://wiki.hyperledger.org/community/hyperledger-project-code-of-conduct) 5 | before participating. It is important that we keep things civil. 6 | 7 | Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. 8 | -------------------------------------------------------------------------------- /bindings/go-apiv1/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | We welcome contributions to the Hyperledger Fabric Project in many forms, and there's always plenty to do! 4 | 5 | Please visit the [contributors guide](http://hyperledger-fabric.readthedocs.io/en/latest/CONTRIBUTING.html) in the docs to learn how to make contributions to this exciting project. 6 | 7 | Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. 8 | -------------------------------------------------------------------------------- /bindings/go-apiv1/README.md: -------------------------------------------------------------------------------- 1 | # Hyperledger Fabric gRPC and Protocol Buffer Bindings for go 2 | 3 | IMPORTANT: you should not attempt to make changes to this repository. 4 | It is an assembled representation of the [repository][fabric-protos]. 5 | If you want to make changes, you must prepare them for the [repository][fabric-protos] 6 | 7 | This repository contains the Hyperledger Fabric [grpc] service and [protocol 8 | buffer][protobuf] bindings for [go]. 9 | 10 | ## Community 11 | 12 | We welcome contributions to the Hyperledger Fabric project in many forms. 13 | There’s always plenty to do! Check the documentation on 14 | [how to contribute][contributing] to this project for the full details. 15 | 16 | - [Hyperledger Community](https://www.hyperledger.org/community) 17 | - [Hyperledger mailing lists and archives](http://lists.hyperledger.org/) 18 | - [Hyperledger Chat](http://chat.hyperledger.org/channel/fabric) 19 | - [Hyperledger Fabric Issue Tracking (JIRA)](https://jira.hyperledger.org/secure/Dashboard.jspa?selectPageId=10104) 20 | - [Hyperledger Fabric Wiki](https://wiki.hyperledger.org/display/Fabric) 21 | - [Hyperledger Wiki](https://wiki.hyperledger.org/) 22 | - [Hyperledger Code of Conduct](https://wiki.hyperledger.org/display/HYP/Hyperledger+Code+of+Conduct) 23 | 24 | ## License 25 | 26 | Hyperledger Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the [LICENSE](LICENSE) file. Hyperledger Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/. 27 | 28 | [contributing]: https://hyperledger-fabric.readthedocs.io/en/latest/CONTRIBUTING.html 29 | [go]: https://golang.org/ 30 | [grpc]: https://grpc.io/docs/guides/ 31 | [protobuf]: https://github.com/protocolbuffers/protobuf/ 32 | [rocketchat-image]: https://open.rocket.chat/images/join-chat.svg 33 | [rocketchat-url]: https://chat.hyperledger.org/channel/fabric 34 | [fabric-protos]: https://github.com/hyperledger/fabric-protos/ 35 | -------------------------------------------------------------------------------- /bindings/go-apiv1/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // Package protos contains the protobuf and gRPC service bindings for 5 | // Hyperledger Fabric. 6 | package protos 7 | -------------------------------------------------------------------------------- /bindings/go-apiv1/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/hyperledger/fabric-protos-go 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/golang/protobuf v1.5.4 7 | google.golang.org/grpc v1.71.0 8 | google.golang.org/protobuf v1.36.6 9 | ) 10 | 11 | require ( 12 | golang.org/x/net v0.39.0 // indirect 13 | golang.org/x/sys v0.32.0 // indirect 14 | golang.org/x/text v0.24.0 // indirect 15 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect 16 | ) 17 | -------------------------------------------------------------------------------- /bindings/go-apiv1/go.sum: -------------------------------------------------------------------------------- 1 | github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= 2 | github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 3 | github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= 4 | github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 5 | github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= 6 | github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 7 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 8 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 9 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 10 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 11 | go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= 12 | go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= 13 | go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= 14 | go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= 15 | go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= 16 | go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= 17 | go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= 18 | go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= 19 | go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= 20 | go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= 21 | go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= 22 | go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= 23 | golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= 24 | golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= 25 | golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= 26 | golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 27 | golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= 28 | golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= 29 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 h1:e0AIkUUhxyBKh6ssZNrAMeqhA7RKUj42346d1y02i2g= 30 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= 31 | google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg= 32 | google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= 33 | google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= 34 | google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= 35 | -------------------------------------------------------------------------------- /bindings/go-apiv2/.github/settings.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | repository: 6 | name: fabric-protos-go-apiv2 7 | description: Generated Go bindings for fabric-protos 8 | homepage: https://hyperledger.github.io/fabric-protos/ 9 | default_branch: main 10 | has_downloads: false 11 | has_issues: false 12 | has_projects: false 13 | has_wiki: false 14 | archived: false 15 | private: false 16 | allow_squash_merge: true 17 | allow_merge_commit: false 18 | allow_rebase_merge: true 19 | -------------------------------------------------------------------------------- /bindings/go-apiv2/.gitignore: -------------------------------------------------------------------------------- 1 | #SPDX-License-Identifier: Apache-2.0 2 | .idea 3 | .vscode 4 | -------------------------------------------------------------------------------- /bindings/go-apiv2/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Code of Conduct Guidelines 2 | ========================== 3 | 4 | Please review the Hyperledger [Code of Conduct](https://wiki.hyperledger.org/community/hyperledger-project-code-of-conduct) 5 | before participating. It is important that we keep things civil. 6 | 7 | Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. 8 | -------------------------------------------------------------------------------- /bindings/go-apiv2/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | We welcome contributions to the Hyperledger Fabric Project in many forms, and there's always plenty to do! 4 | 5 | Please visit the [contributors guide](http://hyperledger-fabric.readthedocs.io/en/latest/CONTRIBUTING.html) in the docs to learn how to make contributions to this exciting project. 6 | 7 | Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. 8 | -------------------------------------------------------------------------------- /bindings/go-apiv2/README.md: -------------------------------------------------------------------------------- 1 | # Hyperledger Fabric gRPC and Protocol Buffer Bindings for go 2 | 3 | IMPORTANT: you should not attempt to make changes to this repository. 4 | It is an assembled representation of the [repository][fabric-protos]. 5 | If you want to make changes, you must prepare them for the [repository][fabric-protos] 6 | 7 | This repository contains the Hyperledger Fabric [grpc] service and [protocol 8 | buffer][protobuf] bindings for [go]. 9 | 10 | ## Community 11 | 12 | We welcome contributions to the Hyperledger Fabric project in many forms. 13 | There’s always plenty to do! Check the documentation on 14 | [how to contribute][contributing] to this project for the full details. 15 | 16 | - [Hyperledger Community](https://www.hyperledger.org/community) 17 | - [Hyperledger mailing lists and archives](http://lists.hyperledger.org/) 18 | - [Hyperledger Chat](https://discord.gg/hyperledger) 19 | - [Hyperledger Fabric Issue Tracking (JIRA)](https://jira.hyperledger.org/secure/Dashboard.jspa?selectPageId=10104) 20 | - [Hyperledger Fabric Wiki](https://wiki.hyperledger.org/display/Fabric) 21 | - [Hyperledger Wiki](https://wiki.hyperledger.org/) 22 | - [Hyperledger Code of Conduct](https://wiki.hyperledger.org/display/HYP/Hyperledger+Code+of+Conduct) 23 | 24 | ## License 25 | 26 | Hyperledger Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the [LICENSE](LICENSE) file. Hyperledger Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/. 27 | 28 | [contributing]: https://hyperledger-fabric.readthedocs.io/en/latest/CONTRIBUTING.html 29 | [go]: https://golang.org/ 30 | [grpc]: https://grpc.io/docs/guides/ 31 | [protobuf]: https://github.com/protocolbuffers/protobuf/ 32 | [fabric-protos]: https://github.com/hyperledger/fabric-protos/ 33 | -------------------------------------------------------------------------------- /bindings/go-apiv2/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // Package protos contains the protobuf and gRPC service bindings for 5 | // Hyperledger Fabric. 6 | package protos 7 | -------------------------------------------------------------------------------- /bindings/go-apiv2/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/hyperledger/fabric-protos-go-apiv2 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | google.golang.org/grpc v1.71.0 7 | google.golang.org/protobuf v1.36.6 8 | ) 9 | 10 | require ( 11 | golang.org/x/net v0.39.0 // indirect 12 | golang.org/x/sys v0.32.0 // indirect 13 | golang.org/x/text v0.24.0 // indirect 14 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect 15 | ) 16 | -------------------------------------------------------------------------------- /bindings/go-apiv2/go.sum: -------------------------------------------------------------------------------- 1 | github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= 2 | github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 3 | github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= 4 | github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 5 | github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= 6 | github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 7 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 8 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 9 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 10 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 11 | go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= 12 | go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= 13 | go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= 14 | go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= 15 | go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= 16 | go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= 17 | go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= 18 | go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= 19 | go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= 20 | go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= 21 | go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= 22 | go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= 23 | golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= 24 | golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= 25 | golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= 26 | golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 27 | golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= 28 | golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= 29 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 h1:e0AIkUUhxyBKh6ssZNrAMeqhA7RKUj42346d1y02i2g= 30 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= 31 | google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg= 32 | google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= 33 | google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= 34 | google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= 35 | -------------------------------------------------------------------------------- /bindings/java/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | release.properties 7 | dependency-reduced-pom.xml 8 | buildNumber.properties 9 | .mvn/timing.properties 10 | # https://github.com/takari/maven-wrapper#usage-without-binary-jar 11 | .mvn/wrapper/maven-wrapper.jar 12 | 13 | # Eclipse m2e generated files 14 | # Eclipse Core 15 | .project 16 | # JDT-specific (Eclipse Java Development Tools) 17 | .classpath 18 | -------------------------------------------------------------------------------- /bindings/node/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional stylelint cache 58 | .stylelintcache 59 | 60 | # Microbundle cache 61 | .rpt2_cache/ 62 | .rts2_cache_cjs/ 63 | .rts2_cache_es/ 64 | .rts2_cache_umd/ 65 | 66 | # Optional REPL history 67 | .node_repl_history 68 | 69 | # Output of 'npm pack' 70 | *.tgz 71 | 72 | # Yarn Integrity file 73 | .yarn-integrity 74 | 75 | # dotenv environment variable files 76 | .env 77 | .env.development.local 78 | .env.test.local 79 | .env.production.local 80 | .env.local 81 | 82 | # parcel-bundler cache (https://parceljs.org/) 83 | .cache 84 | .parcel-cache 85 | 86 | # tsc build output 87 | lib 88 | 89 | # Next.js build output 90 | .next 91 | out 92 | 93 | # Nuxt.js build / generate output 94 | .nuxt 95 | dist 96 | 97 | # Gatsby files 98 | .cache/ 99 | # Comment in the public line in if your project uses Gatsby and not Next.js 100 | # https://nextjs.org/blog/next-9-1#public-directory-support 101 | # public 102 | 103 | # vuepress build output 104 | .vuepress/dist 105 | 106 | # vuepress v2.x temp and cache directory 107 | .temp 108 | .cache 109 | 110 | # Docusaurus cache and generated files 111 | .docusaurus 112 | 113 | # Serverless directories 114 | .serverless/ 115 | 116 | # FuseBox cache 117 | .fusebox/ 118 | 119 | # DynamoDB Local files 120 | .dynamodb/ 121 | 122 | # TernJS port file 123 | .tern-port 124 | 125 | # Stores VSCode versions used for testing VSCode extensions 126 | .vscode-test 127 | 128 | # yarn v2 129 | .yarn/cache 130 | .yarn/unplugged 131 | .yarn/build-state.yml 132 | .yarn/install-state.gz 133 | .pnp.* 134 | -------------------------------------------------------------------------------- /bindings/node/README.md: -------------------------------------------------------------------------------- 1 | # fabric-protos 2 | 3 | Node bindings for [Hyperledger Fabric protocol buffers](https://github.com/hyperledger/fabric-protos) 4 | 5 | ## Usage 6 | 7 | Import the packages you need from the protos, following the same structure as the protos themselves. 8 | For example: 9 | 10 | ``` 11 | import { common, ledger, msp, orderer, peer } from '@hyperledger/fabric-protos'; 12 | ``` 13 | 14 | Then refer to the implementations you want within those packages. 15 | For example: 16 | 17 | ``` 18 | const proposal = peer.Proposal.deserializeBinary(bytes); 19 | const header = common.Header.deserializeBinary(proposal.getHeader_asU8()); 20 | const channelHeader = common.ChannelHeader.deserializeBinary(header.getChannelHeader_asU8()); 21 | const channelName = channelHeader.getChannelId(); 22 | ``` 23 | 24 | See [JavaScript Generated Code](https://developers.google.com/protocol-buffers/docs/reference/javascript-generated) for more details. 25 | -------------------------------------------------------------------------------- /bindings/node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@hyperledger/fabric-protos", 3 | "version": "0.3.7", 4 | "description": "Node bindings for Hyperledger Fabric protocol buffers", 5 | "main": "lib/index.js", 6 | "types": "lib/index.d.ts", 7 | "files": [ 8 | "/lib" 9 | ], 10 | "type": "commonjs", 11 | "engines": { 12 | "node": ">=16.13.0" 13 | }, 14 | "scripts": { 15 | "compile": "tsc", 16 | "postcompile": "npm run copyfiles", 17 | "copyfiles": "cpy './src/**/*.d.ts' './src/**/*.js' lib", 18 | "test": "echo \"Error: no test specified\" && exit 1" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/hyperledger/fabric-protos.git" 23 | }, 24 | "author": { 25 | "name": "hyperledger/fabric", 26 | "email": "fabric@lists.hyperledger.org", 27 | "url": "https://www.hyperledger.org/use/fabric" 28 | }, 29 | "license": "Apache-2.0", 30 | "bugs": { 31 | "url": "https://github.com/hyperledger/fabric-protos/issues" 32 | }, 33 | "homepage": "https://github.com/hyperledger/fabric-protos#readme", 34 | "devDependencies": { 35 | "@tsconfig/node18": "^18.2.4", 36 | "@types/google-protobuf": "^3.15.12", 37 | "cpy-cli": "^5.0.0", 38 | "typescript": "~5.6.0" 39 | }, 40 | "dependencies": { 41 | "@grpc/grpc-js": "^1.11.0", 42 | "google-protobuf": "^3.21.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bindings/node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@tsconfig/node18/tsconfig.json", 4 | "compilerOptions": { 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "outDir": "lib", 9 | "rootDir": "src", 10 | "strict": true, 11 | "noUnusedLocals": true, 12 | "noImplicitReturns": true, 13 | "forceConsistentCasingInFileNames": true 14 | }, 15 | "include": [ 16 | "src/" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /buf.gen-apiv1.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | plugins: 3 | - local: protoc-gen-go 4 | out: bindings/go-apiv1 5 | opt: 6 | - paths=source_relative 7 | - plugins=grpc 8 | -------------------------------------------------------------------------------- /buf.gen.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | managed: 3 | enabled: true 4 | override: 5 | - file_option: java_multiple_files 6 | value: true 7 | - file_option: java_package_prefix 8 | value: org.hyperledger.fabric.protos 9 | - file_option: go_package_prefix 10 | value: github.com/hyperledger/fabric-protos-go-apiv2 11 | - file_option: java_outer_classname 12 | path: common/configtx.proto 13 | value: ConfigTxProto 14 | - file_option: java_outer_classname 15 | path: ledger/queryresult/kv_query_result.proto 16 | value: KVQueryResultProto 17 | - file_option: java_outer_classname 18 | path: ledger/rwset/kvrwset/kv_rwset.proto 19 | value: KVRWSetProto 20 | - file_option: java_outer_classname 21 | path: ledger/rwset/rwset.proto 22 | value: RWSetProto 23 | - file_option: java_outer_classname 24 | path: msp/msp_config.proto 25 | value: MSPConfigProto 26 | - file_option: java_outer_classname 27 | path: msp/msp_principal.proto 28 | value: MSPPrincipalProto 29 | - file_option: java_package 30 | path: google/rpc/status.proto 31 | value: com.google.rpc 32 | - file_option: java_package 33 | path: ledger/queryresult/kv_query_result.proto 34 | value: org.hyperledger.fabric.protos.ledger.queryresult 35 | - file_option: java_package 36 | path: ledger/rwset/kvrwset/kv_rwset.proto 37 | value: org.hyperledger.fabric.protos.ledger.rwset.kvrwset 38 | - file_option: java_package 39 | path: ledger/rwset/rwset.proto 40 | value: org.hyperledger.fabric.protos.ledger.rwset 41 | - file_option: java_package 42 | path: msp/msp_principal.proto 43 | value: org.hyperledger.fabric.protos.common 44 | - file_option: java_package 45 | path: orderer/etcdraft/configuration.proto 46 | value: org.hyperledger.fabric.protos.orderer.etcdraft 47 | - file_option: java_package 48 | path: orderer/etcdraft/metadata.proto 49 | value: org.hyperledger.fabric.protos.orderer.etcdraft 50 | - file_option: java_package 51 | path: peer/chaincode.proto 52 | value: org.hyperledger.fabric.protos.peer 53 | - file_option: java_package 54 | path: peer/chaincode_event.proto 55 | value: org.hyperledger.fabric.protos.peer 56 | - file_option: java_package 57 | path: peer/chaincode_shim.proto 58 | value: org.hyperledger.fabric.protos.peer 59 | - file_option: java_package 60 | path: peer/collection.proto 61 | value: org.hyperledger.fabric.protos.peer 62 | - file_option: java_package 63 | path: peer/configuration.proto 64 | value: org.hyperledger.fabric.protos.peer 65 | - file_option: java_package 66 | path: peer/events.proto 67 | value: org.hyperledger.fabric.protos.peer 68 | - file_option: java_package 69 | path: peer/lifecycle/chaincode_definition.proto 70 | value: org.hyperledger.fabric.protos.peer.lifecycle 71 | - file_option: java_package 72 | path: peer/lifecycle/db.proto 73 | value: org.hyperledger.fabric.protos.peer.lifecycle 74 | - file_option: java_package 75 | path: peer/lifecycle/lifecycle.proto 76 | value: org.hyperledger.fabric.protos.peer.lifecycle 77 | - file_option: java_package 78 | path: peer/peer.proto 79 | value: org.hyperledger.fabric.protos.peer 80 | - file_option: java_package 81 | path: peer/policy.proto 82 | value: org.hyperledger.fabric.protos.peer 83 | - file_option: java_package 84 | path: peer/proposal.proto 85 | value: org.hyperledger.fabric.protos.peer 86 | - file_option: java_package 87 | path: peer/proposal_response.proto 88 | value: org.hyperledger.fabric.protos.peer 89 | - file_option: java_package 90 | path: peer/query.proto 91 | value: org.hyperledger.fabric.protos.peer 92 | - file_option: java_package 93 | path: peer/resources.proto 94 | value: org.hyperledger.fabric.protos.peer 95 | - file_option: java_package 96 | path: peer/signed_cc_dep_spec.proto 97 | value: org.hyperledger.fabric.protos.peer 98 | - file_option: java_package 99 | path: peer/snapshot.proto 100 | value: org.hyperledger.fabric.protos.peer 101 | - file_option: java_package 102 | path: peer/transaction.proto 103 | value: org.hyperledger.fabric.protos.peer 104 | plugins: 105 | - local: protoc-gen-doc 106 | out: docs 107 | opt: 108 | - markdown 109 | - protos.md 110 | strategy: all 111 | - local: protoc-gen-go 112 | out: bindings/go-apiv2 113 | opt: paths=source_relative 114 | - local: protoc-gen-go-grpc 115 | out: bindings/go-apiv2 116 | opt: 117 | - paths=source_relative 118 | - require_unimplemented_servers=false 119 | - protoc_builtin: java 120 | out: bindings/java/src/main/java 121 | - local: protoc-gen-grpc-java 122 | out: bindings/java/src/main/java 123 | - protoc_builtin: js 124 | out: bindings/node/src 125 | opt: 126 | - import_style=commonjs 127 | - binary 128 | - local: grpc_tools_node_protoc_plugin 129 | out: bindings/node/src 130 | opt: grpc_js 131 | - local: protoc-gen-ts 132 | out: bindings/node/src 133 | opt: 134 | - service=grpc-node 135 | - mode=grpc-js 136 | -------------------------------------------------------------------------------- /buf.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | modules: 3 | - path: . 4 | excludes: 5 | - bindings 6 | lint: 7 | use: 8 | - STANDARD 9 | except: 10 | - FIELD_NOT_REQUIRED 11 | - PACKAGE_NO_IMPORT_CYCLE 12 | - PACKAGE_VERSION_SUFFIX 13 | ignore: 14 | - google 15 | # IMPORTANT: the following rules are ignored due to *existing* proto files. 16 | # Please DO NOT add new files to this list unless strictly necessary. 17 | ignore_only: 18 | DIRECTORY_SAME_PACKAGE: 19 | - msp/identities.proto 20 | - msp/msp_config.proto 21 | - msp/msp_principal.proto 22 | ENUM_VALUE_PREFIX: 23 | - common/common.proto 24 | - common/policies.proto 25 | - gossip/message.proto 26 | - ledger/rwset/rwset.proto 27 | - msp/msp_principal.proto 28 | - orderer/ab.proto 29 | - peer/chaincode.proto 30 | - peer/chaincode_shim.proto 31 | - peer/transaction.proto 32 | ENUM_ZERO_VALUE_SUFFIX: 33 | - common/common.proto 34 | - common/policies.proto 35 | - gossip/message.proto 36 | - ledger/rwset/rwset.proto 37 | - msp/msp_principal.proto 38 | - orderer/ab.proto 39 | - orderer/configuration.proto 40 | - peer/chaincode.proto 41 | - peer/chaincode_shim.proto 42 | - peer/transaction.proto 43 | FIELD_LOWER_SNAKE_CASE: 44 | - common/ledger.proto 45 | - gossip/message.proto 46 | - peer/chaincode_shim.proto 47 | - peer/lifecycle/db.proto 48 | - peer/proposal.proto 49 | - peer/transaction.proto 50 | ONEOF_LOWER_SNAKE_CASE: 51 | - common/policies.proto 52 | - orderer/ab.proto 53 | - peer/events.proto 54 | - peer/lifecycle/db.proto 55 | - peer/lifecycle/lifecycle.proto 56 | - peer/policy.proto 57 | PACKAGE_DIRECTORY_MATCH: 58 | - ledger/queryresult/kv_query_result.proto 59 | - ledger/rwset/kvrwset/kv_rwset.proto 60 | - ledger/rwset/rwset.proto 61 | - msp/msp_principal.proto 62 | - orderer/etcdraft/configuration.proto 63 | - orderer/etcdraft/metadata.proto 64 | - peer/chaincode.proto 65 | - peer/chaincode_event.proto 66 | - peer/chaincode_shim.proto 67 | - peer/collection.proto 68 | - peer/configuration.proto 69 | - peer/events.proto 70 | - peer/lifecycle/chaincode_definition.proto 71 | - peer/lifecycle/db.proto 72 | - peer/lifecycle/lifecycle.proto 73 | - peer/peer.proto 74 | - peer/policy.proto 75 | - peer/proposal.proto 76 | - peer/proposal_response.proto 77 | - peer/query.proto 78 | - peer/resources.proto 79 | - peer/signed_cc_dep_spec.proto 80 | - peer/snapshot.proto 81 | - peer/transaction.proto 82 | PACKAGE_SAME_DIRECTORY: 83 | - common/collection.proto 84 | - common/common.proto 85 | - common/configtx.proto 86 | - common/configuration.proto 87 | - common/ledger.proto 88 | - common/policies.proto 89 | - msp/msp_principal.proto 90 | PACKAGE_SAME_GO_PACKAGE: 91 | - common/collection.proto 92 | - common/common.proto 93 | - common/configtx.proto 94 | - common/configuration.proto 95 | - common/ledger.proto 96 | - common/policies.proto 97 | - msp/msp_principal.proto 98 | RPC_REQUEST_RESPONSE_UNIQUE: 99 | - gossip/message.proto 100 | - orderer/ab.proto 101 | - peer/chaincode_shim.proto 102 | - peer/events.proto 103 | - peer/snapshot.proto 104 | RPC_REQUEST_STANDARD_NAME: 105 | - discovery/protocol.proto 106 | - gateway/gateway.proto 107 | - gossip/message.proto 108 | - orderer/ab.proto 109 | - peer/chaincode_shim.proto 110 | - peer/events.proto 111 | - peer/peer.proto 112 | - peer/snapshot.proto 113 | RPC_RESPONSE_STANDARD_NAME: 114 | - discovery/protocol.proto 115 | - gossip/message.proto 116 | - peer/chaincode_shim.proto 117 | - peer/events.proto 118 | - peer/peer.proto 119 | - peer/snapshot.proto 120 | SERVICE_SUFFIX: 121 | - discovery/protocol.proto 122 | - gateway/gateway.proto 123 | - gossip/message.proto 124 | - orderer/ab.proto 125 | - orderer/cluster.proto 126 | - peer/chaincode_shim.proto 127 | - peer/events.proto 128 | - peer/peer.proto 129 | - peer/snapshot.proto 130 | disallow_comment_ignores: true 131 | breaking: 132 | use: 133 | - FILE 134 | except: 135 | - EXTENSION_NO_DELETE 136 | - FIELD_SAME_DEFAULT 137 | -------------------------------------------------------------------------------- /common/collection.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/common"; 8 | option java_package = "org.hyperledger.fabric.protos.common"; 9 | 10 | package common; 11 | 12 | import "common/policies.proto"; 13 | 14 | // CollectionConfigPackage represents an array of CollectionConfig 15 | // messages; the extra struct is required because repeated oneof is 16 | // forbidden by the protobuf syntax 17 | message CollectionConfigPackage { 18 | option deprecated = true; 19 | repeated CollectionConfig config = 1; 20 | } 21 | 22 | // CollectionConfig defines the configuration of a collection object; 23 | // it currently contains a single, static type. 24 | // Dynamic collections are deferred. 25 | message CollectionConfig { 26 | option deprecated = true; 27 | oneof payload { 28 | StaticCollectionConfig static_collection_config = 1; 29 | } 30 | } 31 | 32 | 33 | // StaticCollectionConfig constitutes the configuration parameters of a 34 | // static collection object. Static collections are collections that are 35 | // known at chaincode instantiation time, and that cannot be changed. 36 | // Dynamic collections are deferred. 37 | message StaticCollectionConfig { 38 | option deprecated = true; 39 | // the name of the collection inside the denoted chaincode 40 | string name = 1; 41 | // a reference to a policy residing / managed in the config block 42 | // to define which orgs have access to this collection’s private data 43 | CollectionPolicyConfig member_orgs_policy = 2; 44 | // The minimum number of peers private data will be sent to upon 45 | // endorsement. The endorsement would fail if dissemination to at least 46 | // this number of peers is not achieved. 47 | int32 required_peer_count = 3; 48 | // The maximum number of peers that private data will be sent to 49 | // upon endorsement. This number has to be bigger than required_peer_count. 50 | int32 maximum_peer_count = 4; 51 | // The number of blocks after which the collection data expires. 52 | // For instance if the value is set to 10, a key last modified by block number 100 53 | // will be purged at block number 111. A zero value is treated same as MaxUint64 54 | uint64 block_to_live = 5; 55 | // The member only read access denotes whether only collection member clients 56 | // can read the private data (if set to true), or even non members can 57 | // read the data (if set to false, for example if you want to implement more granular 58 | // access logic in the chaincode) 59 | bool member_only_read = 6; 60 | // The member only write access denotes whether only collection member clients 61 | // can write the private data (if set to true), or even non members can 62 | // write the data (if set to false, for example if you want to implement more granular 63 | // access logic in the chaincode) 64 | bool member_only_write = 7; 65 | // a reference to a policy residing / managed in the config block 66 | // to define the endorsement policy for this collection 67 | ApplicationPolicy endorsement_policy= 8; 68 | } 69 | 70 | 71 | // Collection policy configuration. Initially, the configuration can only 72 | // contain a SignaturePolicy. In the future, the SignaturePolicy may be a 73 | // more general Policy. Instead of containing the actual policy, the 74 | // configuration may in the future contain a string reference to a policy. 75 | message CollectionPolicyConfig { 76 | option deprecated = true; 77 | oneof payload { 78 | // Initially, only a signature policy is supported. 79 | SignaturePolicyEnvelope signature_policy = 1; 80 | // Later, the SignaturePolicy will be replaced by a Policy. 81 | // Policy policy = 1; 82 | // A reference to a Policy is planned to be added later. 83 | // string reference = 2; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /common/common.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/common"; 8 | option java_package = "org.hyperledger.fabric.protos.common"; 9 | 10 | package common; 11 | 12 | import "google/protobuf/timestamp.proto"; 13 | 14 | // These status codes are intended to resemble selected HTTP status codes 15 | enum Status { 16 | UNKNOWN = 0; 17 | SUCCESS = 200; 18 | BAD_REQUEST = 400; 19 | FORBIDDEN = 403; 20 | NOT_FOUND = 404; 21 | REQUEST_ENTITY_TOO_LARGE = 413; 22 | INTERNAL_SERVER_ERROR = 500; 23 | NOT_IMPLEMENTED = 501; 24 | SERVICE_UNAVAILABLE = 503; 25 | } 26 | 27 | enum HeaderType { 28 | reserved 7, 8, 9; 29 | reserved "PEER_RESOURCE_UPDATE", "PEER_ADMIN_OPERATION", "TOKEN_TRANSACTION"; 30 | 31 | MESSAGE = 0; // Used for messages which are signed but opaque 32 | CONFIG = 1; // Used for messages which express the channel config 33 | CONFIG_UPDATE = 2; // Used for transactions which update the channel config 34 | ENDORSER_TRANSACTION = 3; // Used by the SDK to submit endorser based transactions 35 | ORDERER_TRANSACTION = 4 [deprecated = true]; // Was used internally by the orderer for management, no longer used since system channel was removed 36 | DELIVER_SEEK_INFO = 5; // Used as the type for Envelope messages submitted to instruct the Deliver API to seek 37 | CHAINCODE_PACKAGE = 6; // Used for packaging chaincode artifacts for install 38 | } 39 | 40 | // This enum enlists indexes of the block metadata array 41 | enum BlockMetadataIndex { 42 | SIGNATURES = 0; // Block metadata array position for block signatures 43 | LAST_CONFIG = 1 [deprecated=true]; // Block metadata array position to store last configuration block sequence number 44 | TRANSACTIONS_FILTER = 2; // Block metadata array position to store serialized bit array filter of invalid transactions 45 | ORDERER = 3 [deprecated=true]; // Block metadata array position to store operational metadata for orderers 46 | COMMIT_HASH = 4; /* Block metadata array position to store the hash of TRANSACTIONS_FILTER, State Updates, 47 | and the COMMIT_HASH of the previous block */ 48 | } 49 | 50 | // LastConfig is the encoded value for the Metadata message which is encoded in the LAST_CONFIGURATION block metadata index 51 | message LastConfig { 52 | uint64 index = 1; 53 | } 54 | 55 | // Metadata is a common structure to be used to encode block metadata 56 | message Metadata { 57 | bytes value = 1; 58 | repeated MetadataSignature signatures = 2; 59 | } 60 | 61 | message MetadataSignature { 62 | bytes signature_header = 1; // An encoded SignatureHeader 63 | bytes signature = 2; // The signature over the concatenation of the Metadata value bytes, signatureHeader, and block header 64 | bytes identifier_header = 3; // An encoded IdentifierHeader. If the signature header is empty, this is used to identify the creator by id 65 | } 66 | 67 | // IdentifierHeader is used as an alternative to a SignatureHeader when the creator can be referenced by id 68 | message IdentifierHeader { 69 | uint32 identifier = 1; // A unique identifier that represents the creator of the message 70 | bytes nonce = 2; // Arbitrary number that may only be used once. Can be used to detect replay attacks. 71 | } 72 | 73 | message Header { 74 | bytes channel_header = 1; 75 | bytes signature_header = 2; 76 | } 77 | 78 | // Header is a generic replay prevention and identity message to include in a signed payload 79 | message ChannelHeader { 80 | int32 type = 1; // Header types 0-10000 are reserved and defined by HeaderType 81 | 82 | // Version indicates message protocol version 83 | int32 version = 2; 84 | 85 | // Timestamp is the local time when the message was created 86 | // by the sender 87 | google.protobuf.Timestamp timestamp = 3; 88 | 89 | // Identifier of the channel this message is bound for 90 | string channel_id = 4; 91 | 92 | // An unique identifier that is used end-to-end. 93 | // - set by higher layers such as end user or SDK 94 | // - passed to the endorser (which will check for uniqueness) 95 | // - as the header is passed along unchanged, it will be 96 | // be retrieved by the committer (uniqueness check here as well) 97 | // - to be stored in the ledger 98 | string tx_id = 5; 99 | 100 | // The epoch in which this header was generated, where epoch is defined based on block height 101 | // Epoch in which the response has been generated. This field identifies a 102 | // logical window of time. A proposal response is accepted by a peer only if 103 | // two conditions hold: 104 | // 1. the epoch specified in the message is the current epoch 105 | // 2. this message has been only seen once during this epoch (i.e. it hasn't 106 | // been replayed) 107 | uint64 epoch = 6; 108 | 109 | // Extension that may be attached based on the header type 110 | bytes extension = 7; 111 | 112 | // If mutual TLS is employed, this represents 113 | // the hash of the client's TLS certificate 114 | bytes tls_cert_hash = 8; 115 | } 116 | 117 | message SignatureHeader { 118 | // Creator of the message, a marshaled msp.SerializedIdentity 119 | bytes creator = 1; 120 | 121 | // Arbitrary number that may only be used once. Can be used to detect replay attacks. 122 | bytes nonce = 2; 123 | } 124 | 125 | // Payload is the message contents (and header to allow for signing) 126 | message Payload { 127 | 128 | // Header is included to provide identity and prevent replay 129 | Header header = 1; 130 | 131 | // Data, the encoding of which is defined by the type in the header 132 | bytes data = 2; 133 | } 134 | 135 | // Envelope wraps a Payload with a signature so that the message may be authenticated 136 | message Envelope { 137 | // A marshaled Payload 138 | bytes payload = 1; 139 | 140 | // A signature by the creator specified in the Payload header 141 | bytes signature = 2; 142 | } 143 | 144 | // This is finalized block structure to be shared among the orderer and peer 145 | // Note that the BlockHeader chains to the previous BlockHeader, and the BlockData hash is embedded 146 | // in the BlockHeader. This makes it natural and obvious that the Data is included in the hash, but 147 | // the Metadata is not. 148 | message Block { 149 | BlockHeader header = 1; 150 | BlockData data = 2; 151 | BlockMetadata metadata = 3; 152 | } 153 | 154 | // BlockHeader is the element of the block which forms the block chain 155 | // The block header is hashed using the configured chain hashing algorithm 156 | // over the ASN.1 encoding of the BlockHeader 157 | message BlockHeader { 158 | uint64 number = 1; // The position in the blockchain 159 | bytes previous_hash = 2; // The hash of the previous block header 160 | bytes data_hash = 3; // The hash of the BlockData, by MerkleTree 161 | } 162 | 163 | message BlockData { 164 | repeated bytes data = 1; 165 | } 166 | 167 | message BlockMetadata { 168 | repeated bytes metadata = 1; 169 | } 170 | 171 | // OrdererBlockMetadata defines metadata that is set by the ordering service. 172 | message OrdererBlockMetadata { 173 | LastConfig last_config = 1; 174 | bytes consenter_metadata = 2; 175 | } 176 | -------------------------------------------------------------------------------- /common/configtx.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/common"; 8 | option java_package = "org.hyperledger.fabric.protos.common"; 9 | 10 | package common; 11 | 12 | import "common/common.proto"; 13 | import "common/policies.proto"; 14 | 15 | // ConfigEnvelope is designed to contain _all_ configuration for a chain with no dependency 16 | // on previous configuration transactions. 17 | // 18 | // It is generated with the following scheme: 19 | // 1. Retrieve the existing configuration 20 | // 2. Note the config properties (ConfigValue, ConfigPolicy, ConfigGroup) to be modified 21 | // 3. Add any intermediate ConfigGroups to the ConfigUpdate.read_set (sparsely) 22 | // 4. Add any additional desired dependencies to ConfigUpdate.read_set (sparsely) 23 | // 5. Modify the config properties, incrementing each version by 1, set them in the ConfigUpdate.write_set 24 | // Note: any element not modified but specified should already be in the read_set, so may be specified sparsely 25 | // 6. Create ConfigUpdate message and marshal it into ConfigUpdateEnvelope.update and encode the required signatures 26 | // a) Each signature is of type ConfigSignature 27 | // b) The ConfigSignature signature is over the concatenation of signature_header and the ConfigUpdate bytes (which includes a ChainHeader) 28 | // 5. Submit new Config for ordering in Envelope signed by submitter 29 | // a) The Envelope Payload has data set to the marshaled ConfigEnvelope 30 | // b) The Envelope Payload has a header of type Header.Type.CONFIG_UPDATE 31 | // 32 | // The configuration manager will verify: 33 | // 1. All items in the read_set exist at the read versions 34 | // 2. All items in the write_set at a different version than, or not in, the read_set have been appropriately signed according to their mod_policy 35 | // 3. The new configuration satisfies the ConfigSchema 36 | message ConfigEnvelope { 37 | Config config = 1; // A marshaled Config structure 38 | Envelope last_update = 2; // The last CONFIG_UPDATE message which generated this current configuration 39 | // Note that CONFIG_UPDATE has a Payload.Data of a Marshaled ConfigUpdate 40 | } 41 | 42 | // Config represents the config for a particular channel 43 | message Config { 44 | // Prevent removed tag re-use 45 | reserved 3; 46 | reserved "type"; 47 | 48 | uint64 sequence = 1; 49 | ConfigGroup channel_group = 2; // channel_group is a bad name for this, it should be changed to root when API breakage is allowed 50 | } 51 | 52 | message ConfigUpdateEnvelope { 53 | bytes config_update = 1; // A marshaled ConfigUpdate structure 54 | repeated ConfigSignature signatures = 2; // Signatures over the config_update 55 | } 56 | 57 | // ConfigUpdate is used to submit a subset of config and to have the orderer apply to Config 58 | // it is always submitted inside a ConfigUpdateEnvelope which allows the addition of signatures 59 | // resulting in a new total configuration. The update is applied as follows: 60 | // 1. The versions from all of the elements in the read_set is verified against the versions in the existing config. 61 | // If there is a mismatch in the read versions, then the config update fails and is rejected. 62 | // 2. Any elements in the write_set with the same version as the read_set are ignored. 63 | // 3. The corresponding mod_policy for every remaining element in the write_set is collected. 64 | // 4. Each policy is checked against the signatures from the ConfigUpdateEnvelope, any failing to verify are rejected 65 | // 5. The write_set is applied to the Config and the ConfigGroupSchema verifies that the updates were legal 66 | message ConfigUpdate { 67 | // Prevent removed tag re-use 68 | reserved 4; 69 | reserved "type"; 70 | 71 | string channel_id = 1; // Which channel this config update is for 72 | ConfigGroup read_set = 2; // ReadSet explicitly lists the portion of the config which was read, this should be sparse with only Version set 73 | ConfigGroup write_set = 3; // WriteSet lists the portion of the config which was written, this should included updated Versions 74 | map isolated_data = 5; // Data which is not to be reflected in the resulting Config, but is still needed for some other purpose. For instance, rscc_seed_data 75 | } 76 | 77 | // ConfigGroup is the hierarchical data structure for holding config 78 | message ConfigGroup { 79 | uint64 version = 1; 80 | map groups = 2; 81 | map values = 3; 82 | map policies = 4; 83 | string mod_policy = 5; 84 | } 85 | 86 | // ConfigValue represents an individual piece of config data 87 | message ConfigValue { 88 | uint64 version = 1; 89 | bytes value = 2; 90 | string mod_policy = 3; 91 | } 92 | 93 | message ConfigPolicy { 94 | uint64 version = 1; 95 | Policy policy = 2; 96 | string mod_policy = 3; 97 | } 98 | 99 | message ConfigSignature { 100 | bytes signature_header = 1; // A marshaled SignatureHeader 101 | bytes signature = 2; // Signature over the concatenation signatureHeader bytes and config bytes 102 | } 103 | -------------------------------------------------------------------------------- /common/configuration.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/common"; 8 | option java_package = "org.hyperledger.fabric.protos.common"; 9 | 10 | package common; 11 | 12 | // HashingAlgorithm is encoded into the configuration transaction as a 13 | // configuration item of type Chain with a Key of "HashingAlgorithm" and a 14 | // Value of HashingAlgorithm as marshaled protobuf bytes 15 | message HashingAlgorithm { 16 | // SHA256 is currently the only supported and tested algorithm. 17 | string name = 1; 18 | } 19 | 20 | // BlockDataHashingStructure is encoded into the configuration transaction as a configuration item of 21 | // type Chain with a Key of "BlockDataHashingStructure" and a Value of HashingAlgorithm as marshaled protobuf bytes 22 | message BlockDataHashingStructure { 23 | // width specifies the width of the Merkle tree to use when computing the BlockDataHash 24 | // in order to replicate flat hashing, set this width to MAX_UINT32 25 | uint32 width = 1; 26 | } 27 | 28 | // OrdererAddresses is encoded into the configuration transaction as a configuration item of type Chain 29 | // with a Key of "OrdererAddresses" and a Value of OrdererAddresses as marshaled protobuf bytes 30 | message OrdererAddresses { 31 | repeated string addresses = 1; 32 | } 33 | 34 | // Consenter represents a consenting node (i.e. replica). 35 | message Consenter { 36 | uint32 id = 1; 37 | string host = 2; 38 | uint32 port = 3; 39 | string msp_id = 4; 40 | bytes identity = 5; 41 | bytes client_tls_cert = 6; 42 | bytes server_tls_cert = 7; 43 | } 44 | 45 | // Orderers is encoded into the configuration transaction as a configuration item of type Chain 46 | // with a Key of "Orderers" and a Value of Orderers as marshaled protobuf bytes 47 | message Orderers { 48 | repeated Consenter consenter_mapping = 1; 49 | } 50 | 51 | // Consortium represents the consortium context in which the channel was created 52 | message Consortium { 53 | string name = 1; 54 | } 55 | 56 | 57 | // Capabilities message defines the capabilities a particular binary must implement 58 | // for that binary to be able to safely participate in the channel. The capabilities 59 | // message is defined at the /Channel level, the /Channel/Application level, and the 60 | // /Channel/Orderer level. 61 | // 62 | // The /Channel level capabilties define capabilities which both the orderer and peer 63 | // binaries must satisfy. These capabilties might be things like a new MSP type, 64 | // or a new policy type. 65 | // 66 | // The /Channel/Orderer level capabilties define capabilities which must be supported 67 | // by the orderer, but which have no bearing on the behavior of the peer. For instance 68 | // if the orderer changes the logic for how it constructs new channels, only all orderers 69 | // must agree on the new logic. The peers do not need to be aware of this change as 70 | // they only interact with the channel after it has been constructed. 71 | // 72 | // Finally, the /Channel/Application level capabilities define capabilities which the peer 73 | // binary must satisfy, but which have no bearing on the orderer. For instance, if the 74 | // peer adds a new UTXO transaction type, or changes the chaincode lifecycle requirements, 75 | // all peers must agree on the new logic. However, orderers never inspect transactions 76 | // this deeply, and therefore have no need to be aware of the change. 77 | // 78 | // The capabilities strings defined in these messages typically correspond to release 79 | // binary versions (e.g. "V1.1"), and are used primarilly as a mechanism for a fully 80 | // upgraded network to switch from one set of logic to a new one. 81 | // 82 | // Although for V1.1, the orderers must be upgraded to V1.1 prior to the rest of the 83 | // network, going forward, because of the split between the /Channel, /Channel/Orderer 84 | // and /Channel/Application capabilities. It should be possible for the orderer and 85 | // application networks to upgrade themselves independently (with the exception of any 86 | // new capabilities defined at the /Channel level). 87 | message Capabilities { 88 | map capabilities = 1; 89 | } 90 | 91 | // Capability is an empty message for the time being. It is defined as a protobuf 92 | // message rather than a constant, so that we may extend capabilities with other fields 93 | // if the need arises in the future. For the time being, a capability being in the 94 | // capabilities map requires that that capability be supported. 95 | message Capability { } 96 | -------------------------------------------------------------------------------- /common/ledger.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/common"; 8 | option java_package = "org.hyperledger.fabric.protos.common"; 9 | 10 | package common; 11 | 12 | // Contains information about the blockchain ledger such as height, current 13 | // block hash, and previous block hash. 14 | message BlockchainInfo { 15 | uint64 height = 1; 16 | bytes currentBlockHash = 2; 17 | bytes previousBlockHash = 3; 18 | // Specifies bootstrapping snapshot info if the channel is bootstrapped from a snapshot. 19 | // It is nil if the channel is not bootstrapped from a snapshot. 20 | BootstrappingSnapshotInfo bootstrappingSnapshotInfo = 4; 21 | } 22 | 23 | // Contains information for the bootstrapping snapshot. 24 | message BootstrappingSnapshotInfo { 25 | uint64 lastBlockInSnapshot = 1; 26 | } 27 | -------------------------------------------------------------------------------- /common/policies.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/common"; 8 | option java_package = "org.hyperledger.fabric.protos.common"; 9 | 10 | package common; 11 | 12 | import "msp/msp_principal.proto"; 13 | 14 | // Policy expresses a policy which the orderer can evaluate, because there has been some desire expressed to support 15 | // multiple policy engines, this is typed as a oneof for now 16 | message Policy { 17 | enum PolicyType { 18 | UNKNOWN = 0; // Reserved to check for proper initialization 19 | SIGNATURE = 1; 20 | MSP = 2; 21 | IMPLICIT_META = 3; 22 | } 23 | int32 type = 1; // For outside implementors, consider the first 1000 types reserved, otherwise one of PolicyType 24 | bytes value = 2; 25 | } 26 | 27 | // SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements 28 | message SignaturePolicyEnvelope { 29 | int32 version = 1; 30 | SignaturePolicy rule = 2; 31 | repeated MSPPrincipal identities = 3; 32 | } 33 | 34 | // SignaturePolicy is a recursive message structure which defines a featherweight DSL for describing 35 | // policies which are more complicated than 'exactly this signature'. The NOutOf operator is sufficent 36 | // to express AND as well as OR, as well as of course N out of the following M policies 37 | // SignedBy implies that the signature is from a valid certificate which is signed by the trusted 38 | // authority specified in the bytes. This will be the certificate itself for a self-signed certificate 39 | // and will be the CA for more traditional certificates 40 | message SignaturePolicy { 41 | message NOutOf { 42 | int32 n = 1; 43 | repeated SignaturePolicy rules = 2; 44 | } 45 | oneof Type { 46 | int32 signed_by = 1; 47 | NOutOf n_out_of = 2; 48 | } 49 | } 50 | 51 | // ImplicitMetaPolicy is a policy type which depends on the hierarchical nature of the configuration 52 | // It is implicit because the rule is generate implicitly based on the number of sub policies 53 | // It is meta because it depends only on the result of other policies 54 | // When evaluated, this policy iterates over all immediate child sub-groups, retrieves the policy 55 | // of name sub_policy, evaluates the collection and applies the rule. 56 | // For example, with 4 sub-groups, and a policy name of "foo", ImplicitMetaPolicy retrieves 57 | // each sub-group, retrieves policy "foo" for each subgroup, evaluates it, and, in the case of ANY 58 | // 1 satisfied is sufficient, ALL would require 4 signatures, and MAJORITY would require 3 signatures. 59 | message ImplicitMetaPolicy { 60 | enum Rule { 61 | ANY = 0; // Requires any of the sub-policies be satisfied, if no sub-policies exist, always returns true 62 | ALL = 1; // Requires all of the sub-policies be satisfied 63 | MAJORITY = 2; // Requires a strict majority (greater than half) of the sub-policies be satisfied 64 | } 65 | string sub_policy = 1; 66 | Rule rule = 2; 67 | } 68 | 69 | // ApplicationPolicy captures the diffenrent policy types that 70 | // are set and evaluted at the application level. 71 | message ApplicationPolicy { 72 | option deprecated = true; 73 | oneof Type { 74 | // SignaturePolicy type is used if the policy is specified as 75 | // a combination (using threshold gates) of signatures from MSP 76 | // principals 77 | SignaturePolicyEnvelope signature_policy = 1; 78 | 79 | // ChannelConfigPolicyReference is used when the policy is 80 | // specified as a string that references a policy defined in 81 | // the configuration of the channel 82 | string channel_config_policy_reference = 2; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /discovery/protocol.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/discovery"; 8 | option java_package = "org.hyperledger.fabric.protos.discovery"; 9 | 10 | package discovery; 11 | 12 | import "gossip/message.proto"; 13 | import "msp/msp_config.proto"; 14 | import "peer/proposal_response.proto"; 15 | 16 | // Discovery defines a service that serves information about the fabric network 17 | // like which peers, orderers, chaincodes, etc. 18 | service Discovery { 19 | // Discover receives a signed request, and returns a response. 20 | rpc Discover (SignedRequest) returns (Response); 21 | } 22 | 23 | // SignedRequest contains a serialized Request in the payload field 24 | // and a signature. 25 | // The identity that is used to verify the signature 26 | // can be extracted from the authentication field of type AuthInfo 27 | // in the Request itself after deserializing it. 28 | message SignedRequest { 29 | bytes payload = 1; 30 | bytes signature = 2; 31 | } 32 | 33 | // Request contains authentication info about the client that sent the request 34 | // and the queries it wishes to query the service 35 | message Request { 36 | // authentication contains information that the service uses to check 37 | // the client's eligibility for the queries. 38 | AuthInfo authentication = 1; 39 | // queries 40 | repeated Query queries = 2; 41 | } 42 | 43 | message Response { 44 | // The results are returned in the same order of the queries 45 | repeated QueryResult results = 1; 46 | } 47 | 48 | // AuthInfo aggregates authentication information that the server uses 49 | // to authenticate the client 50 | message AuthInfo { 51 | // This is the identity of the client that is used to verify the signature 52 | // on the SignedRequest's payload. 53 | // It is a msp.SerializedIdentity in bytes form 54 | bytes client_identity = 1; 55 | 56 | // This is the hash of the client's TLS cert. 57 | // When the network is running with TLS, clients that don't include a certificate 58 | // will be denied access to the service. 59 | // Since the Request is encapsulated with a SignedRequest (which is signed), 60 | // this binds the TLS session to the enrollement identity of the client and 61 | // therefore both authenticates the client to the server, 62 | // and also prevents the server from relaying the request message to another server. 63 | bytes client_tls_cert_hash = 2; 64 | } 65 | 66 | // Query asks for information in the context of a specific channel 67 | message Query { 68 | string channel = 1; 69 | oneof query { 70 | // ConfigQuery is used to query for the configuration of the channel, 71 | // such as FabricMSPConfig, and rorderer endpoints. 72 | // The client has to query a peer it trusts as it doesn't have means to self-verify 73 | // the authenticity of the returned result. 74 | // The result is returned in the form of ConfigResult. 75 | ConfigQuery config_query = 2; 76 | 77 | // PeerMembershipQuery queries for peers in a channel context, 78 | // and returns PeerMembershipResult 79 | PeerMembershipQuery peer_query = 3; 80 | 81 | // ChaincodeQuery queries for chaincodes by their name and version. 82 | // An empty version means any version can by returned. 83 | ChaincodeQuery cc_query = 4; 84 | 85 | // LocalPeerQuery queries for peers in a non channel context, 86 | // and returns PeerMembershipResult 87 | LocalPeerQuery local_peers = 5; 88 | } 89 | } 90 | 91 | // QueryResult contains a result for a given Query. 92 | // The corresponding Query can be inferred by the index of the QueryResult from 93 | // its enclosing Response message. 94 | // QueryResults are ordered in the same order as the Queries are ordered in their enclosing Request. 95 | message QueryResult { 96 | oneof result { 97 | // Error indicates failure or refusal to process the query 98 | Error error = 1; 99 | 100 | // ConfigResult contains the configuration of the channel, 101 | // such as FabricMSPConfig and orderer endpoints 102 | ConfigResult config_result = 2; 103 | 104 | // ChaincodeQueryResult contains information about chaincodes, 105 | // and their corresponding endorsers 106 | ChaincodeQueryResult cc_query_res = 3; 107 | 108 | // PeerMembershipResult contains information about peers, 109 | // such as their identity, endpoints, and channel related state. 110 | PeerMembershipResult members = 4; 111 | } 112 | } 113 | 114 | // ConfigQuery requests a ConfigResult 115 | message ConfigQuery { 116 | 117 | } 118 | 119 | message ConfigResult { 120 | // msps is a map from MSP_ID to FabricMSPConfig 121 | map msps = 1; 122 | // orderers is a map from MSP_ID to endpoint lists of orderers 123 | map orderers = 2; 124 | } 125 | 126 | // PeerMembershipQuery requests PeerMembershipResult. 127 | // The filter field may be optionally populated in order 128 | // for the peer membership to be filtered according to 129 | // chaincodes that are installed on peers and collection 130 | // access control policies. 131 | message PeerMembershipQuery { 132 | protos.ChaincodeInterest filter = 1; 133 | } 134 | 135 | // PeerMembershipResult contains peers mapped by their organizations (MSP_ID) 136 | message PeerMembershipResult { 137 | map peers_by_org = 1; 138 | } 139 | 140 | // ChaincodeQuery requests ChaincodeQueryResults for a given 141 | // list of chaincode invocations. 142 | // Each invocation is a separate one, and the endorsement policy 143 | // is evaluated independantly for each given interest. 144 | message ChaincodeQuery { 145 | repeated protos.ChaincodeInterest interests = 1; 146 | } 147 | 148 | // ChaincodeQueryResult contains EndorsementDescriptors for 149 | // chaincodes 150 | message ChaincodeQueryResult { 151 | repeated EndorsementDescriptor content = 1; 152 | } 153 | 154 | // LocalPeerQuery queries for peers in a non channel context 155 | message LocalPeerQuery { 156 | } 157 | 158 | // EndorsementDescriptor contains information about which peers can be used 159 | // to request endorsement from, such that the endorsement policy would be fulfilled. 160 | // Here is how to compute a set of peers to ask an endorsement from, given an EndorsementDescriptor: 161 | // Let e: G --> P be the endorsers_by_groups field that maps a group to a set of peers. 162 | // Note that applying e on a group g yields a set of peers. 163 | // 1) Select a layout l: G --> N out of the layouts given. 164 | // l is the quantities_by_group field of a Layout, and it maps a group to an integer. 165 | // 2) R = {} (an empty set of peers) 166 | // 3) For each group g in the layout l, compute n = l(g) 167 | // 3.1) Denote P_g as a set of n random peers {p0, p1, ... p_n} selected from e(g) 168 | // 3.2) R = R U P_g (add P_g to R) 169 | // 4) The set of peers R is the peers the client needs to request endorsements from 170 | message EndorsementDescriptor { 171 | string chaincode = 1; 172 | // Specifies the endorsers, separated to groups. 173 | map endorsers_by_groups = 2; 174 | 175 | // Specifies options of fulfulling the endorsement policy. 176 | // Each option lists the group names, and the amount of signatures needed 177 | // from each group. 178 | repeated Layout layouts = 3; 179 | } 180 | 181 | // Layout contains a mapping from a group name to number of peers 182 | // that are needed for fulfilling an endorsement policy 183 | message Layout { 184 | // Specifies how many non repeated signatures of each group 185 | // are needed for endorsement 186 | map quantities_by_group = 1; 187 | } 188 | 189 | // Peers contains a list of Peer(s) 190 | message Peers { 191 | repeated Peer peers = 1; 192 | } 193 | 194 | // Peer contains information about the peer such as its channel specific 195 | // state, and membership information. 196 | message Peer { 197 | // This is an Envelope of a GossipMessage with a gossip.StateInfo message 198 | gossip.Envelope state_info = 1; 199 | // This is an Envelope of a GossipMessage with a gossip.AliveMessage message 200 | gossip.Envelope membership_info = 2; 201 | 202 | // This is the msp.SerializedIdentity of the peer, represented in bytes. 203 | bytes identity = 3; 204 | } 205 | 206 | // Error denotes that something went wrong and contains the error message 207 | message Error { 208 | string content = 1; 209 | } 210 | 211 | // Endpoints is a list of Endpoint(s) 212 | message Endpoints { 213 | repeated Endpoint endpoint = 1; 214 | } 215 | 216 | // Endpoint is a combination of a host and a port 217 | message Endpoint { 218 | string host = 1; 219 | uint32 port = 2; 220 | } 221 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _site/ 2 | .sass-cache/ 3 | .jekyll-cache/ 4 | .jekyll-metadata 5 | # Ignore folders generated by Bundler 6 | .bundle/ 7 | vendor/ 8 | -------------------------------------------------------------------------------- /docs/404.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "404 - Page Not Found" 3 | permalink: /404.html 4 | --- 5 | 6 | ## The page you wanted does not exist 7 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rake' 4 | gem 'github-pages' 5 | gem 'jekyll-optional-front-matter' 6 | gem 'jekyll-titles-from-headings' 7 | gem 'jekyll-relative-links' 8 | -------------------------------------------------------------------------------- /docs/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | activesupport (6.1.7.10) 5 | concurrent-ruby (~> 1.0, >= 1.0.2) 6 | i18n (>= 1.6, < 2) 7 | minitest (>= 5.1) 8 | tzinfo (~> 2.0) 9 | zeitwerk (~> 2.3) 10 | addressable (2.8.7) 11 | public_suffix (>= 2.0.2, < 7.0) 12 | base64 (0.2.0) 13 | coffee-script (2.4.1) 14 | coffee-script-source 15 | execjs 16 | coffee-script-source (1.12.2) 17 | colorator (1.1.0) 18 | commonmarker (0.23.11) 19 | concurrent-ruby (1.3.5) 20 | dnsruby (1.72.3) 21 | base64 (~> 0.2.0) 22 | simpleidn (~> 0.2.1) 23 | em-websocket (0.5.3) 24 | eventmachine (>= 0.12.9) 25 | http_parser.rb (~> 0) 26 | ethon (0.16.0) 27 | ffi (>= 1.15.0) 28 | eventmachine (1.2.7) 29 | execjs (2.10.0) 30 | faraday (2.8.1) 31 | base64 32 | faraday-net_http (>= 2.0, < 3.1) 33 | ruby2_keywords (>= 0.0.4) 34 | faraday-net_http (3.0.2) 35 | ffi (1.17.1) 36 | forwardable-extended (2.6.0) 37 | gemoji (4.1.0) 38 | github-pages (230) 39 | github-pages-health-check (= 1.18.2) 40 | jekyll (= 3.9.5) 41 | jekyll-avatar (= 0.8.0) 42 | jekyll-coffeescript (= 1.2.2) 43 | jekyll-commonmark-ghpages (= 0.4.0) 44 | jekyll-default-layout (= 0.1.5) 45 | jekyll-feed (= 0.17.0) 46 | jekyll-gist (= 1.5.0) 47 | jekyll-github-metadata (= 2.16.1) 48 | jekyll-include-cache (= 0.2.1) 49 | jekyll-mentions (= 1.6.0) 50 | jekyll-optional-front-matter (= 0.3.2) 51 | jekyll-paginate (= 1.1.0) 52 | jekyll-readme-index (= 0.3.0) 53 | jekyll-redirect-from (= 0.16.0) 54 | jekyll-relative-links (= 0.7.0) 55 | jekyll-remote-theme (= 0.4.3) 56 | jekyll-sass-converter (= 1.5.2) 57 | jekyll-seo-tag (= 2.8.0) 58 | jekyll-sitemap (= 1.4.0) 59 | jekyll-swiss (= 1.0.0) 60 | jekyll-theme-architect (= 0.2.0) 61 | jekyll-theme-cayman (= 0.2.0) 62 | jekyll-theme-dinky (= 0.2.0) 63 | jekyll-theme-hacker (= 0.2.0) 64 | jekyll-theme-leap-day (= 0.2.0) 65 | jekyll-theme-merlot (= 0.2.0) 66 | jekyll-theme-midnight (= 0.2.0) 67 | jekyll-theme-minimal (= 0.2.0) 68 | jekyll-theme-modernist (= 0.2.0) 69 | jekyll-theme-primer (= 0.6.0) 70 | jekyll-theme-slate (= 0.2.0) 71 | jekyll-theme-tactile (= 0.2.0) 72 | jekyll-theme-time-machine (= 0.2.0) 73 | jekyll-titles-from-headings (= 0.5.3) 74 | jemoji (= 0.13.0) 75 | kramdown (= 2.4.0) 76 | kramdown-parser-gfm (= 1.1.0) 77 | liquid (= 4.0.4) 78 | mercenary (~> 0.3) 79 | minima (= 2.5.1) 80 | nokogiri (>= 1.13.6, < 2.0) 81 | rouge (= 3.30.0) 82 | terminal-table (~> 1.4) 83 | github-pages-health-check (1.18.2) 84 | addressable (~> 2.3) 85 | dnsruby (~> 1.60) 86 | octokit (>= 4, < 8) 87 | public_suffix (>= 3.0, < 6.0) 88 | typhoeus (~> 1.3) 89 | html-pipeline (2.14.3) 90 | activesupport (>= 2) 91 | nokogiri (>= 1.4) 92 | http_parser.rb (0.8.0) 93 | i18n (1.14.7) 94 | concurrent-ruby (~> 1.0) 95 | jekyll (3.9.5) 96 | addressable (~> 2.4) 97 | colorator (~> 1.0) 98 | em-websocket (~> 0.5) 99 | i18n (>= 0.7, < 2) 100 | jekyll-sass-converter (~> 1.0) 101 | jekyll-watch (~> 2.0) 102 | kramdown (>= 1.17, < 3) 103 | liquid (~> 4.0) 104 | mercenary (~> 0.3.3) 105 | pathutil (~> 0.9) 106 | rouge (>= 1.7, < 4) 107 | safe_yaml (~> 1.0) 108 | jekyll-avatar (0.8.0) 109 | jekyll (>= 3.0, < 5.0) 110 | jekyll-coffeescript (1.2.2) 111 | coffee-script (~> 2.2) 112 | coffee-script-source (~> 1.12) 113 | jekyll-commonmark (1.4.0) 114 | commonmarker (~> 0.22) 115 | jekyll-commonmark-ghpages (0.4.0) 116 | commonmarker (~> 0.23.7) 117 | jekyll (~> 3.9.0) 118 | jekyll-commonmark (~> 1.4.0) 119 | rouge (>= 2.0, < 5.0) 120 | jekyll-default-layout (0.1.5) 121 | jekyll (>= 3.0, < 5.0) 122 | jekyll-feed (0.17.0) 123 | jekyll (>= 3.7, < 5.0) 124 | jekyll-gist (1.5.0) 125 | octokit (~> 4.2) 126 | jekyll-github-metadata (2.16.1) 127 | jekyll (>= 3.4, < 5.0) 128 | octokit (>= 4, < 7, != 4.4.0) 129 | jekyll-include-cache (0.2.1) 130 | jekyll (>= 3.7, < 5.0) 131 | jekyll-mentions (1.6.0) 132 | html-pipeline (~> 2.3) 133 | jekyll (>= 3.7, < 5.0) 134 | jekyll-optional-front-matter (0.3.2) 135 | jekyll (>= 3.0, < 5.0) 136 | jekyll-paginate (1.1.0) 137 | jekyll-readme-index (0.3.0) 138 | jekyll (>= 3.0, < 5.0) 139 | jekyll-redirect-from (0.16.0) 140 | jekyll (>= 3.3, < 5.0) 141 | jekyll-relative-links (0.7.0) 142 | jekyll (>= 3.3, < 5.0) 143 | jekyll-remote-theme (0.4.3) 144 | addressable (~> 2.0) 145 | jekyll (>= 3.5, < 5.0) 146 | jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) 147 | rubyzip (>= 1.3.0, < 3.0) 148 | jekyll-sass-converter (1.5.2) 149 | sass (~> 3.4) 150 | jekyll-seo-tag (2.8.0) 151 | jekyll (>= 3.8, < 5.0) 152 | jekyll-sitemap (1.4.0) 153 | jekyll (>= 3.7, < 5.0) 154 | jekyll-swiss (1.0.0) 155 | jekyll-theme-architect (0.2.0) 156 | jekyll (> 3.5, < 5.0) 157 | jekyll-seo-tag (~> 2.0) 158 | jekyll-theme-cayman (0.2.0) 159 | jekyll (> 3.5, < 5.0) 160 | jekyll-seo-tag (~> 2.0) 161 | jekyll-theme-dinky (0.2.0) 162 | jekyll (> 3.5, < 5.0) 163 | jekyll-seo-tag (~> 2.0) 164 | jekyll-theme-hacker (0.2.0) 165 | jekyll (> 3.5, < 5.0) 166 | jekyll-seo-tag (~> 2.0) 167 | jekyll-theme-leap-day (0.2.0) 168 | jekyll (> 3.5, < 5.0) 169 | jekyll-seo-tag (~> 2.0) 170 | jekyll-theme-merlot (0.2.0) 171 | jekyll (> 3.5, < 5.0) 172 | jekyll-seo-tag (~> 2.0) 173 | jekyll-theme-midnight (0.2.0) 174 | jekyll (> 3.5, < 5.0) 175 | jekyll-seo-tag (~> 2.0) 176 | jekyll-theme-minimal (0.2.0) 177 | jekyll (> 3.5, < 5.0) 178 | jekyll-seo-tag (~> 2.0) 179 | jekyll-theme-modernist (0.2.0) 180 | jekyll (> 3.5, < 5.0) 181 | jekyll-seo-tag (~> 2.0) 182 | jekyll-theme-primer (0.6.0) 183 | jekyll (> 3.5, < 5.0) 184 | jekyll-github-metadata (~> 2.9) 185 | jekyll-seo-tag (~> 2.0) 186 | jekyll-theme-slate (0.2.0) 187 | jekyll (> 3.5, < 5.0) 188 | jekyll-seo-tag (~> 2.0) 189 | jekyll-theme-tactile (0.2.0) 190 | jekyll (> 3.5, < 5.0) 191 | jekyll-seo-tag (~> 2.0) 192 | jekyll-theme-time-machine (0.2.0) 193 | jekyll (> 3.5, < 5.0) 194 | jekyll-seo-tag (~> 2.0) 195 | jekyll-titles-from-headings (0.5.3) 196 | jekyll (>= 3.3, < 5.0) 197 | jekyll-watch (2.2.1) 198 | listen (~> 3.0) 199 | jemoji (0.13.0) 200 | gemoji (>= 3, < 5) 201 | html-pipeline (~> 2.2) 202 | jekyll (>= 3.0, < 5.0) 203 | kramdown (2.4.0) 204 | rexml 205 | kramdown-parser-gfm (1.1.0) 206 | kramdown (~> 2.0) 207 | liquid (4.0.4) 208 | listen (3.9.0) 209 | rb-fsevent (~> 0.10, >= 0.10.3) 210 | rb-inotify (~> 0.9, >= 0.9.10) 211 | mercenary (0.3.6) 212 | minima (2.5.1) 213 | jekyll (>= 3.5, < 5.0) 214 | jekyll-feed (~> 0.9) 215 | jekyll-seo-tag (~> 2.1) 216 | minitest (5.25.4) 217 | nokogiri (1.18.4-arm64-darwin) 218 | racc (~> 1.4) 219 | nokogiri (1.18.4-x86_64-darwin) 220 | racc (~> 1.4) 221 | nokogiri (1.18.4-x86_64-linux-gnu) 222 | racc (~> 1.4) 223 | octokit (4.25.1) 224 | faraday (>= 1, < 3) 225 | sawyer (~> 0.9) 226 | pathutil (0.16.2) 227 | forwardable-extended (~> 2.6) 228 | public_suffix (5.1.1) 229 | racc (1.8.1) 230 | rake (13.2.1) 231 | rb-fsevent (0.11.2) 232 | rb-inotify (0.11.1) 233 | ffi (~> 1.0) 234 | rexml (3.4.0) 235 | rouge (3.30.0) 236 | ruby2_keywords (0.0.5) 237 | rubyzip (2.4.1) 238 | safe_yaml (1.0.5) 239 | sass (3.7.4) 240 | sass-listen (~> 4.0.0) 241 | sass-listen (4.0.0) 242 | rb-fsevent (~> 0.9, >= 0.9.4) 243 | rb-inotify (~> 0.9, >= 0.9.7) 244 | sawyer (0.9.2) 245 | addressable (>= 2.3.5) 246 | faraday (>= 0.17.3, < 3) 247 | simpleidn (0.2.3) 248 | terminal-table (1.8.0) 249 | unicode-display_width (~> 1.1, >= 1.1.1) 250 | typhoeus (1.4.1) 251 | ethon (>= 0.9.0) 252 | tzinfo (2.0.6) 253 | concurrent-ruby (~> 1.0) 254 | unicode-display_width (1.8.0) 255 | zeitwerk (2.6.18) 256 | 257 | PLATFORMS 258 | universal-darwin-23 259 | x86_64-darwin-20 260 | x86_64-linux 261 | 262 | DEPENDENCIES 263 | github-pages 264 | jekyll-optional-front-matter 265 | jekyll-relative-links 266 | jekyll-titles-from-headings 267 | rake 268 | 269 | BUNDLED WITH 270 | 2.2.15 271 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | This is a template for the Jeykll site published to the gh-pages branch. 2 | -------------------------------------------------------------------------------- /docs/_config.yaml: -------------------------------------------------------------------------------- 1 | theme: minima 2 | title: "fabric-protos" 3 | header_pages: 4 | - protos.md 5 | 6 | defaults: 7 | - 8 | scope: 9 | path: "" 10 | type: "pages" 11 | values: 12 | layout: "page" 13 | 14 | optional_front_matter: 15 | remove_originals: true 16 | 17 | plugins: 18 | - jekyll-optional-front-matter 19 | - jekyll-titles-from-headings 20 | - jekyll-relative-links 21 | -------------------------------------------------------------------------------- /docs/_includes/footer.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-protos/d317f53d29e36628a1aa2b304c65c24d4fdc7791/docs/_includes/footer.html -------------------------------------------------------------------------------- /docs/_includes/header.html: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | --- 4 | 5 | Hyperledger Fabric Protocol buffers 6 | 7 | ## Download 8 | 9 | Pregenerated libraries are available for Go, Java, and Node.js 10 | 11 | The following versions are available: 12 | 13 | - `v0.1.x` versions are intended for Fabric 2.4 releases 14 | - `v0.2.x` versions are intended for Fabric 2.5 releases 15 | - `v0.3.x` versions are intended for Fabric 3.0 releases 16 | 17 | **Important:** Current releases are all in the unstable v0.x.x range. A v0 version makes **no stability or backward compatibility guarantees**. 18 | 19 | ### Go 20 | 21 | ``` 22 | go get -u github.com/hyperledger/fabric-protos-go-apiv2 23 | ``` 24 | 25 | ### Java 26 | 27 | ``` 28 | 29 | org.hyperledger.fabric 30 | fabric-protos 31 | ${fabricProtosVersion} 32 | 33 | ``` 34 | 35 | ### Node.js 36 | 37 | ``` 38 | npm install @hyperledger/fabric-protos 39 | ``` 40 | 41 | ## Documentation 42 | 43 | - [API](protos.md) 44 | - [Java library](https://search.maven.org/artifact/org.hyperledger.fabric/fabric-protos) 45 | - [Go module](https://pkg.go.dev/github.com/hyperledger/fabric-protos-go-apiv2) 46 | - [Node module](https://www.npmjs.com/package/@hyperledger/fabric-protos) 47 | -------------------------------------------------------------------------------- /gateway/gateway.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/gateway"; 8 | option java_multiple_files = true; 9 | option java_package = "org.hyperledger.fabric.protos.gateway"; 10 | option java_outer_classname = "GatewayProto"; 11 | 12 | package gateway; 13 | 14 | import "peer/chaincode_event.proto"; 15 | import "peer/proposal.proto"; 16 | import "peer/proposal_response.proto"; 17 | import "peer/transaction.proto"; 18 | import "common/common.proto"; 19 | import "orderer/ab.proto"; 20 | 21 | // The Gateway API for evaluating and submitting transactions via the gateway. 22 | // Transaction evaluation (query) requires the invocation of the Evaluate service 23 | // Transaction submission (ledger updates) is a two step process invoking Endorse 24 | // followed by Submit. A third step, invoking CommitStatus, is required if the 25 | // clients wish to wait for a Transaction to be committed. 26 | // The proposal and transaction must be signed by the client before each step. 27 | service Gateway { 28 | // The Endorse service passes a proposed transaction to the gateway in order to 29 | // obtain sufficient endorsement. 30 | // The gateway will determine the endorsement plan for the requested chaincode and 31 | // forward to the appropriate peers for endorsement. It will return to the client a 32 | // prepared transaction in the form of an Envelope message as defined 33 | // in common/common.proto. The client must sign the contents of this envelope 34 | // before invoking the Submit service. 35 | rpc Endorse(EndorseRequest) returns (EndorseResponse); 36 | 37 | // The Submit service will process the prepared transaction returned from Endorse service 38 | // once it has been signed by the client. It will wait for the transaction to be submitted to the 39 | // ordering service but the client must invoke the CommitStatus service to wait for the transaction 40 | // to be committed. 41 | rpc Submit(SubmitRequest) returns (SubmitResponse); 42 | 43 | // The CommitStatus service will indicate whether a prepared transaction previously submitted to 44 | // the Submit service has been committed. It will wait for the commit to occur if it hasn’t already 45 | // committed. 46 | rpc CommitStatus(SignedCommitStatusRequest) returns (CommitStatusResponse); 47 | 48 | // The Evaluate service passes a proposed transaction to the gateway in order to invoke the 49 | // transaction function and return the result to the client. No ledger updates are made. 50 | // The gateway will select an appropriate peer to query based on block height and load. 51 | rpc Evaluate(EvaluateRequest) returns (EvaluateResponse); 52 | 53 | // The ChaincodeEvents service supplies a stream of responses, each containing all the events emitted by the 54 | // requested chaincode for a specific block. The streamed responses are ordered by ascending block number. Responses 55 | // are only returned for blocks that contain the requested events, while blocks not containing any of the requested 56 | // events are skipped. 57 | rpc ChaincodeEvents(SignedChaincodeEventsRequest) returns (stream ChaincodeEventsResponse); 58 | } 59 | 60 | // EndorseRequest contains the details required to obtain sufficient endorsements for a 61 | // transaction to be committed to the ledger. 62 | message EndorseRequest { 63 | // The unique identifier for the transaction. 64 | string transaction_id = 1; 65 | // Identifier of the channel this request is bound for. 66 | string channel_id = 2; 67 | // The signed proposal ready for endorsement. 68 | protos.SignedProposal proposed_transaction = 3; 69 | // If targeting the peers of specific organizations (e.g. for private data scenarios), 70 | // the list of organizations' MSPIDs should be supplied here. 71 | repeated string endorsing_organizations = 4; 72 | } 73 | 74 | // EndorseResponse returns the result of endorsing a transaction. 75 | message EndorseResponse { 76 | // The unsigned set of transaction responses from the endorsing peers for signing by the client 77 | // before submitting to ordering service (via gateway). 78 | common.Envelope prepared_transaction = 1; 79 | } 80 | 81 | // SubmitRequest contains the details required to submit a transaction (update the ledger). 82 | message SubmitRequest { 83 | // Identifier of the transaction to submit. 84 | string transaction_id = 1; 85 | // Identifier of the channel this request is bound for. 86 | string channel_id = 2; 87 | // The signed set of endorsed transaction responses to submit. 88 | common.Envelope prepared_transaction = 3; 89 | } 90 | 91 | // SubmitResponse returns the result of submitting a transaction. 92 | message SubmitResponse { 93 | // Nothing yet 94 | } 95 | 96 | // SignedCommitStatusRequest contains a serialized CommitStatusRequest message, and a digital signature for the 97 | // serialized request message. 98 | message SignedCommitStatusRequest { 99 | // Serialized CommitStatusRequest message. 100 | bytes request = 1; 101 | // Signature for request message. 102 | bytes signature = 2; 103 | } 104 | 105 | // CommitStatusRequest contains the details required to check whether a transaction has been 106 | // successfully committed. 107 | message CommitStatusRequest { 108 | // Identifier of the transaction to check. 109 | string transaction_id = 1; 110 | // Identifier of the channel this request is bound for. 111 | string channel_id = 2; 112 | // Client requestor identity. 113 | bytes identity = 3; 114 | } 115 | 116 | // CommitStatusResponse returns the result of committing a transaction. 117 | message CommitStatusResponse { 118 | // The result of the transaction commit, as defined in peer/transaction.proto. 119 | protos.TxValidationCode result = 1; 120 | // Block number that contains the transaction. 121 | uint64 block_number = 2; 122 | } 123 | 124 | // EvaluateRequest contains the details required to evaluate a transaction (query the ledger). 125 | message EvaluateRequest { 126 | // Identifier of the transaction to evaluate. 127 | string transaction_id = 1; 128 | // Identifier of the channel this request is bound for. 129 | string channel_id = 2; 130 | // The signed proposal ready for evaluation. 131 | protos.SignedProposal proposed_transaction = 3; 132 | // If targeting the peers of specific organizations (e.g. for private data scenarios), 133 | // the list of organizations' MSPIDs should be supplied here. 134 | repeated string target_organizations = 4; 135 | } 136 | 137 | // EvaluateResponse returns the result of evaluating a transaction. 138 | message EvaluateResponse { 139 | // The response that is returned by the transaction function, as defined 140 | // in peer/proposal_response.proto. 141 | protos.Response result = 1; 142 | } 143 | 144 | // SignedChaincodeEventsRequest contains a serialized ChaincodeEventsRequest message, and a digital signature for the 145 | // serialized request message. 146 | message SignedChaincodeEventsRequest { 147 | // Serialized ChaincodeEventsRequest message. 148 | bytes request = 1; 149 | // Signature for request message. 150 | bytes signature = 2; 151 | } 152 | 153 | // ChaincodeEventsRequest contains details of the chaincode events that the caller wants to receive. 154 | message ChaincodeEventsRequest { 155 | // Identifier of the channel this request is bound for. 156 | string channel_id = 1; 157 | // Name of the chaincode for which events are requested. 158 | string chaincode_id = 2; 159 | // Client requestor identity. 160 | bytes identity = 3; 161 | // Position within the ledger at which to start reading events. 162 | orderer.SeekPosition start_position = 4; 163 | // Only returns events after this transaction ID. Transactions up to and including this one should be ignored. This 164 | // is used to allow resume of event listening from a certain position within a start block specified by 165 | // start_position. 166 | string after_transaction_id = 5; 167 | } 168 | 169 | // ChaincodeEventsResponse returns chaincode events emitted from a specific block. 170 | message ChaincodeEventsResponse { 171 | // Chaincode events emitted by the requested chaincode. The events are presented in the same order that the 172 | // transactions that emitted them appear within the block. 173 | repeated protos.ChaincodeEvent events = 1; 174 | // Block number in which the chaincode events were emitted. 175 | uint64 block_number = 2; 176 | } 177 | 178 | // If any of the functions in the Gateway service returns an error, then it will be in the format of 179 | // a google.rpc.Status message. The 'details' field of this message will be populated with extra 180 | // information if the error is a result of one or more failed requests to remote peers or orderer nodes. 181 | // ErrorDetail contains details of errors that are received by any of the endorsing peers 182 | // as a result of processing the Evaluate or Endorse services, or from the ordering node(s) as a result of 183 | // processing the Submit service. 184 | message ErrorDetail { 185 | // The address of the endorsing peer or ordering node that returned an error. 186 | string address = 1; 187 | // The MSP Identifier of this node. 188 | string msp_id = 2; 189 | // The error message returned by this node. 190 | string message = 3; 191 | } 192 | 193 | // ProposedTransaction contains the details required for offline signing prior to evaluating or endorsing 194 | // a transaction. 195 | message ProposedTransaction { 196 | // Identifier of the proposed transaction. 197 | string transaction_id = 1; 198 | // The signed proposal. 199 | protos.SignedProposal proposal = 2; 200 | // The list of endorsing organizations. 201 | repeated string endorsing_organizations = 3; 202 | } 203 | 204 | // PreparedTransaction contains the details required for offline signing prior to submitting a transaction. 205 | message PreparedTransaction { 206 | // Identifier of the prepared transaction. 207 | string transaction_id = 1; 208 | // The transaction envelope. 209 | common.Envelope envelope = 2; 210 | } 211 | -------------------------------------------------------------------------------- /ledger/queryresult/kv_query_result.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | package queryresult; 8 | 9 | option go_package = "github.com/hyperledger/fabric-protos-go/ledger/queryresult"; 10 | option java_package = "org.hyperledger.fabric.protos.ledger.queryresult"; 11 | 12 | import "google/protobuf/timestamp.proto"; 13 | 14 | 15 | // KV -- QueryResult for range/execute query. Holds a key and corresponding value. 16 | message KV { 17 | string namespace = 1; 18 | string key = 2; 19 | bytes value = 3; 20 | } 21 | 22 | // KeyModification -- QueryResult for history query. Holds a transaction ID, value, 23 | // timestamp, and delete marker which resulted from a history query. 24 | message KeyModification { 25 | string tx_id = 1; 26 | bytes value = 2; 27 | google.protobuf.Timestamp timestamp = 3; 28 | bool is_delete = 4; 29 | } 30 | -------------------------------------------------------------------------------- /ledger/rwset/kvrwset/kv_rwset.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/ledger/rwset/kvrwset"; 8 | option java_package = "org.hyperledger.fabric.protos.ledger.rwset.kvrwset"; 9 | 10 | package kvrwset; 11 | 12 | // KVRWSet encapsulates the read-write set for a chaincode that operates upon a KV or Document data model 13 | // This structure is used for both the public data and the private data 14 | message KVRWSet { 15 | repeated KVRead reads = 1; 16 | repeated RangeQueryInfo range_queries_info = 2; 17 | repeated KVWrite writes = 3; 18 | repeated KVMetadataWrite metadata_writes = 4; 19 | } 20 | 21 | // HashedRWSet encapsulates hashed representation of a private read-write set for KV or Document data model 22 | message HashedRWSet { 23 | repeated KVReadHash hashed_reads = 1; 24 | repeated KVWriteHash hashed_writes = 2; 25 | repeated KVMetadataWriteHash metadata_writes = 3; 26 | } 27 | 28 | // KVRead captures a read operation performed during transaction simulation 29 | // A 'nil' version indicates a non-existing key read by the transaction 30 | message KVRead { 31 | string key = 1; 32 | Version version = 2; 33 | } 34 | 35 | // KVWrite captures a write (update/delete) operation performed during transaction simulation 36 | message KVWrite { 37 | string key = 1; 38 | bool is_delete = 2; 39 | bytes value = 3; 40 | } 41 | 42 | // KVMetadataWrite captures all the entries in the metadata associated with a key 43 | message KVMetadataWrite { 44 | string key = 1; 45 | repeated KVMetadataEntry entries = 2; 46 | } 47 | 48 | // KVReadHash is similar to the KVRead in spirit. However, it captures the hash of the key instead of the key itself 49 | // version is kept as is for now. However, if the version also needs to be privacy-protected, it would need to be the 50 | // hash of the version and hence of 'bytes' type 51 | message KVReadHash { 52 | bytes key_hash = 1; 53 | Version version = 2; 54 | } 55 | 56 | // KVWriteHash is similar to the KVWrite. It captures a write (update/delete) operation performed during transaction simulation 57 | message KVWriteHash { 58 | bytes key_hash = 1; 59 | bool is_delete = 2; 60 | bytes value_hash = 3; 61 | bool is_purge = 4; 62 | } 63 | 64 | // KVMetadataWriteHash captures all the upserts to the metadata associated with a key hash 65 | message KVMetadataWriteHash { 66 | bytes key_hash = 1; 67 | repeated KVMetadataEntry entries = 2; 68 | } 69 | 70 | // KVMetadataEntry captures a 'name'ed entry in the metadata of a key/key-hash. 71 | message KVMetadataEntry { 72 | string name = 1; 73 | bytes value = 2; 74 | } 75 | 76 | // Version encapsulates the version of a Key 77 | // A version of a committed key is maintained as the height of the transaction that committed the key. 78 | // The height is represenetd as a tuple where the txNum is the position of the transaction 79 | // (starting with 0) within block 80 | message Version { 81 | uint64 block_num = 1; 82 | uint64 tx_num = 2; 83 | } 84 | 85 | // RangeQueryInfo encapsulates the details of a range query performed by a transaction during simulation. 86 | // This helps protect transactions from phantom reads by varifying during validation whether any new items 87 | // got committed within the given range between transaction simuation and validation 88 | // (in addition to regular checks for updates/deletes of the existing items). 89 | // readInfo field contains either the KVReads (for the items read by the range query) or a merkle-tree hash 90 | // if the KVReads exceeds a pre-configured numbers 91 | message RangeQueryInfo { 92 | string start_key = 1; 93 | string end_key = 2; 94 | bool itr_exhausted = 3; 95 | oneof reads_info { 96 | QueryReads raw_reads = 4; 97 | QueryReadsMerkleSummary reads_merkle_hashes = 5; 98 | } 99 | } 100 | 101 | // QueryReads encapsulates the KVReads for the items read by a transaction as a result of a query execution 102 | message QueryReads { 103 | repeated KVRead kv_reads = 1; 104 | } 105 | 106 | // QueryReadsMerkleSummary encapsulates the Merkle-tree hashes for the QueryReads 107 | // This allows to reduce the size of RWSet in the presence of query results 108 | // by storing certain hashes instead of actual results. 109 | // maxDegree field refers to the maximum number of children in the tree at any level 110 | // maxLevel field contains the lowest level which has lesser nodes than maxDegree (starting from leaf level) 111 | message QueryReadsMerkleSummary { 112 | uint32 max_degree = 1; 113 | uint32 max_level = 2; 114 | repeated bytes max_level_hashes = 3; 115 | } 116 | -------------------------------------------------------------------------------- /ledger/rwset/rwset.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/ledger/rwset"; 8 | option java_package = "org.hyperledger.fabric.protos.ledger.rwset"; 9 | 10 | package rwset; 11 | 12 | // TxReadWriteSet encapsulates a read-write set for a transaction 13 | // DataModel specifies the enum value of the data model 14 | // ns_rwset field specifies a list of chaincode specific read-write set (one for each chaincode) 15 | message TxReadWriteSet { 16 | enum DataModel { 17 | KV = 0; 18 | } 19 | DataModel data_model = 1; 20 | repeated NsReadWriteSet ns_rwset = 2; 21 | } 22 | 23 | // NsReadWriteSet encapsulates the read-write set for a chaincode 24 | message NsReadWriteSet { 25 | string namespace = 1; 26 | bytes rwset = 2; // Data model specific serialized proto message (e.g., kvrwset.KVRWSet for KV and Document data models) 27 | repeated CollectionHashedReadWriteSet collection_hashed_rwset = 3; 28 | } 29 | 30 | // CollectionHashedReadWriteSet encapsulate the hashed representation for the private read-write set for a collection 31 | message CollectionHashedReadWriteSet { 32 | string collection_name = 1; 33 | bytes hashed_rwset = 2; // Data model specific serialized proto message (e.g., kvrwset.HashedRWSet for KV and Document data models) 34 | bytes pvt_rwset_hash = 3; // Hash of entire private read-write set for a specific collection. This helps in authenticating the private read-write set efficiently 35 | } 36 | 37 | // TxPvtReadWriteSet encapsulate the private read-write set for a transaction 38 | message TxPvtReadWriteSet { 39 | TxReadWriteSet.DataModel data_model = 1; 40 | repeated NsPvtReadWriteSet ns_pvt_rwset = 2; 41 | } 42 | 43 | // NsPvtReadWriteSet encapsulates the private read-write set for a chaincode 44 | message NsPvtReadWriteSet { 45 | string namespace = 1; 46 | repeated CollectionPvtReadWriteSet collection_pvt_rwset = 2; 47 | } 48 | 49 | // CollectionPvtReadWriteSet encapsulates the private read-write set for a collection 50 | message CollectionPvtReadWriteSet { 51 | string collection_name = 1; 52 | bytes rwset = 2; // Data model specific serialized proto message (e.g., kvrwset.KVRWSet for KV and Document data models) 53 | } 54 | -------------------------------------------------------------------------------- /msp/identities.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/msp"; 8 | option java_package = "org.hyperledger.fabric.protos.msp"; 9 | 10 | package msp; 11 | 12 | // This struct represents an Identity 13 | // (with its MSP identifier) to be used 14 | // to serialize it and deserialize it 15 | message SerializedIdentity { 16 | // The identifier of the associated membership service provider 17 | string mspid = 1; 18 | 19 | // the Identity, serialized according to the rules of its MPS 20 | bytes id_bytes = 2; 21 | } 22 | 23 | // This struct represents an Idemix Identity 24 | // to be used to serialize it and deserialize it. 25 | // The IdemixMSP will first serialize an idemix identity to bytes using 26 | // this proto, and then uses these bytes as id_bytes in SerializedIdentity 27 | message SerializedIdemixIdentity { 28 | // nym_x is the X-component of the pseudonym elliptic curve point. 29 | // It is a []byte representation of an amcl.BIG 30 | // The pseudonym can be seen as a public key of the identity, it is used to verify signatures. 31 | bytes nym_x = 1; 32 | 33 | // nym_y is the Y-component of the pseudonym elliptic curve point. 34 | // It is a []byte representation of an amcl.BIG 35 | // The pseudonym can be seen as a public key of the identity, it is used to verify signatures. 36 | bytes nym_y = 2; 37 | 38 | // ou contains the organizational unit of the idemix identity 39 | bytes ou = 3; 40 | 41 | // role contains the role of this identity (e.g., ADMIN or MEMBER) 42 | bytes role = 4; 43 | 44 | // proof contains the cryptographic evidence that this identity is valid 45 | bytes proof = 5; 46 | } 47 | -------------------------------------------------------------------------------- /msp/msp_config.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/msp"; 8 | option java_package = "org.hyperledger.fabric.protos.msp"; 9 | option java_outer_classname = "MspConfigPackage"; 10 | 11 | package msp; 12 | 13 | // MSPConfig collects all the configuration information for 14 | // an MSP. The Config field should be unmarshalled in a way 15 | // that depends on the Type 16 | message MSPConfig { 17 | // Type holds the type of the MSP; the default one would 18 | // be of type FABRIC implementing an X.509 based provider 19 | int32 type = 1; 20 | 21 | // Config is MSP dependent configuration info 22 | bytes config = 2; 23 | } 24 | 25 | // FabricMSPConfig collects all the configuration information for 26 | // a Fabric MSP. 27 | // Here we assume a default certificate validation policy, where 28 | // any certificate signed by any of the listed rootCA certs would 29 | // be considered as valid under this MSP. 30 | // This MSP may or may not come with a signing identity. If it does, 31 | // it can also issue signing identities. If it does not, it can only 32 | // be used to validate and verify certificates. 33 | message FabricMSPConfig { 34 | // Name holds the identifier of the MSP; MSP identifier 35 | // is chosen by the application that governs this MSP. 36 | // For example, and assuming the default implementation of MSP, 37 | // that is X.509-based and considers a single Issuer, 38 | // this can refer to the Subject OU field or the Issuer OU field. 39 | string name = 1; 40 | 41 | // List of root certificates trusted by this MSP 42 | // they are used upon certificate validation (see 43 | // comment for IntermediateCerts below) 44 | repeated bytes root_certs = 2; 45 | 46 | // List of intermediate certificates trusted by this MSP; 47 | // they are used upon certificate validation as follows: 48 | // validation attempts to build a path from the certificate 49 | // to be validated (which is at one end of the path) and 50 | // one of the certs in the RootCerts field (which is at 51 | // the other end of the path). If the path is longer than 52 | // 2, certificates in the middle are searched within the 53 | // IntermediateCerts pool 54 | repeated bytes intermediate_certs = 3; 55 | 56 | // Identity denoting the administrator of this MSP 57 | repeated bytes admins = 4; 58 | 59 | // Identity revocation list 60 | repeated bytes revocation_list = 5; 61 | 62 | // SigningIdentity holds information on the signing identity 63 | // this peer is to use, and which is to be imported by the 64 | // MSP defined before 65 | SigningIdentityInfo signing_identity = 6; 66 | 67 | // OrganizationalUnitIdentifiers holds one or more 68 | // fabric organizational unit identifiers that belong to 69 | // this MSP configuration 70 | repeated FabricOUIdentifier organizational_unit_identifiers = 7; 71 | 72 | // FabricCryptoConfig contains the configuration parameters 73 | // for the cryptographic algorithms used by this MSP 74 | FabricCryptoConfig crypto_config = 8; 75 | 76 | // List of TLS root certificates trusted by this MSP. 77 | // They are returned by GetTLSRootCerts. 78 | repeated bytes tls_root_certs = 9; 79 | 80 | // List of TLS intermediate certificates trusted by this MSP; 81 | // They are returned by GetTLSIntermediateCerts. 82 | repeated bytes tls_intermediate_certs = 10; 83 | 84 | // fabric_node_ous contains the configuration to distinguish clients from peers from orderers 85 | // based on the OUs. 86 | FabricNodeOUs fabric_node_ous = 11; 87 | } 88 | 89 | // FabricCryptoConfig contains configuration parameters 90 | // for the cryptographic algorithms used by the MSP 91 | // this configuration refers to 92 | message FabricCryptoConfig { 93 | 94 | // SignatureHashFamily is a string representing the hash family to be used 95 | // during sign and verify operations. 96 | // Allowed values are "SHA2" and "SHA3". 97 | string signature_hash_family = 1; 98 | 99 | // IdentityIdentifierHashFunction is a string representing the hash function 100 | // to be used during the computation of the identity identifier of an MSP identity. 101 | // Allowed values are "SHA256", "SHA384" and "SHA3_256", "SHA3_384". 102 | string identity_identifier_hash_function = 2; 103 | 104 | } 105 | 106 | // IdemixMSPConfig collects all the configuration information for 107 | // an Idemix MSP. 108 | message IdemixMSPConfig { 109 | // Name holds the identifier of the MSP 110 | string name = 1; 111 | 112 | // ipk represents the (serialized) issuer public key 113 | bytes ipk = 2; 114 | 115 | // signer may contain crypto material to configure a default signer 116 | IdemixMSPSignerConfig signer = 3; 117 | 118 | // revocation_pk is the public key used for revocation of credentials 119 | bytes revocation_pk = 4; 120 | 121 | // epoch represents the current epoch (time interval) used for revocation 122 | int64 epoch = 5; 123 | } 124 | 125 | // IdemixMSPSIgnerConfig contains the crypto material to set up an idemix signing identity 126 | message IdemixMSPSignerConfig { 127 | // cred represents the serialized idemix credential of the default signer 128 | bytes cred = 1; 129 | 130 | // sk is the secret key of the default signer, corresponding to credential Cred 131 | bytes sk = 2; 132 | 133 | // organizational_unit_identifier defines the organizational unit the default signer is in 134 | string organizational_unit_identifier = 3; 135 | 136 | // role defines whether the default signer is admin, peer, member or client 137 | int32 role = 4; 138 | 139 | // enrollment_id contains the enrollment id of this signer 140 | string enrollment_id = 5; 141 | 142 | // credential_revocation_information contains a serialized CredentialRevocationInformation 143 | bytes credential_revocation_information = 6; 144 | } 145 | 146 | // SigningIdentityInfo represents the configuration information 147 | // related to the signing identity the peer is to use for generating 148 | // endorsements 149 | message SigningIdentityInfo { 150 | // PublicSigner carries the public information of the signing 151 | // identity. For an X.509 provider this would be represented by 152 | // an X.509 certificate 153 | bytes public_signer = 1; 154 | 155 | // PrivateSigner denotes a reference to the private key of the 156 | // peer's signing identity 157 | KeyInfo private_signer = 2; 158 | } 159 | 160 | // KeyInfo represents a (secret) key that is either already stored 161 | // in the bccsp/keystore or key material to be imported to the 162 | // bccsp key-store. In later versions it may contain also a 163 | // keystore identifier 164 | message KeyInfo { 165 | // Identifier of the key inside the default keystore; this for 166 | // the case of Software BCCSP as well as the HSM BCCSP would be 167 | // the SKI of the key 168 | string key_identifier = 1; 169 | 170 | // KeyMaterial (optional) for the key to be imported; this is 171 | // properly encoded key bytes, prefixed by the type of the key 172 | bytes key_material = 2; 173 | } 174 | 175 | // FabricOUIdentifier represents an organizational unit and 176 | // its related chain of trust identifier. 177 | message FabricOUIdentifier { 178 | 179 | // Certificate represents the second certificate in a certification chain. 180 | // (Notice that the first certificate in a certification chain is supposed 181 | // to be the certificate of an identity). 182 | // It must correspond to the certificate of root or intermediate CA 183 | // recognized by the MSP this message belongs to. 184 | // Starting from this certificate, a certification chain is computed 185 | // and bound to the OrganizationUnitIdentifier specified 186 | bytes certificate = 1; 187 | 188 | // OrganizationUnitIdentifier defines the organizational unit under the 189 | // MSP identified with MSPIdentifier 190 | string organizational_unit_identifier = 2; 191 | } 192 | 193 | // FabricNodeOUs contains configuration to tell apart clients from peers from orderers 194 | // based on OUs. If NodeOUs recognition is enabled then an msp identity 195 | // that does not contain any of the specified OU will be considered invalid. 196 | message FabricNodeOUs { 197 | // If true then an msp identity that does not contain any of the specified OU will be considered invalid. 198 | bool enable = 1; 199 | 200 | // OU Identifier of the clients 201 | FabricOUIdentifier client_ou_identifier = 2; 202 | 203 | // OU Identifier of the peers 204 | FabricOUIdentifier peer_ou_identifier = 3; 205 | 206 | // OU Identifier of the admins 207 | FabricOUIdentifier admin_ou_identifier = 4; 208 | 209 | // OU Identifier of the orderers 210 | FabricOUIdentifier orderer_ou_identifier = 5; 211 | } 212 | -------------------------------------------------------------------------------- /msp/msp_principal.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/msp"; 8 | option java_package = "org.hyperledger.fabric.protos.common"; 9 | 10 | package common; 11 | 12 | // msp_principal.proto contains proto messages defining the generalized 13 | // MSP notion of identity called an MSPPrincipal. It is used as part of 14 | // the chain configuration, in particular as the identity parameters to 15 | // the configuration.proto file. This does not represent the MSP 16 | // configuration for a chain, but is understood by MSPs 17 | 18 | // MSPPrincipal aims to represent an MSP-centric set of identities. 19 | // In particular, this structure allows for definition of 20 | // - a group of identities that are member of the same MSP 21 | // - a group of identities that are member of the same organization unit 22 | // in the same MSP 23 | // - a group of identities that are administering a specific MSP 24 | // - a specific identity 25 | // Expressing these groups is done given two fields of the fields below 26 | // - Classification, that defines the type of classification of identities 27 | // in an MSP this principal would be defined on; Classification can take 28 | // three values: 29 | // (i) ByMSPRole: that represents a classification of identities within 30 | // MSP based on one of the two pre-defined MSP rules, "member" and "admin" 31 | // (ii) ByOrganizationUnit: that represents a classification of identities 32 | // within MSP based on the organization unit an identity belongs to 33 | // (iii)ByIdentity that denotes that MSPPrincipal is mapped to a single 34 | // identity/certificate; this would mean that the Principal bytes 35 | // message 36 | message MSPPrincipal { 37 | enum Classification { 38 | ROLE = 0; // Represents the one of the dedicated MSP roles, the 39 | // one of a member of MSP network, and the one of an 40 | // administrator of an MSP network 41 | ORGANIZATION_UNIT = 1; // Denotes a finer grained (affiliation-based) 42 | // groupping of entities, per MSP affiliation 43 | // E.g., this can well be represented by an MSP's 44 | // Organization unit 45 | IDENTITY = 2; // Denotes a principal that consists of a single 46 | // identity 47 | ANONYMITY = 3; // Denotes a principal that can be used to enforce 48 | // an identity to be anonymous or nominal. 49 | COMBINED = 4; // Denotes a combined principal 50 | } 51 | 52 | // Classification describes the way that one should process 53 | // Principal. An Classification value of "ByOrganizationUnit" reflects 54 | // that "Principal" contains the name of an organization this MSP 55 | // handles. A Classification value "ByIdentity" means that 56 | // "Principal" contains a specific identity. Default value 57 | // denotes that Principal contains one of the groups by 58 | // default supported by all MSPs ("admin" or "member"). 59 | Classification principal_classification = 1; 60 | 61 | // Principal completes the policy principal definition. For the default 62 | // principal types, Principal can be either "Admin" or "Member". 63 | // For the ByOrganizationUnit/ByIdentity values of Classification, 64 | // PolicyPrincipal acquires its value from an organization unit or 65 | // identity, respectively. 66 | // For the Combined Classification type, the Principal is a marshalled 67 | // CombinedPrincipal. 68 | bytes principal = 2; 69 | } 70 | 71 | 72 | // OrganizationUnit governs the organization of the Principal 73 | // field of a policy principal when a specific organization unity members 74 | // are to be defined within a policy principal. 75 | message OrganizationUnit { 76 | 77 | // MSPIdentifier represents the identifier of the MSP this organization unit 78 | // refers to 79 | string msp_identifier = 1; 80 | 81 | // OrganizationUnitIdentifier defines the organizational unit under the 82 | // MSP identified with MSPIdentifier 83 | string organizational_unit_identifier = 2; 84 | 85 | // CertifiersIdentifier is the hash of certificates chain of trust 86 | // related to this organizational unit 87 | bytes certifiers_identifier = 3; 88 | } 89 | 90 | // MSPRole governs the organization of the Principal 91 | // field of an MSPPrincipal when it aims to define one of the 92 | // two dedicated roles within an MSP: Admin and Members. 93 | message MSPRole { 94 | // MSPIdentifier represents the identifier of the MSP this principal 95 | // refers to 96 | string msp_identifier = 1; 97 | 98 | enum MSPRoleType { 99 | MEMBER = 0; // Represents an MSP Member 100 | ADMIN = 1; // Represents an MSP Admin 101 | CLIENT = 2; // Represents an MSP Client 102 | PEER = 3; // Represents an MSP Peer 103 | ORDERER = 4; // Represents an MSP Orderer 104 | } 105 | 106 | // MSPRoleType defines which of the available, pre-defined MSP-roles 107 | // an identiy should posess inside the MSP with identifier MSPidentifier 108 | MSPRoleType role = 2; 109 | } 110 | 111 | // MSPIdentityAnonymity can be used to enforce an identity to be anonymous or nominal. 112 | message MSPIdentityAnonymity { 113 | enum MSPIdentityAnonymityType { 114 | NOMINAL = 0; // Represents a nominal MSP Identity 115 | ANONYMOUS = 1; // Represents an anonymous MSP Identity 116 | } 117 | 118 | MSPIdentityAnonymityType anonymity_type = 1; 119 | } 120 | 121 | // CombinedPrincipal governs the organization of the Principal 122 | // field of a policy principal when principal_classification has 123 | // indicated that a combined form of principals is required 124 | message CombinedPrincipal { 125 | // Principals refer to combined principals 126 | repeated MSPPrincipal principals = 1; 127 | } 128 | 129 | // TODO: Bring msp.SerializedIdentity from fabric/msp/identities.proto here. Reason below. 130 | // SerializedIdentity represents an serialized version of an identity; 131 | // this consists of an MSP-identifier this identity would correspond to 132 | // and the bytes of the actual identity. A serialized form of 133 | // SerializedIdentity would govern "Principal" field of a PolicyPrincipal 134 | // of classification "ByIdentity". 135 | -------------------------------------------------------------------------------- /orderer/ab.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/orderer"; 8 | option java_package = "org.hyperledger.fabric.protos.orderer"; 9 | 10 | package orderer; 11 | 12 | import "common/common.proto"; 13 | 14 | message BroadcastResponse { 15 | // Status code, which may be used to programatically respond to success/failure 16 | common.Status status = 1; 17 | // Info string which may contain additional information about the status returned 18 | string info = 2; 19 | } 20 | 21 | message SeekNewest { } 22 | 23 | message SeekOldest { } 24 | 25 | message SeekSpecified { 26 | uint64 number = 1; 27 | } 28 | 29 | // SeekNextCommit refers to the next block that will be committed 30 | message SeekNextCommit { } 31 | 32 | message SeekPosition { 33 | oneof Type { 34 | SeekNewest newest = 1; 35 | SeekOldest oldest = 2; 36 | SeekSpecified specified = 3; 37 | SeekNextCommit next_commit = 4; 38 | } 39 | } 40 | 41 | // SeekInfo specifies the range of requested blocks to return 42 | // If the start position is not found, an error is immediately returned 43 | // Otherwise, blocks are returned until a missing block is encountered, then behavior is dictated 44 | // by the SeekBehavior specified. 45 | message SeekInfo { 46 | // If BLOCK_UNTIL_READY is specified, the reply will block until the requested blocks are available, 47 | // if FAIL_IF_NOT_READY is specified, the reply will return an error indicating that the block is not 48 | // found. To request that all blocks be returned indefinitely as they are created, behavior should be 49 | // set to BLOCK_UNTIL_READY and the stop should be set to specified with a number of MAX_UINT64 50 | enum SeekBehavior { 51 | BLOCK_UNTIL_READY = 0; 52 | FAIL_IF_NOT_READY = 1; 53 | } 54 | 55 | // SeekErrorTolerance indicates to the server how block provider errors should be tolerated. By default, 56 | // if the deliver service detects a problem in the underlying block source (typically, in the orderer, 57 | // a consenter error), it will begin to reject deliver requests. This is to prevent a client from waiting 58 | // for blocks from an orderer which is stuck in an errored state. This is almost always the desired behavior 59 | // and clients should stick with the default STRICT checking behavior. However, in some scenarios, particularly 60 | // when attempting to recover from a crash or other corruption, it's desirable to force an orderer to respond 61 | // with blocks on a best effort basis, even if the backing consensus implementation is in an errored state. 62 | // In this case, set the SeekErrorResponse to BEST_EFFORT to ignore the consenter errors. 63 | enum SeekErrorResponse { 64 | STRICT = 0; 65 | BEST_EFFORT = 1; 66 | } 67 | 68 | // SeekContentType indicates what type of content to deliver in response to a request. If BLOCK is specified, 69 | // the orderer will stream blocks back to the peer. This is the default behavior. If HEADER_WITH_SIG is specified, the 70 | // orderer will stream only a the header and the signature, and the payload field will be set to nil. This allows 71 | // the requester to ascertain that the respective signed block exists in the orderer (or cluster of orderers). 72 | enum SeekContentType { 73 | BLOCK = 0; 74 | HEADER_WITH_SIG =1; 75 | } 76 | 77 | SeekPosition start = 1; // The position to start the deliver from 78 | SeekPosition stop = 2; // The position to stop the deliver 79 | SeekBehavior behavior = 3; // The behavior when a missing block is encountered 80 | SeekErrorResponse error_response = 4; // How to respond to errors reported to the deliver service 81 | SeekContentType content_type = 5; // Defines what type of content to deliver in response to a request 82 | } 83 | 84 | message DeliverResponse { 85 | oneof Type { 86 | common.Status status = 1; 87 | common.Block block = 2; 88 | } 89 | } 90 | 91 | service AtomicBroadcast { 92 | // broadcast receives a reply of Acknowledgement for each common.Envelope in order, indicating success or type of failure 93 | rpc Broadcast(stream common.Envelope) returns (stream BroadcastResponse); 94 | 95 | // deliver first requires an Envelope of type DELIVER_SEEK_INFO with Payload data as a mashaled SeekInfo message, then a stream of block replies is received. 96 | rpc Deliver(stream common.Envelope) returns (stream DeliverResponse); 97 | } 98 | -------------------------------------------------------------------------------- /orderer/cluster.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/orderer"; 8 | option java_package = "org.hyperledger.fabric.protos.orderer"; 9 | 10 | package orderer; 11 | 12 | import "common/common.proto"; 13 | 14 | // Cluster defines communication between cluster members. 15 | service Cluster { 16 | // Step passes an implementation-specific message to another cluster member. 17 | rpc Step(stream StepRequest) returns (stream StepResponse); 18 | } 19 | 20 | // StepRequest wraps a message that is sent to a cluster member. 21 | message StepRequest { 22 | oneof payload { 23 | // consensus_request is a consensus specific message. 24 | ConsensusRequest consensus_request = 1; 25 | // submit_request is a relay of a transaction. 26 | SubmitRequest submit_request = 2; 27 | } 28 | } 29 | 30 | // StepResponse is a message received from a cluster member. 31 | message StepResponse { 32 | oneof payload { 33 | SubmitResponse submit_res = 1; 34 | } 35 | } 36 | 37 | // ConsensusRequest is a consensus specific message sent to a cluster member. 38 | message ConsensusRequest { 39 | string channel = 1; 40 | bytes payload = 2; 41 | bytes metadata = 3; 42 | } 43 | 44 | // SubmitRequest wraps a transaction to be sent for ordering. 45 | message SubmitRequest { 46 | string channel = 1; 47 | // last_validation_seq denotes the last 48 | // configuration sequence at which the 49 | // sender validated this message. 50 | uint64 last_validation_seq = 2; 51 | // content is the fabric transaction 52 | // that is forwarded to the cluster member. 53 | common.Envelope payload = 3; 54 | } 55 | 56 | // SubmitResponse returns a success 57 | // or failure status to the sender. 58 | message SubmitResponse { 59 | string channel = 1; 60 | // Status code, which may be used to programatically respond to success/failure. 61 | common.Status status = 2; 62 | // Info string which may contain additional information about the returned status. 63 | string info = 3; 64 | } 65 | -------------------------------------------------------------------------------- /orderer/clusterserver.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/orderer"; 8 | option java_package = "org.hyperledger.fabric.protos.orderer"; 9 | 10 | package orderer; 11 | 12 | import "common/common.proto"; 13 | import "google/protobuf/timestamp.proto"; 14 | 15 | // Service ClusterNodeService defines communication between cluster members. 16 | service ClusterNodeService { 17 | // Step passes an implementation-specific message to another cluster member. 18 | rpc Step(stream ClusterNodeServiceStepRequest) returns (stream ClusterNodeServiceStepResponse); 19 | } 20 | 21 | // ClusterNodeServiceStepRequest wraps a message that is sent to a cluster member. 22 | message ClusterNodeServiceStepRequest { 23 | oneof payload { 24 | // node_conrequest is a consensus specific message between the cluster memebers. 25 | NodeConsensusRequest node_conrequest = 1; 26 | // node_tranrequest is a relay of a transaction. 27 | NodeTransactionOrderRequest node_tranrequest = 2; 28 | // Auth authentiates the member that initiated the stream 29 | NodeAuthRequest node_authrequest = 3; 30 | } 31 | } 32 | 33 | // ClusterNodeServiceStepResponse is a message received from a cluster member. 34 | message ClusterNodeServiceStepResponse { 35 | oneof payload { 36 | TransactionOrderResponse tranorder_res = 1; 37 | } 38 | } 39 | 40 | // NodeConsensusRequest is a consensus specific message sent to a cluster member. 41 | message NodeConsensusRequest { 42 | bytes payload = 1; 43 | bytes metadata = 2; 44 | } 45 | 46 | // NodeTransactionOrderRequest wraps a transaction to be sent for ordering. 47 | message NodeTransactionOrderRequest { 48 | // last_validation_seq denotes the last configuration sequence at which the 49 | // sender validated this message. 50 | uint64 last_validation_seq = 1; 51 | // content is the fabric transaction 52 | // that is forwarded to the cluster member. 53 | common.Envelope payload = 2; 54 | } 55 | 56 | // TransactionOrderResponse returns a success 57 | // or failure status to the sender. 58 | message TransactionOrderResponse { 59 | string channel = 1; 60 | string tx_id = 2; 61 | // Status code, which may be used to programatically respond to success/failure. 62 | common.Status status = 3; 63 | // Info string which may contain additional information about the returned status. 64 | string info = 4; 65 | } 66 | 67 | // NodeAuthRequest for authenticate the stream 68 | // between the cluster members 69 | message NodeAuthRequest { 70 | // version represents the fields on which the signature is computed 71 | uint32 version = 1; 72 | // signature is verifiable using the initiator's public key 73 | bytes signature = 2; 74 | // timestamp indicates the freshness of the request; expected to be within the margin 75 | // of the responsder's local time 76 | google.protobuf.Timestamp timestamp = 3; 77 | // from_id is the numerical identifier of the initiator of the connection 78 | uint64 from_id = 4; 79 | // to_id is the numerical identifier of the node that is being connected to 80 | uint64 to_id = 5; 81 | // session_binding is verifiable using application level protocol 82 | bytes session_binding = 6; 83 | string channel = 7; 84 | } -------------------------------------------------------------------------------- /orderer/configuration.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/orderer"; 8 | option java_package = "org.hyperledger.fabric.protos.orderer"; 9 | 10 | package orderer; 11 | 12 | // The orderer config is specified by the following convention: 13 | // For a configuration item with key "Key" 14 | // the encoded value is a a proto message of type "Key" 15 | // For example, for the configuration item of name "ConsensusType" 16 | // the encoded value is the proto message "ConsensusType" 17 | 18 | message ConsensusType { 19 | // The consensus type: "solo" or "etcdraft". 20 | string type = 1; 21 | // Opaque metadata, dependent on the consensus type. 22 | bytes metadata = 2; 23 | 24 | // State defines the orderer mode of operation, typically for consensus-type migration. 25 | // NORMAL is during normal operation, when consensus-type migration is not, and can not, take place. 26 | // MAINTENANCE is when the consensus-type can be changed. 27 | enum State { 28 | STATE_NORMAL = 0; 29 | STATE_MAINTENANCE = 1; 30 | } 31 | // The state signals the ordering service to go into maintenance mode, typically for consensus-type migration. 32 | State state = 3; 33 | } 34 | 35 | message BatchSize { 36 | // Simply specified as number of messages for now, in the future 37 | // we may want to allow this to be specified by size in bytes 38 | uint32 max_message_count = 1; 39 | // The byte count of the serialized messages in a batch cannot 40 | // exceed this value. 41 | uint32 absolute_max_bytes = 2; 42 | // The byte count of the serialized messages in a batch should not 43 | // exceed this value. 44 | uint32 preferred_max_bytes = 3; 45 | } 46 | 47 | message BatchTimeout { 48 | // Any duration string parseable by ParseDuration(): 49 | // https://golang.org/pkg/time/#ParseDuration 50 | string timeout = 1; 51 | } 52 | 53 | // Carries a list of bootstrap brokers, i.e. this is not the exclusive set of 54 | // brokers an ordering service 55 | message KafkaBrokers { 56 | option deprecated = true; 57 | // Each broker here should be identified using the (IP|host):port notation, 58 | // e.g. 127.0.0.1:7050, or localhost:7050 are valid entries 59 | repeated string brokers = 1; 60 | } 61 | 62 | // ChannelRestrictions is the mssage which conveys restrictions on channel creation for an orderer 63 | message ChannelRestrictions { 64 | uint64 max_count = 1; // The max count of channels to allow to be created, a value of 0 indicates no limit 65 | } 66 | -------------------------------------------------------------------------------- /orderer/etcdraft/configuration.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/orderer/etcdraft"; 8 | option java_package = "org.hyperledger.fabric.protos.orderer.etcdraft"; 9 | 10 | package etcdraft; 11 | 12 | // ConfigMetadata is serialized and set as the value of ConsensusType.Metadata in 13 | // a channel configuration when the ConsensusType.Type is set "etcdraft". 14 | message ConfigMetadata { 15 | repeated Consenter consenters = 1; 16 | Options options = 2; 17 | } 18 | 19 | // Consenter represents a consenting node (i.e. replica). 20 | message Consenter { 21 | string host = 1; 22 | uint32 port = 2; 23 | bytes client_tls_cert = 3; 24 | bytes server_tls_cert = 4; 25 | } 26 | 27 | // Options to be specified for all the etcd/raft nodes. These can be modified on a 28 | // per-channel basis. 29 | message Options { 30 | string tick_interval = 1; // time duration format, e.g. 500ms 31 | uint32 election_tick = 2; 32 | uint32 heartbeat_tick = 3; 33 | uint32 max_inflight_blocks = 4; 34 | // Take snapshot when cumulative data exceeds certain size in bytes. 35 | uint32 snapshot_interval_size = 5; 36 | } 37 | -------------------------------------------------------------------------------- /orderer/etcdraft/metadata.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/orderer/etcdraft"; 8 | option java_package = "org.hyperledger.fabric.protos.orderer.etcdraft"; 9 | 10 | package etcdraft; 11 | 12 | // BlockMetadata stores data used by the Raft OSNs when 13 | // coordinating with each other, to be serialized into 14 | // block meta dta field and used after failres and restarts. 15 | message BlockMetadata { 16 | // Maintains a mapping between the cluster's OSNs 17 | // and their Raft IDs. 18 | repeated uint64 consenter_ids = 1; 19 | // Carries the Raft ID value that will be assigned 20 | // to the next OSN that will join this cluster. 21 | uint64 next_consenter_id = 2; 22 | // Index of etcd/raft entry for current block. 23 | uint64 raft_index = 3; 24 | } 25 | 26 | // ClusterMetadata encapsulates metadata that is exchanged among cluster nodes 27 | message ClusterMetadata { 28 | // Indicates active nodes in cluster that are reacheable by Raft leader 29 | repeated uint64 active_nodes = 1; 30 | } 31 | -------------------------------------------------------------------------------- /orderer/smartbft/configuration.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/orderer/smartbft"; 8 | option java_package = "org.hyperledger.fabric.protos.orderer.smartbft"; 9 | 10 | package orderer.smartbft; 11 | 12 | // Options to be specified for all the smartbft nodes. These can be modified on a 13 | // per-channel basis. 14 | message Options { 15 | uint64 request_batch_max_count = 1; 16 | uint64 request_batch_max_bytes = 2; 17 | string request_batch_max_interval = 3; 18 | 19 | uint64 incoming_message_buffer_size = 4; 20 | 21 | uint64 request_pool_size = 5; 22 | string request_forward_timeout = 6; 23 | string request_complain_timeout = 7; 24 | string request_auto_remove_timeout = 8; 25 | uint64 request_max_bytes = 9; 26 | 27 | string view_change_resend_interval = 10; 28 | string view_change_timeout = 11; 29 | 30 | string leader_heartbeat_timeout = 12; 31 | uint64 leader_heartbeat_count = 13; 32 | 33 | string collect_timeout = 14; 34 | bool sync_on_start = 15; 35 | bool speed_up_view_change = 16; 36 | enum Rotation { 37 | ROTATION_UNSPECIFIED = 0; 38 | ROTATION_OFF = 1; 39 | ROTATION_ON = 2; 40 | } 41 | Rotation leader_rotation = 17; 42 | uint64 decisions_per_leader = 18; 43 | } 44 | -------------------------------------------------------------------------------- /peer/chaincode.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 9 | 10 | package protos; 11 | 12 | import "common/policies.proto"; 13 | 14 | //ChaincodeID contains the path as specified by the deploy transaction 15 | //that created it as well as the hashCode that is generated by the 16 | //system for the path. From the user level (ie, CLI, REST API and so on) 17 | //deploy transaction is expected to provide the path and other requests 18 | //are expected to provide the hashCode. The other value will be ignored. 19 | //Internally, the structure could contain both values. For instance, the 20 | //hashCode will be set when first generated using the path 21 | message ChaincodeID { 22 | //deploy transaction will use the path 23 | string path = 1; 24 | 25 | //all other requests will use the name (really a hashcode) generated by 26 | //the deploy transaction 27 | string name = 2; 28 | 29 | //user friendly version name for the chaincode 30 | string version = 3; 31 | } 32 | 33 | // Carries the chaincode function and its arguments. 34 | // UnmarshalJSON in transaction.go converts the string-based REST/JSON input to 35 | // the []byte-based current ChaincodeInput structure. 36 | message ChaincodeInput { 37 | repeated bytes args = 1; 38 | map decorations = 2; 39 | 40 | // is_init is used for the application to signal that an invocation is to be routed 41 | // to the legacy 'Init' function for compatibility with chaincodes which handled 42 | // Init in the old way. New applications should manage their initialized state 43 | // themselves. 44 | bool is_init = 3; 45 | } 46 | 47 | // Carries the chaincode specification. This is the actual metadata required for 48 | // defining a chaincode. 49 | message ChaincodeSpec { 50 | 51 | enum Type { 52 | UNDEFINED = 0; 53 | GOLANG = 1; 54 | NODE = 2; 55 | CAR = 3; 56 | JAVA = 4; 57 | } 58 | 59 | Type type = 1; 60 | ChaincodeID chaincode_id = 2; 61 | ChaincodeInput input = 3; 62 | int32 timeout = 4; 63 | } 64 | 65 | // Specify the deployment of a chaincode. 66 | // TODO: Define `codePackage`. 67 | message ChaincodeDeploymentSpec { 68 | // Prevent removed tag re-use 69 | reserved 2, 4; 70 | reserved "effective_date", "exec_env"; 71 | 72 | ChaincodeSpec chaincode_spec = 1; 73 | bytes code_package = 3; 74 | 75 | } 76 | 77 | // Carries the chaincode function and its arguments. 78 | message ChaincodeInvocationSpec { 79 | // Prevent removed tag re-use 80 | reserved 2; 81 | reserved "id_generation_alg"; 82 | 83 | ChaincodeSpec chaincode_spec = 1; 84 | } 85 | 86 | // LifecycleEvent is used as the payload of the chaincode event emitted by LSCC 87 | message LifecycleEvent { 88 | string chaincode_name = 1; 89 | } 90 | 91 | // CDSData is data stored in the LSCC on instantiation of a CC 92 | // for CDSPackage. This needs to be serialized for ChaincodeData 93 | // hence the protobuf format 94 | message CDSData { 95 | bytes hash = 1; // hash of ChaincodeDeploymentSpec.code_package 96 | bytes metadatahash = 2; // hash of ChaincodeID.name + ChaincodeID.version 97 | } 98 | 99 | // ChaincodeData defines the datastructure for chaincodes to be serialized by proto 100 | // Type provides an additional check by directing to use a specific package after instantiation 101 | // Data is Type specific (see CDSPackage and SignedCDSPackage) 102 | message ChaincodeData { 103 | 104 | // Name of the chaincode 105 | string name = 1; 106 | 107 | // Version of the chaincode 108 | string version = 2; 109 | 110 | // Escc for the chaincode instance 111 | string escc = 3; 112 | 113 | // Vscc for the chaincode instance 114 | string vscc = 4; 115 | 116 | // Policy endorsement policy for the chaincode instance 117 | common.SignaturePolicyEnvelope policy = 5; 118 | 119 | // Data data specific to the package 120 | bytes data = 6; 121 | 122 | // Id of the chaincode that's the unique fingerprint for the CC This is not 123 | // currently used anywhere but serves as a good eyecatcher 124 | bytes id = 7; 125 | 126 | // InstantiationPolicy for the chaincode 127 | common.SignaturePolicyEnvelope instantiation_policy = 8; 128 | } 129 | 130 | // ChaincodeAdditionalParams - parameters passed to chaincode to notify about peer capabilities 131 | message ChaincodeAdditionalParams { 132 | bool use_write_batch = 1; // an indication that the peer can handle state write batches 133 | uint32 max_size_write_batch = 2; // maximum size of batches with write state 134 | bool use_get_multiple_keys = 3; // an indication that the peer can handle get multiple keys 135 | uint32 max_size_get_multiple_keys = 4; // maximum size of batches with get multiple keys 136 | } 137 | -------------------------------------------------------------------------------- /peer/chaincode_event.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option java_outer_classname = "ChaincodeEventPackage"; 9 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 10 | 11 | package protos; 12 | 13 | //ChaincodeEvent is used for events and registrations that are specific to chaincode 14 | //string type - "chaincode" 15 | message ChaincodeEvent { 16 | string chaincode_id = 1; 17 | string tx_id = 2; 18 | string event_name = 3; 19 | bytes payload = 4; 20 | } 21 | -------------------------------------------------------------------------------- /peer/chaincode_shim.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 9 | 10 | package protos; 11 | 12 | import "peer/chaincode_event.proto"; 13 | import "peer/proposal.proto"; 14 | import "google/protobuf/timestamp.proto"; 15 | 16 | message ChaincodeMessage { 17 | enum Type { 18 | UNDEFINED = 0; 19 | REGISTER = 1; 20 | REGISTERED = 2; 21 | INIT = 3; 22 | READY = 4; 23 | TRANSACTION = 5; 24 | COMPLETED = 6; 25 | ERROR = 7; 26 | GET_STATE = 8; 27 | PUT_STATE = 9; 28 | DEL_STATE = 10; 29 | INVOKE_CHAINCODE = 11; 30 | RESPONSE = 13; 31 | GET_STATE_BY_RANGE = 14; 32 | GET_QUERY_RESULT = 15; 33 | QUERY_STATE_NEXT = 16; 34 | QUERY_STATE_CLOSE = 17; 35 | KEEPALIVE = 18; 36 | GET_HISTORY_FOR_KEY = 19; 37 | GET_STATE_METADATA = 20; 38 | PUT_STATE_METADATA = 21; 39 | GET_PRIVATE_DATA_HASH = 22; 40 | PURGE_PRIVATE_DATA = 23; 41 | WRITE_BATCH_STATE = 24; 42 | GET_STATE_MULTIPLE = 25; 43 | } 44 | 45 | Type type = 1; 46 | google.protobuf.Timestamp timestamp = 2; 47 | bytes payload = 3; 48 | string txid = 4; 49 | 50 | SignedProposal proposal = 5; 51 | 52 | //event emitted by chaincode. Used only with Init or Invoke. 53 | // This event is then stored (currently) 54 | //with Block.NonHashData.TransactionResult 55 | ChaincodeEvent chaincode_event = 6; 56 | 57 | //channel id 58 | string channel_id = 7; 59 | } 60 | 61 | // TODO: We need to finalize the design on chaincode container 62 | // compatibility upon upgrade, see FAB-5777. 63 | 64 | // GetState is the payload of a ChaincodeMessage. It contains a key which 65 | // is to be fetched from the ledger. If the collection is specified, the key 66 | // would be fetched from the collection (i.e., private state) 67 | message GetState { 68 | string key = 1; 69 | string collection = 2; 70 | } 71 | 72 | message GetStateMetadata { 73 | string key = 1; 74 | string collection = 2; 75 | } 76 | 77 | // GetStateMultiple is the payload of the ChaincodeMessage. 78 | // It contains the keys to be retrieved from the ledger. 79 | // If a collection is specified, the keys will be retrieved 80 | // from the collection (i.e., the private state). 81 | message GetStateMultiple { 82 | repeated string keys = 1; 83 | string collection = 2; 84 | } 85 | 86 | // GetStateMultipleResult is result of executing the GetStateMiltiple request 87 | message GetStateMultipleResult { 88 | repeated bytes values = 1; 89 | } 90 | 91 | // PutState is the payload of a ChaincodeMessage. It contains a key and value 92 | // which needs to be written to the transaction's write set. If the collection is 93 | // specified, the key and value would be written to the transaction's private 94 | // write set. 95 | message PutState { 96 | string key = 1; 97 | bytes value = 2; 98 | string collection = 3; 99 | } 100 | 101 | message PutStateMetadata { 102 | string key = 1; 103 | string collection = 3; 104 | StateMetadata metadata = 4; 105 | } 106 | 107 | // WriteBatchState - set of records for state changes sent by the batch 108 | message WriteBatchState { 109 | repeated WriteRecord rec = 1; 110 | } 111 | 112 | // WriteRecord - single record with changes in the state of different types. 113 | // Filled in depending on the type. 114 | message WriteRecord { 115 | enum Type { 116 | UNDEFINED = 0; 117 | PUT_STATE = 9; 118 | DEL_STATE = 10; 119 | PUT_STATE_METADATA = 21; 120 | PURGE_PRIVATE_DATA = 23; 121 | } 122 | 123 | string key = 1; 124 | bytes value = 2; 125 | string collection = 3; 126 | StateMetadata metadata = 4; 127 | Type type = 5; 128 | } 129 | 130 | // DelState is the payload of a ChaincodeMessage. It contains a key which 131 | // needs to be recorded in the transaction's write set as a delete operation. 132 | // If the collection is specified, the key needs to be recorded in the 133 | // transaction's private write set as a delete operation. 134 | message DelState { 135 | string key = 1; 136 | string collection = 2; 137 | } 138 | 139 | message PurgePrivateState { 140 | string key = 1; 141 | string collection = 2; 142 | } 143 | 144 | // GetStateByRange is the payload of a ChaincodeMessage. It contains a start key and 145 | // a end key required to execute range query. If the collection is specified, 146 | // the range query needs to be executed on the private data. The metadata hold 147 | // the byte representation of QueryMetadata. 148 | message GetStateByRange { 149 | string startKey = 1; 150 | string endKey = 2; 151 | string collection = 3; 152 | bytes metadata = 4; 153 | } 154 | 155 | // GetQueryResult is the payload of a ChaincodeMessage. It contains a query 156 | // string in the form that is supported by the underlying state database. 157 | // If the collection is specified, the query needs to be executed on the 158 | // private data. The metadata hold the byte representation of QueryMetadata. 159 | message GetQueryResult { 160 | string query = 1; 161 | string collection = 2; 162 | bytes metadata = 3; 163 | } 164 | 165 | // QueryMetadata is the metadata of a GetStateByRange and GetQueryResult. 166 | // It contains a pageSize which denotes the number of records to be fetched 167 | // and a bookmark. 168 | message QueryMetadata { 169 | int32 pageSize = 1; 170 | string bookmark = 2; 171 | } 172 | 173 | // GetHistoryForKey is the payload of a ChaincodeMessage. It contains a key 174 | // for which the historical values need to be retrieved. 175 | message GetHistoryForKey { 176 | string key = 1; 177 | } 178 | 179 | message QueryStateNext { 180 | string id = 1; 181 | } 182 | 183 | message QueryStateClose { 184 | string id = 1; 185 | } 186 | 187 | // QueryResultBytes hold the byte representation of a record returned by the peer. 188 | message QueryResultBytes { 189 | bytes resultBytes = 1; 190 | } 191 | 192 | // QueryResponse is returned by the peer as a result of a GetStateByRange, 193 | // GetQueryResult, and GetHistoryForKey. It holds a bunch of records in 194 | // results field, a flag to denote whether more results need to be fetched from 195 | // the peer in has_more field, transaction id in id field, and a QueryResponseMetadata 196 | // in metadata field. 197 | message QueryResponse { 198 | repeated QueryResultBytes results = 1; 199 | bool has_more = 2; 200 | string id = 3; 201 | bytes metadata = 4; 202 | } 203 | 204 | // QueryResponseMetadata is the metadata of a QueryResponse. It contains a count 205 | // which denotes the number of records fetched from the ledger and a bookmark. 206 | message QueryResponseMetadata { 207 | int32 fetched_records_count = 1; 208 | string bookmark = 2; 209 | } 210 | 211 | message StateMetadata { 212 | string metakey = 1; 213 | bytes value = 2; 214 | } 215 | 216 | message StateMetadataResult { 217 | repeated StateMetadata entries = 1; 218 | } 219 | 220 | // Interface that provides support to chaincode execution. ChaincodeContext 221 | // provides the context necessary for the server to respond appropriately. 222 | service ChaincodeSupport { 223 | rpc Register(stream ChaincodeMessage) returns (stream ChaincodeMessage); 224 | } 225 | 226 | // Chaincode as a server - peer establishes a connection to the chaincode as a client 227 | // Currently only supports a stream connection. 228 | service Chaincode { 229 | rpc Connect(stream ChaincodeMessage) returns (stream ChaincodeMessage); 230 | } 231 | -------------------------------------------------------------------------------- /peer/collection.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 8 | option java_package = "org.hyperledger.fabric.protos.peer"; 9 | 10 | package protos; 11 | 12 | import "common/policies.proto"; 13 | import "peer/policy.proto"; 14 | 15 | // CollectionConfigPackage represents an array of CollectionConfig 16 | // messages; the extra struct is required because repeated oneof is 17 | // forbidden by the protobuf syntax 18 | message CollectionConfigPackage { 19 | repeated CollectionConfig config = 1; 20 | } 21 | 22 | // CollectionConfig defines the configuration of a collection object; 23 | // it currently contains a single, static type. 24 | // Dynamic collections are deferred. 25 | message CollectionConfig { 26 | oneof payload { 27 | StaticCollectionConfig static_collection_config = 1; 28 | } 29 | } 30 | 31 | 32 | // StaticCollectionConfig constitutes the configuration parameters of a 33 | // static collection object. Static collections are collections that are 34 | // known at chaincode instantiation time, and that cannot be changed. 35 | // Dynamic collections are deferred. 36 | message StaticCollectionConfig { 37 | // the name of the collection inside the denoted chaincode 38 | string name = 1; 39 | // a reference to a policy residing / managed in the config block 40 | // to define which orgs have access to this collection’s private data 41 | CollectionPolicyConfig member_orgs_policy = 2; 42 | // The minimum number of peers private data will be sent to upon 43 | // endorsement. The endorsement would fail if dissemination to at least 44 | // this number of peers is not achieved. 45 | int32 required_peer_count = 3; 46 | // The maximum number of peers that private data will be sent to 47 | // upon endorsement. This number has to be bigger than required_peer_count. 48 | int32 maximum_peer_count = 4; 49 | // The number of blocks after which the collection data expires. 50 | // For instance if the value is set to 10, a key last modified by block number 100 51 | // will be purged at block number 111. A zero value is treated same as MaxUint64 52 | uint64 block_to_live = 5; 53 | // The member only read access denotes whether only collection member clients 54 | // can read the private data (if set to true), or even non members can 55 | // read the data (if set to false, for example if you want to implement more granular 56 | // access logic in the chaincode) 57 | bool member_only_read = 6; 58 | // The member only write access denotes whether only collection member clients 59 | // can write the private data (if set to true), or even non members can 60 | // write the data (if set to false, for example if you want to implement more granular 61 | // access logic in the chaincode) 62 | bool member_only_write = 7; 63 | // a reference to a policy residing / managed in the config block 64 | // to define the endorsement policy for this collection 65 | ApplicationPolicy endorsement_policy= 8; 66 | } 67 | 68 | 69 | // Collection policy configuration. Initially, the configuration can only 70 | // contain a SignaturePolicy. In the future, the SignaturePolicy may be a 71 | // more general Policy. Instead of containing the actual policy, the 72 | // configuration may in the future contain a string reference to a policy. 73 | message CollectionPolicyConfig { 74 | oneof payload { 75 | // Initially, only a signature policy is supported. 76 | common.SignaturePolicyEnvelope signature_policy = 1; 77 | // Later, the SignaturePolicy will be replaced by a Policy. 78 | // Policy policy = 1; 79 | // A reference to a Policy is planned to be added later. 80 | // string reference = 2; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /peer/configuration.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 9 | 10 | package protos; 11 | 12 | // AnchorPeers simply represents list of anchor peers which is used in ConfigurationItem 13 | message AnchorPeers { 14 | repeated AnchorPeer anchor_peers = 1; 15 | } 16 | 17 | // AnchorPeer message structure which provides information about anchor peer, it includes host name, 18 | // port number and peer certificate. 19 | message AnchorPeer { 20 | string host = 1; // DNS host name of the anchor peer 21 | int32 port = 2; // The port number 22 | } 23 | 24 | // APIResource represents an API resource in the peer whose ACL 25 | // is determined by the policy_ref field 26 | message APIResource { 27 | string policy_ref = 1; // The policy name to use for this API 28 | } 29 | 30 | // ACLs provides mappings for resources in a channel. APIResource encapsulates 31 | // reference to a policy used to determine ACL for the resource 32 | message ACLs { 33 | map acls = 1; 34 | } 35 | -------------------------------------------------------------------------------- /peer/events.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option java_outer_classname = "EventsPackage"; 9 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 10 | 11 | package protos; 12 | 13 | import "common/common.proto"; 14 | import "ledger/rwset/rwset.proto"; 15 | import "peer/chaincode_event.proto"; 16 | import "peer/transaction.proto"; 17 | 18 | // FilteredBlock is a minimal set of information about a block 19 | message FilteredBlock { 20 | string channel_id = 1; 21 | uint64 number = 2; // The position in the blockchain 22 | repeated FilteredTransaction filtered_transactions = 4; 23 | } 24 | 25 | // FilteredTransaction is a minimal set of information about a transaction 26 | // within a block 27 | message FilteredTransaction { 28 | string txid = 1; 29 | common.HeaderType type = 2; 30 | TxValidationCode tx_validation_code = 3; 31 | oneof Data { 32 | FilteredTransactionActions transaction_actions = 4; 33 | } 34 | } 35 | 36 | // FilteredTransactionActions is a wrapper for array of TransactionAction 37 | // message from regular block 38 | message FilteredTransactionActions { 39 | repeated FilteredChaincodeAction chaincode_actions = 1; 40 | } 41 | 42 | // FilteredChaincodeAction is a minimal set of information about an action 43 | // within a transaction 44 | message FilteredChaincodeAction { 45 | ChaincodeEvent chaincode_event = 1; 46 | } 47 | 48 | // BlockAndPrivateData contains Block and a map from tx_seq_in_block to rwset.TxPvtReadWriteSet 49 | message BlockAndPrivateData { 50 | common.Block block = 1; 51 | // map from tx_seq_in_block to rwset.TxPvtReadWriteSet 52 | map private_data_map = 2; 53 | } 54 | 55 | // DeliverResponse 56 | message DeliverResponse { 57 | oneof Type { 58 | common.Status status = 1; 59 | common.Block block = 2; 60 | FilteredBlock filtered_block = 3; 61 | BlockAndPrivateData block_and_private_data = 4; 62 | } 63 | } 64 | 65 | service Deliver { 66 | // Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with 67 | // Payload data as a marshaled orderer.SeekInfo message, 68 | // then a stream of block replies is received 69 | rpc Deliver (stream common.Envelope) returns (stream DeliverResponse) { 70 | } 71 | // DeliverFiltered first requires an Envelope of type ab.DELIVER_SEEK_INFO with 72 | // Payload data as a marshaled orderer.SeekInfo message, 73 | // then a stream of **filtered** block replies is received 74 | rpc DeliverFiltered (stream common.Envelope) returns (stream DeliverResponse) { 75 | } 76 | // DeliverWithPrivateData first requires an Envelope of type ab.DELIVER_SEEK_INFO with 77 | // Payload data as a marshaled orderer.SeekInfo message, 78 | // then a stream of block and private data replies is received 79 | rpc DeliverWithPrivateData (stream common.Envelope) returns (stream DeliverResponse) { 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /peer/lifecycle/chaincode_definition.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer.lifecycle"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer/lifecycle"; 9 | 10 | package lifecycle; 11 | 12 | // These protos are used for encoding chaincode definitions into the statedb 13 | // in general, it should not be necessary for clients to utilize them. 14 | 15 | // ChaincodeEndorsementInfo is (most) everything the peer needs to know in order 16 | // to execute a chaincode 17 | message ChaincodeEndorsementInfo { 18 | string version = 1; 19 | bool init_required = 2; 20 | string endorsement_plugin = 3; 21 | } 22 | 23 | // ValidationInfo is (most) everything the peer needs to know in order 24 | // to validate a transaction 25 | message ChaincodeValidationInfo { 26 | string validation_plugin = 1; 27 | bytes validation_parameter = 2; 28 | } 29 | 30 | // The notable omission in this file is the collection configuration info. 31 | // It should be moved to this package, but... defering for now. 32 | -------------------------------------------------------------------------------- /peer/lifecycle/db.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer.lifecycle"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer/lifecycle"; 9 | 10 | package lifecycle; 11 | 12 | // These protos are used for encoding data into the statedb 13 | // in general, it should not be necessary for clients to utilize them. 14 | 15 | // StateMetadata describes the keys in a namespace. It is necessary because 16 | // in collections, range scans are not possible during transactions which 17 | // write. Therefore we must track the keys in our namespace ourselves. 18 | message StateMetadata { 19 | string datatype = 1; 20 | repeated string fields = 2; 21 | } 22 | 23 | // StateData encodes a particular field of a datatype 24 | message StateData { 25 | oneof Type { 26 | int64 Int64 = 1; 27 | bytes Bytes = 2; 28 | string String = 3; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /peer/lifecycle/lifecycle.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer.lifecycle"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer/lifecycle"; 9 | 10 | package lifecycle; 11 | 12 | import "peer/collection.proto"; 13 | 14 | // InstallChaincodeArgs is the message used as the argument to 15 | // '_lifecycle.InstallChaincode'. 16 | message InstallChaincodeArgs { 17 | bytes chaincode_install_package = 1; // This should be a marshaled lifecycle.ChaincodePackage 18 | } 19 | 20 | // InstallChaincodeArgs is the message returned by 21 | // '_lifecycle.InstallChaincode'. 22 | message InstallChaincodeResult { 23 | string package_id = 1; 24 | string label = 2; 25 | } 26 | 27 | // QueryInstalledChaincodeArgs is the message used as arguments 28 | // '_lifecycle.QueryInstalledChaincode' 29 | message QueryInstalledChaincodeArgs { 30 | string package_id = 1; 31 | } 32 | 33 | // QueryInstalledChaincodeResult is the message returned by 34 | // '_lifecycle.QueryInstalledChaincode' 35 | message QueryInstalledChaincodeResult { 36 | string package_id = 1; 37 | string label = 2; 38 | map references = 3; 39 | 40 | message References { 41 | repeated Chaincode chaincodes = 1; 42 | } 43 | 44 | message Chaincode { 45 | string name = 1; 46 | string version = 2; 47 | } 48 | } 49 | 50 | // GetInstalledChaincodePackageArgs is the message used as the argument to 51 | // '_lifecycle.GetInstalledChaincodePackage'. 52 | message GetInstalledChaincodePackageArgs { 53 | string package_id = 1; 54 | } 55 | 56 | // GetInstalledChaincodePackageResult is the message returned by 57 | // '_lifecycle.GetInstalledChaincodePackage'. 58 | message GetInstalledChaincodePackageResult { 59 | bytes chaincode_install_package = 1; 60 | } 61 | 62 | // QueryInstalledChaincodesArgs currently is an empty argument to 63 | // '_lifecycle.QueryInstalledChaincodes'. In the future, it may be 64 | // extended to have parameters. 65 | message QueryInstalledChaincodesArgs { 66 | } 67 | 68 | // QueryInstalledChaincodesResult is the message returned by 69 | // '_lifecycle.QueryInstalledChaincodes'. It returns a list of installed 70 | // chaincodes, including a map of channel name to chaincode name and version 71 | // pairs of chaincode definitions that reference this chaincode package. 72 | message QueryInstalledChaincodesResult { 73 | message InstalledChaincode { 74 | string package_id = 1; 75 | string label = 2; 76 | map references = 3; 77 | } 78 | 79 | message References { 80 | repeated Chaincode chaincodes = 1; 81 | } 82 | 83 | message Chaincode { 84 | string name = 1; 85 | string version = 2; 86 | } 87 | 88 | repeated InstalledChaincode installed_chaincodes = 1; 89 | } 90 | 91 | // ApproveChaincodeDefinitionForMyOrgArgs is the message used as arguments to 92 | // `_lifecycle.ApproveChaincodeDefinitionForMyOrg`. 93 | message ApproveChaincodeDefinitionForMyOrgArgs { 94 | int64 sequence = 1; 95 | string name = 2; 96 | string version = 3; 97 | string endorsement_plugin = 4; 98 | string validation_plugin = 5; 99 | bytes validation_parameter = 6; 100 | protos.CollectionConfigPackage collections = 7; 101 | bool init_required = 8; 102 | ChaincodeSource source = 9; 103 | } 104 | 105 | message ChaincodeSource { 106 | message Unavailable {} 107 | 108 | message Local { 109 | string package_id = 1; 110 | } 111 | 112 | oneof Type { 113 | Unavailable unavailable = 1; 114 | Local local_package = 2; 115 | } 116 | } 117 | 118 | // ApproveChaincodeDefinitionForMyOrgResult is the message returned by 119 | // `_lifecycle.ApproveChaincodeDefinitionForMyOrg`. Currently it returns 120 | // nothing, but may be extended in the future. 121 | message ApproveChaincodeDefinitionForMyOrgResult { 122 | } 123 | 124 | // CommitChaincodeDefinitionArgs is the message used as arguments to 125 | // `_lifecycle.CommitChaincodeDefinition`. 126 | message CommitChaincodeDefinitionArgs { 127 | int64 sequence = 1; 128 | string name = 2; 129 | string version = 3; 130 | string endorsement_plugin = 4; 131 | string validation_plugin = 5; 132 | bytes validation_parameter = 6; 133 | protos.CollectionConfigPackage collections = 7; 134 | bool init_required = 8; 135 | } 136 | 137 | // CommitChaincodeDefinitionResult is the message returned by 138 | // `_lifecycle.CommitChaincodeDefinition`. Currently it returns 139 | // nothing, but may be extended in the future. 140 | message CommitChaincodeDefinitionResult { 141 | } 142 | 143 | // CheckCommitReadinessArgs is the message used as arguments to 144 | // `_lifecycle.CheckCommitReadiness`. 145 | message CheckCommitReadinessArgs { 146 | int64 sequence = 1; 147 | string name = 2; 148 | string version = 3; 149 | string endorsement_plugin = 4; 150 | string validation_plugin = 5; 151 | bytes validation_parameter = 6; 152 | protos.CollectionConfigPackage collections = 7; 153 | bool init_required = 8; 154 | } 155 | 156 | // CheckCommitReadinessResult is the message returned by 157 | // `_lifecycle.CheckCommitReadiness`. It returns a map of 158 | // orgs to their approval (true/false) for the definition 159 | // supplied as args. Additionally, it returns a map of 160 | // parameter mismatches between each organization's 161 | // approved definition and the definition supplied as args. 162 | message CheckCommitReadinessResult{ 163 | map approvals = 1; 164 | 165 | message Mismatches { 166 | repeated string items = 1; 167 | } 168 | map mismatches = 2; 169 | } 170 | 171 | // QueryApprovedChaincodeDefinitionArgs is the message used as arguments to 172 | // `_lifecycle.QueryApprovedChaincodeDefinition`. 173 | message QueryApprovedChaincodeDefinitionArgs { 174 | string name = 1; 175 | int64 sequence = 2; 176 | } 177 | 178 | // QueryApprovedChaincodeDefinitionResult is the message returned by 179 | // `_lifecycle.QueryApprovedChaincodeDefinition`. 180 | message QueryApprovedChaincodeDefinitionResult { 181 | int64 sequence = 1; 182 | string version = 2; 183 | string endorsement_plugin = 3; 184 | string validation_plugin = 4; 185 | bytes validation_parameter = 5; 186 | protos.CollectionConfigPackage collections = 6; 187 | bool init_required = 7; 188 | ChaincodeSource source = 8; 189 | } 190 | 191 | // QueryApprovedChaincodeDefinitionsArgs is the message used as arguments to 192 | // `_lifecycle.QueryApprovedChaincodeDefinitions`. 193 | message QueryApprovedChaincodeDefinitionsArgs { } 194 | 195 | // QueryApprovedChaincodeDefinitionsResult is the message returned by 196 | // `_lifecycle.QueryApprovedChaincodeDefinitions`. 197 | message QueryApprovedChaincodeDefinitionsResult { 198 | message ApprovedChaincodeDefinition { 199 | string name = 1; 200 | int64 sequence = 2; 201 | string version = 3; 202 | string endorsement_plugin = 4; 203 | string validation_plugin = 5; 204 | bytes validation_parameter = 6; 205 | protos.CollectionConfigPackage collections = 7; 206 | bool init_required = 8; 207 | ChaincodeSource source = 9; 208 | } 209 | repeated ApprovedChaincodeDefinition approved_chaincode_definitions = 1; 210 | } 211 | 212 | // QueryChaincodeDefinitionArgs is the message used as arguments to 213 | // `_lifecycle.QueryChaincodeDefinition`. 214 | message QueryChaincodeDefinitionArgs { 215 | string name = 1; 216 | } 217 | 218 | // QueryChaincodeDefinitionResult is the message returned by 219 | // `_lifecycle.QueryChaincodeDefinition`. 220 | message QueryChaincodeDefinitionResult { 221 | int64 sequence = 1; 222 | string version = 2; 223 | string endorsement_plugin = 3; 224 | string validation_plugin = 4; 225 | bytes validation_parameter = 5; 226 | protos.CollectionConfigPackage collections = 6; 227 | bool init_required = 7; 228 | map approvals = 8; 229 | } 230 | 231 | // QueryChaincodeDefinitionsArgs is the message used as arguments to 232 | // `_lifecycle.QueryChaincodeDefinitions`. 233 | message QueryChaincodeDefinitionsArgs { } 234 | 235 | // QueryChaincodeDefinitionsResult is the message returned by 236 | // `_lifecycle.QueryChaincodeDefinitions`. 237 | message QueryChaincodeDefinitionsResult { 238 | message ChaincodeDefinition { 239 | string name = 1; 240 | int64 sequence = 2; 241 | string version = 3; 242 | string endorsement_plugin = 4; 243 | string validation_plugin = 5; 244 | bytes validation_parameter = 6; 245 | protos.CollectionConfigPackage collections = 7; 246 | bool init_required = 8; 247 | } 248 | repeated ChaincodeDefinition chaincode_definitions = 1; 249 | } 250 | -------------------------------------------------------------------------------- /peer/peer.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 9 | 10 | package protos; 11 | 12 | import "peer/proposal.proto"; 13 | import "peer/proposal_response.proto"; 14 | 15 | service Endorser { 16 | rpc ProcessProposal(SignedProposal) returns (ProposalResponse); 17 | } 18 | -------------------------------------------------------------------------------- /peer/policy.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 8 | option java_package = "org.hyperledger.fabric.protos.peer"; 9 | 10 | package protos; 11 | 12 | import "common/policies.proto"; 13 | 14 | // ApplicationPolicy captures the diffenrent policy types that 15 | // are set and evaluted at the application level. 16 | message ApplicationPolicy { 17 | oneof Type { 18 | // SignaturePolicy type is used if the policy is specified as 19 | // a combination (using threshold gates) of signatures from MSP 20 | // principals 21 | common.SignaturePolicyEnvelope signature_policy = 1; 22 | 23 | // ChannelConfigPolicyReference is used when the policy is 24 | // specified as a string that references a policy defined in 25 | // the configuration of the channel 26 | string channel_config_policy_reference = 2; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /peer/proposal_response.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 8 | option java_package = "org.hyperledger.fabric.protos.peer"; 9 | option java_outer_classname = "ProposalResponsePackage"; 10 | 11 | package protos; 12 | 13 | import "google/protobuf/timestamp.proto"; 14 | import "common/policies.proto"; 15 | 16 | // A ProposalResponse is returned from an endorser to the proposal submitter. 17 | // The idea is that this message contains the endorser's response to the 18 | // request of a client to perform an action over a chaincode (or more 19 | // generically on the ledger); the response might be success/error (conveyed in 20 | // the Response field) together with a description of the action and a 21 | // signature over it by that endorser. If a sufficient number of distinct 22 | // endorsers agree on the same action and produce signature to that effect, a 23 | // transaction can be generated and sent for ordering. 24 | message ProposalResponse { 25 | // Version indicates message protocol version 26 | int32 version = 1; 27 | 28 | // Timestamp is the time that the message 29 | // was created as defined by the sender 30 | google.protobuf.Timestamp timestamp = 2; 31 | 32 | // A response message indicating whether the 33 | // endorsement of the action was successful 34 | Response response = 4; 35 | 36 | // The payload of response. It is the bytes of ProposalResponsePayload 37 | bytes payload = 5; 38 | 39 | // The endorsement of the proposal, basically 40 | // the endorser's signature over the payload 41 | Endorsement endorsement = 6; 42 | 43 | // The chaincode interest derived from simulating the proposal. 44 | ChaincodeInterest interest = 7; 45 | } 46 | 47 | // A response with a representation similar to an HTTP response that can 48 | // be used within another message. 49 | message Response { 50 | // A status code that should follow the HTTP status codes. 51 | int32 status = 1; 52 | 53 | // A message associated with the response code. 54 | string message = 2; 55 | 56 | // A payload that can be used to include metadata with this response. 57 | bytes payload = 3; 58 | } 59 | 60 | // ProposalResponsePayload is the payload of a proposal response. This message 61 | // is the "bridge" between the client's request and the endorser's action in 62 | // response to that request. Concretely, for chaincodes, it contains a hashed 63 | // representation of the proposal (proposalHash) and a representation of the 64 | // chaincode state changes and events inside the extension field. 65 | message ProposalResponsePayload { 66 | // Hash of the proposal that triggered this response. The hash is used to 67 | // link a response with its proposal, both for bookeeping purposes on an 68 | // asynchronous system and for security reasons (accountability, 69 | // non-repudiation). The hash usually covers the entire Proposal message 70 | // (byte-by-byte). 71 | bytes proposal_hash = 1; 72 | 73 | // Extension should be unmarshaled to a type-specific message. The type of 74 | // the extension in any proposal response depends on the type of the proposal 75 | // that the client selected when the proposal was initially sent out. In 76 | // particular, this information is stored in the type field of a Header. For 77 | // chaincode, it's a ChaincodeAction message 78 | bytes extension = 2; 79 | } 80 | 81 | // An endorsement is a signature of an endorser over a proposal response. By 82 | // producing an endorsement message, an endorser implicitly "approves" that 83 | // proposal response and the actions contained therein. When enough 84 | // endorsements have been collected, a transaction can be generated out of a 85 | // set of proposal responses. Note that this message only contains an identity 86 | // and a signature but no signed payload. This is intentional because 87 | // endorsements are supposed to be collected in a transaction, and they are all 88 | // expected to endorse a single proposal response/action (many endorsements 89 | // over a single proposal response) 90 | message Endorsement { 91 | // Identity of the endorser (e.g. its certificate) 92 | bytes endorser = 1; 93 | 94 | // Signature of the payload included in ProposalResponse concatenated with 95 | // the endorser's certificate; ie, sign(ProposalResponse.payload + endorser) 96 | bytes signature = 2; 97 | } 98 | 99 | // ChaincodeInterest defines an interest about an endorsement 100 | // for a specific single chaincode invocation. 101 | // Multiple chaincodes indicate chaincode to chaincode invocations. 102 | message ChaincodeInterest { 103 | repeated ChaincodeCall chaincodes = 1; 104 | } 105 | 106 | // ChaincodeCall defines a call to a chaincode. 107 | // It may have collections that are related to the chaincode 108 | message ChaincodeCall { 109 | string name = 1; 110 | repeated string collection_names = 2; 111 | bool no_private_reads = 3; // Indicates we do not need to read from private data 112 | bool no_public_writes = 4; // Indicates we do not need to write to the chaincode namespace 113 | 114 | // The set of signature policies associated with states in the write-set 115 | // that have state-based endorsement policies. 116 | repeated common.SignaturePolicyEnvelope key_policies = 5; 117 | 118 | // Indicates we wish to ignore the namespace endorsement policy 119 | bool disregard_namespace_policy = 6; 120 | } 121 | 122 | -------------------------------------------------------------------------------- /peer/query.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 9 | 10 | package protos; 11 | 12 | // ChaincodeQueryResponse returns information about each chaincode that pertains 13 | // to a query in lscc.go, such as GetChaincodes (returns all chaincodes 14 | // instantiated on a channel), and GetInstalledChaincodes (returns all chaincodes 15 | // installed on a peer) 16 | message ChaincodeQueryResponse { 17 | repeated ChaincodeInfo chaincodes = 1; 18 | } 19 | 20 | // ChaincodeInfo contains general information about an installed/instantiated 21 | // chaincode 22 | message ChaincodeInfo { 23 | string name = 1; 24 | string version = 2; 25 | // the path as specified by the install/instantiate transaction 26 | string path = 3; 27 | // the chaincode function upon instantiation and its arguments. This will be 28 | // blank if the query is returning information about installed chaincodes. 29 | string input = 4; 30 | // the name of the ESCC for this chaincode. This will be 31 | // blank if the query is returning information about installed chaincodes. 32 | string escc = 5; 33 | // the name of the VSCC for this chaincode. This will be 34 | // blank if the query is returning information about installed chaincodes. 35 | string vscc = 6; 36 | // the chaincode unique id. 37 | // computed as: H( 38 | // H(name || version) || 39 | // H(CodePackage) 40 | // ) 41 | bytes id = 7; 42 | } 43 | 44 | // ChannelQueryResponse returns information about each channel that pertains 45 | // to a query in lscc.go, such as GetChannels (returns all channels for a 46 | // given peer) 47 | message ChannelQueryResponse { 48 | repeated ChannelInfo channels = 1; 49 | } 50 | 51 | // ChannelInfo contains general information about channels 52 | message ChannelInfo { 53 | string channel_id = 1; 54 | } 55 | 56 | // JoinBySnapshotStatus contains information about whether or a JoinBySnapshot operation 57 | // is in progress and the related bootstrap dir if it is running. 58 | message JoinBySnapshotStatus { 59 | bool in_progress = 1; 60 | string bootstrapping_snapshot_dir = 2; 61 | } 62 | -------------------------------------------------------------------------------- /peer/resources.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 9 | 10 | package protos; 11 | 12 | import "common/configtx.proto"; 13 | 14 | // ChaincodeIdentifier identifies a piece of chaincode. For a peer to accept invocations of 15 | // this chaincode, the hash of the installed code must match, as must the version string 16 | // included with the install command. 17 | message ChaincodeIdentifier { 18 | bytes hash = 1; // The hash of the chaincode bytes 19 | string version = 2; // A user friendly human readable name corresponding to the ID 20 | } 21 | 22 | // ChaincodeValidation instructs the peer how transactions for this chaincode should be 23 | // validated. The only validation mechanism which ships with fabric today is the standard 24 | // 'vscc' validation mechanism. This built in validation method utilizes an endorsement policy 25 | // which checks that a sufficient number of signatures have been included. The 'arguement' 26 | // field encodes any parameters required by the validation implementation. 27 | message ChaincodeValidation { 28 | string name = 1; // Specifies which code to run to validate transactions, defaults to 'vscc' 29 | bytes argument = 2; // When 'vscc' a marshaled VSCCArgs 30 | } 31 | 32 | // VSCCArgs is passed (marshaled) as a parameter to the VSCC imlementation via the 33 | // argument field of the ChaincodeValidation message. 34 | message VSCCArgs { 35 | string endorsement_policy_ref = 1; // A named reference to an endorsement policy, 36 | // for instance /Channel/Application/Writers 37 | } 38 | 39 | // ChaincodeEndorsement instructs the peer how transactions should be endorsed. The only 40 | // endorsement mechanism which ships with the fabric today is the standard 'escc' mechanism. 41 | // This code simply simulates the proposal to generate a RW set, then signs the result 42 | // using the peer's local signing identity. 43 | message ChaincodeEndorsement { 44 | string name = 1; // Specifies what code to run for endorsements, defaults 'escc' 45 | // Eventually we may wish add an arg here, just like the ChaincodeValidation message, but 46 | // omitting now until there is a need for it. 47 | } 48 | 49 | // ConfigTree encapsulates channel and resources configuration of a channel. 50 | // Both configurations are represented as common.Config 51 | message ConfigTree { 52 | common.Config channel_config = 1; 53 | common.Config resources_config = 2; 54 | } 55 | -------------------------------------------------------------------------------- /peer/signed_cc_dep_spec.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option java_package = "org.hyperledger.fabric.protos.peer"; 8 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 9 | 10 | package protos; 11 | 12 | import "peer/proposal_response.proto"; 13 | 14 | // SignedChaincodeDeploymentSpec carries the CDS along with endorsements 15 | message SignedChaincodeDeploymentSpec { 16 | // This is the bytes of the ChaincodeDeploymentSpec 17 | bytes chaincode_deployment_spec = 1; 18 | 19 | // This is the instantiation policy which is identical in structure 20 | // to endorsement policy. This policy is checked by the VSCC at commit 21 | // time on the instantiation (all peers will get the same policy as it 22 | // will be part of the LSCC instantation record and will be part of the 23 | // hash as well) 24 | bytes instantiation_policy = 2; 25 | 26 | // The endorsements of the above deployment spec, the owner's signature over 27 | // chaincode_deployment_spec and Endorsement.endorser. 28 | repeated Endorsement owner_endorsements = 3; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /peer/snapshot.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 8 | option java_package = "org.hyperledger.fabric.protos.peer"; 9 | 10 | package protos; 11 | 12 | import "google/protobuf/empty.proto"; 13 | import "common/common.proto"; 14 | 15 | // SnapshotRequest contains information for a generate/cancel snapshot request 16 | message SnapshotRequest { 17 | // The signature header that contains creator identity and nonce 18 | common.SignatureHeader signature_header = 1; 19 | // The channel ID 20 | string channel_id = 2; 21 | // The block number to generate a snapshot 22 | uint64 block_number = 3; 23 | } 24 | 25 | // SnapshotQuery contains information for a query snapshot request 26 | message SnapshotQuery { 27 | // The signature header that contains creator identity and nonce 28 | common.SignatureHeader signature_header = 1; 29 | // The channel ID 30 | string channel_id = 2; 31 | } 32 | 33 | // SignedSnapshotRequest contains marshalled request bytes and signature 34 | message SignedSnapshotRequest { 35 | // The bytes of SnapshotRequest or SnapshotQuery 36 | bytes request = 1; 37 | // Signaure over request bytes; this signature is to be verified against the client identity 38 | bytes signature = 2; 39 | } 40 | 41 | // QueryPendingSnapshotsResponse specifies the response payload of a query pending snapshots request 42 | message QueryPendingSnapshotsResponse { 43 | repeated uint64 block_numbers = 1; 44 | } 45 | 46 | service Snapshot { 47 | // Generate a snapshot reqeust. SignedSnapshotRequest contains marshalled bytes for SnaphostRequest 48 | rpc Generate(SignedSnapshotRequest) returns (google.protobuf.Empty) {} 49 | // Cancel a snapshot reqeust. SignedSnapshotRequest contains marshalled bytes for SnaphostRequest 50 | rpc Cancel(SignedSnapshotRequest) returns (google.protobuf.Empty) {} 51 | // Query pending snapshots query. SignedSnapshotRequest contains marshalled bytes for SnaphostQuery 52 | rpc QueryPendings(SignedSnapshotRequest) returns (QueryPendingSnapshotsResponse) {} 53 | } 54 | -------------------------------------------------------------------------------- /peer/transaction.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/hyperledger/fabric-protos-go/peer"; 8 | option java_package = "org.hyperledger.fabric.protos.peer"; 9 | option java_outer_classname = "TransactionPackage"; 10 | 11 | package protos; 12 | 13 | import "peer/proposal_response.proto"; 14 | import "common/common.proto"; 15 | 16 | // ProcessedTransaction wraps an Envelope that includes a transaction along with an indication 17 | // of whether the transaction was validated or invalidated by committing peer. 18 | // The use case is that GetTransactionByID API needs to retrieve the transaction Envelope 19 | // from block storage, and return it to a client, and indicate whether the transaction 20 | // was validated or invalidated by committing peer. So that the originally submitted 21 | // transaction Envelope is not modified, the ProcessedTransaction wrapper is returned. 22 | message ProcessedTransaction { 23 | // An Envelope which includes a processed transaction 24 | common.Envelope transactionEnvelope = 1; 25 | 26 | // An indication of whether the transaction was validated or invalidated by committing peer 27 | int32 validationCode = 2; 28 | } 29 | 30 | // The transaction to be sent to the ordering service. A transaction contains 31 | // one or more TransactionAction. Each TransactionAction binds a proposal to 32 | // potentially multiple actions. The transaction is atomic meaning that either 33 | // all actions in the transaction will be committed or none will. Note that 34 | // while a Transaction might include more than one Header, the Header.creator 35 | // field must be the same in each. 36 | // A single client is free to issue a number of independent Proposal, each with 37 | // their header (Header) and request payload (ChaincodeProposalPayload). Each 38 | // proposal is independently endorsed generating an action 39 | // (ProposalResponsePayload) with one signature per Endorser. Any number of 40 | // independent proposals (and their action) might be included in a transaction 41 | // to ensure that they are treated atomically. 42 | message Transaction { 43 | 44 | // The payload is an array of TransactionAction. An array is necessary to 45 | // accommodate multiple actions per transaction 46 | repeated TransactionAction actions = 1; 47 | } 48 | 49 | // TransactionAction binds a proposal to its action. The type field in the 50 | // header dictates the type of action to be applied to the ledger. 51 | message TransactionAction { 52 | 53 | // The header of the proposal action, which is the proposal header 54 | bytes header = 1; 55 | 56 | // The payload of the action as defined by the type in the header For 57 | // chaincode, it's the bytes of ChaincodeActionPayload 58 | bytes payload = 2; 59 | } 60 | 61 | //---------- Chaincode Transaction ------------ 62 | 63 | // ChaincodeActionPayload is the message to be used for the TransactionAction's 64 | // payload when the Header's type is set to CHAINCODE. It carries the 65 | // chaincodeProposalPayload and an endorsed action to apply to the ledger. 66 | message ChaincodeActionPayload { 67 | // This field contains the bytes of the ChaincodeProposalPayload message from 68 | // the original invocation (essentially the arguments) after the application 69 | // of the visibility function. The main visibility modes are "full" (the 70 | // entire ChaincodeProposalPayload message is included here), "hash" (only 71 | // the hash of the ChaincodeProposalPayload message is included) or 72 | // "nothing". This field will be used to check the consistency of 73 | // ProposalResponsePayload.proposalHash. For the CHAINCODE type, 74 | // ProposalResponsePayload.proposalHash is supposed to be H(ProposalHeader || 75 | // f(ChaincodeProposalPayload)) where f is the visibility function. 76 | bytes chaincode_proposal_payload = 1; 77 | 78 | // The list of actions to apply to the ledger 79 | ChaincodeEndorsedAction action = 2; 80 | } 81 | 82 | // ChaincodeEndorsedAction carries information about the endorsement of a 83 | // specific proposal 84 | message ChaincodeEndorsedAction { 85 | // This is the bytes of the ProposalResponsePayload message signed by the 86 | // endorsers. Recall that for the CHAINCODE type, the 87 | // ProposalResponsePayload's extenstion field carries a ChaincodeAction 88 | bytes proposal_response_payload = 1; 89 | 90 | // The endorsement of the proposal, basically the endorser's signature over 91 | // proposalResponsePayload 92 | repeated Endorsement endorsements = 2; 93 | } 94 | 95 | enum TxValidationCode { 96 | VALID = 0; 97 | NIL_ENVELOPE = 1; 98 | BAD_PAYLOAD = 2; 99 | BAD_COMMON_HEADER = 3; 100 | BAD_CREATOR_SIGNATURE = 4; 101 | INVALID_ENDORSER_TRANSACTION = 5; 102 | INVALID_CONFIG_TRANSACTION = 6; 103 | UNSUPPORTED_TX_PAYLOAD = 7; 104 | BAD_PROPOSAL_TXID = 8; 105 | DUPLICATE_TXID = 9; 106 | ENDORSEMENT_POLICY_FAILURE = 10; 107 | MVCC_READ_CONFLICT = 11; 108 | PHANTOM_READ_CONFLICT = 12; 109 | UNKNOWN_TX_TYPE = 13; 110 | TARGET_CHAIN_NOT_FOUND = 14; 111 | MARSHAL_TX_ERROR = 15; 112 | NIL_TXACTION = 16; 113 | EXPIRED_CHAINCODE = 17; 114 | CHAINCODE_VERSION_CONFLICT = 18; 115 | BAD_HEADER_EXTENSION = 19; 116 | BAD_CHANNEL_HEADER = 20; 117 | BAD_RESPONSE_PAYLOAD = 21; 118 | BAD_RWSET = 22; 119 | ILLEGAL_WRITESET = 23; 120 | INVALID_WRITESET = 24; 121 | INVALID_CHAINCODE = 25; 122 | NOT_VALIDATED = 254; 123 | INVALID_OTHER_REASON = 255; 124 | } 125 | 126 | // Reserved entries in the key-level metadata map 127 | enum MetaDataKeys { 128 | VALIDATION_PARAMETER = 0; 129 | VALIDATION_PARAMETER_V2 = 1; 130 | } 131 | -------------------------------------------------------------------------------- /scripts/generate_node_indexes.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | MODULE_SRC_DIR=${1:?} 6 | 7 | find_module_files() { 8 | for moduleFile in ${MODULE_FILES}; do 9 | echo "${moduleFile}" | grep "^$1/[^/]*$" | sed "s,$1/,,g" 10 | done 11 | } 12 | 13 | find_sub_dirs() { 14 | for subDir in ${MODULE_DIRS}; do 15 | echo "${subDir}" | grep "^$1/[^/]*$" | sed "s,$1/,,g" 16 | done 17 | } 18 | 19 | pushd "${MODULE_SRC_DIR}" > /dev/null 20 | 21 | find . -type f \( -name '*.js' -o -name '*.d.ts' \) -exec grep -i 'GENERATED CODE -- NO SERVICES IN PROTO' {} \; -print -delete 22 | 23 | MODULE_FILES=$(find . -name '*.d.ts' -type f -print | sed 's/\.d\.ts$//g') 24 | MODULE_DIRS=$(find . -type d -print) 25 | 26 | for moduleDir in ${MODULE_DIRS}; do 27 | pushd "${moduleDir}" > /dev/null 28 | 29 | rm -f index.ts 30 | 31 | moduleFiles=$(find_module_files "${moduleDir}") 32 | for moduleFile in ${moduleFiles}; do 33 | echo "export * from './${moduleFile}'" >> index.ts 34 | done 35 | 36 | subDirs=$(find_sub_dirs "${moduleDir}") 37 | for subDir in ${subDirs}; do 38 | echo "export * as ${subDir} from './${subDir}'" >> index.ts 39 | done 40 | 41 | popd > /dev/null 42 | done 43 | 44 | popd > /dev/null 45 | -------------------------------------------------------------------------------- /transientstore/transientstore.proto: -------------------------------------------------------------------------------- 1 | // Copyright the Hyperledger Fabric contributors. All rights reserved. 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | syntax = "proto3"; 6 | 7 | package transientstore; 8 | 9 | option go_package = "github.com/hyperledger/fabric-protos-go/transientstore"; 10 | option java_package = "org.hyperledger.fabric.protos.transientstore"; 11 | 12 | import "ledger/rwset/rwset.proto"; 13 | import "peer/collection.proto"; 14 | 15 | // TxPvtReadWriteSetWithConfigInfo encapsulates the transaction's private 16 | // read-write set and additional information about the configurations such as 17 | // the latest collection config when the transaction is simulated 18 | message TxPvtReadWriteSetWithConfigInfo { 19 | uint64 endorsed_at = 1; 20 | rwset.TxPvtReadWriteSet pvt_rwset = 2; 21 | map collection_configs = 3; 22 | } 23 | --------------------------------------------------------------------------------