Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@
,"adress"
,"NFToken"
,"NFT"
,"FabricProto"
,"bnum"
,"Requestby"
,"ecies"
,"ECIESKDF"
,"kbuf"
,"sjcl"
,"ECIES"
,"driverdbs"
,"driverdb"
,"fabproto"
,"unsubscription"
],
"dictionaries": [
"typescript,node,npm,go,rust"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_weaver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
asset-transfer:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-asset-transfer.yaml
uses: ./.github/workflows/test_weaver-asset-transfer.yaml ./.github/workflows/test_weaver-asset-transfer-fabric-connector.yaml
relay:
with:
run_all: $RUN_ALL
Expand All @@ -47,7 +47,7 @@ jobs:
data-sharing:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-data-sharing.yaml
uses: ./.github/workflows/test_weaver-data-sharing.yaml ./.github/workflows/test_weaver-data-sharing-fabric-connector.yaml
node-pkgs:
with:
run_all: $RUN_ALL
Expand Down
725 changes: 725 additions & 0 deletions .github/workflows/test_weaver-asset-transfer-fabric-connector.yaml

Large diffs are not rendered by default.

465 changes: 465 additions & 0 deletions .github/workflows/test_weaver-data-sharing-fabric-connector.yaml

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions packages/cactus-plugin-ledger-connector-fabric/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CONNECTION_PROFILE=path_to_connection_profile
RELAY_ENDPOINT=localhost:9080
RELAY_TLS=false
RELAY_TLSCA_CERT_PATH=path_to_tls_ca_cert_pem_for_relay
DRIVER_ENDPOINT=localhost:9090
DRIVER_TLS=false
DRIVER_TLS_CERT_PATH=path_to_tls_cert_pem_for_driver
DRIVER_TLS_KEY_PATH=path_to_tls_key_pem_for_driver
NETWORK_NAME=network1
DRIVER_CONFIG=
INTEROP_CHAINCODE=interop
MOCK=false
DB_PATH=driverdbs
WALLET_PATH=
DEBUG=true
LEVELDB_LOCKED_MAX_RETRIES=
LEVELDB_LOCKED_RETRY_BACKOFF_MSEC=
ENABLE_MONITOR=false
MONITOR_SYNC_PERIOD=
6 changes: 6 additions & 0 deletions packages/cactus-plugin-ledger-connector-fabric/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.env
wallet-network1/*.id
!wallet-network1/relay.id
wallet-network2/*.id
!wallet-network2/relay.id
driverdbs
70 changes: 64 additions & 6 deletions packages/cactus-plugin-ledger-connector-fabric/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@
- [4.3.1. response.type.ts](#431-responsetypets)
- [4.3.2. data-fetcher.ts](#432-data-fetcherts)
- [4.3.3. metrics.ts](#433-metricsts)
- [5. Contributing](#5-contributing)
- [6. License](#6-license)
- [7. Acknowledgments](#7-acknowledgments)
- [5. Deploying Fabric Driver for Weaver](#5-deploying-fabric-driver-for-weaver)
- [5.1 Setup](#51-setup)
- [5.1.1 Enabling TLS](#511-enabling-tls)
- [5.1.2 Environment variables](#512-environment-variables)
- [5.2 Running](#52-running)
- [6. Contributing](#6-contributing)
- [7. License](#7-license)
- [8. Acknowledgments](#8-acknowledgments)


## 1. Usage
Expand Down Expand Up @@ -688,14 +693,67 @@ This file contains functions encasing the logic to process the data points
#### 4.3.3. metrics.ts
This file lists all the prometheus metrics and what they are used for.

## 5. Contributing
## 5. Deploying Fabric Driver for Weaver
### 5.1 Setup

Create a `.env` file using `.env.template` as the base and setting suitable environment variable values (see [here](#512-environment-variables)) and `config.json` files need to be checked and updated to match the network and relay that it will be connecting to.
The .env contains information related to the network and relay. The config.json contains information about the ca admin, user and its org, that is used when connecting to the network.

#### 5.1.1 Enabling TLS

If the relay is TLS-enabled, set the following values in the `.env`:
```
RELAY_TLS=true
RELAY_TLSCA_CERT_PATH=path_to_tls_ca_cert_pem_for_relay
```
- `path_to_tls_ca_cert_pem_for_relay` should be set to CA certificate file path

To enforce secure communication over TLS with your driver, set the following values in the `.env`:
```
DRIVER_TLS=true
DRIVER_TLS_CERT_PATH=path_to_tls_cert_pem_for_driver
DRIVER_TLS_KEY_PATH=path_to_tls_key_pem_for_driver
```
- `path_to_tls_cert_pem_for_driver` should be set to driver's TLS certificate file path
- `path_to_tls_key_pem_for_driver` should be set to driver's TLS private key file path

#### 5.1.2 Environment variables

The connection profile is required to set up the required material to communicate with the network. This should be supplied with the `CONNECTION_PROFILE` environment variable (ex: CONNECTION_PROFILE=path/to/con_profile.json)

`<Hostname>:<Port>` for connecting relay: `RELAY_ENDPOINT` (ex: RELAY_ENDPOINT=localhost:9081 )

Boolean for when to use mocked fabric communication: `MOCK` (ex: MOCK=true)

`<Hostname>:<Port>` for the driver to be run on: `DRIVER_ENDPOINT` (ex: DRIVER_ENDPOINT=localhost:9093) (Not required for docker)

Can pass in a variable 'local' for working with fabric and docker: `local` (ex: local=false)

Can pass in a config file for the driver to be run with: `DRIVER_CONFIG` (ex: DRIVER_CONFIG=./config.json)

`INTEROP_CHAINCODE` stores the name of the interop chaincode installed.

`DB_PATH` stores the path hosting the database files containing the event subscription information.

`WALLET_PATH` stores the path hosting the user wallets to access a network.

NOTE: When specifying ensure that they match the config that the relay is using.

### 5.2 Running
Running the server: `yarn start-fabric-weaver-driver`

Note: Can also be run in mocked mode by setting environment variable `MOCK=true`



## 6. Contributing

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## 6. License
## 7. License

This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file.

## 7. Acknowledgments
## 8. Acknowledgments
14 changes: 14 additions & 0 deletions packages/cactus-plugin-ledger-connector-fabric/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"admin":{
"name":"admin",
"secret":"adminpw"
},
"relay": {
"name":"relay",
"affiliation":"org1.department1",
"role": "client",
"attrs": [{ "name": "relay", "value": "true", "ecert": true }]
},
"mspId":"Org1MSP",
"caUrl":""
}
24 changes: 24 additions & 0 deletions packages/cactus-plugin-ledger-connector-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"name": "Peter Somogyvari",
"email": "[email protected]",
"url": "https://accenture.com"
},
{
"name": "Carlos Amaro",
"email": "[email protected]",
"url": "https://accenture.com"
}
],
"main": "dist/lib/main/typescript/index.js",
Expand All @@ -43,6 +48,7 @@
"dist/*"
],
"scripts": {
"start-fabric-weaver-driver": "node ./dist/lib/main/typescript/plugin-ledger-connector-fabric-cli.js",
"codegen": "yarn run --top-level run-s 'codegen:*'",
"codegen:openapi": "npm run generate-sdk",
"generate-sdk": "run-p 'generate-sdk:*'",
Expand All @@ -56,14 +62,22 @@
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js"
},
"dependencies": {
"@bufbuild/protobuf": "2.2.2",
"@connectrpc/connect": "2.0.0",
"@connectrpc/connect-express": "2.0.0",
"@connectrpc/connect-node": "2.0.0",
"@connectrpc/protoc-gen-connect-es": "1.6.1",
"@fidm/x509": "1.2.1",
"@hyperledger/cacti-weaver-protos-js": "2.1.0",
"@hyperledger/cactus-common": "2.1.0",
"@hyperledger/cactus-core": "2.1.0",
"@hyperledger/cactus-core-api": "2.1.0",
"@hyperledger/cactus-plugin-keychain-memory": "2.1.0",
"axios": "1.8.4",
"bl": "6.1.0",
"bn.js": "4.12.0",
"dockerode": "3.3.0",
"dotenv": "17.2.3",
"elliptic": "6.6.1",
"express": "5.1.0",
"fabric-ca-client": "2.5.0-snapshot.23",
Expand All @@ -72,11 +86,14 @@
"fabric-protos": "2.5.0-snapshot.23",
"fast-safe-stringify": "2.1.1",
"form-data": "4.0.0",
"google-protobuf": "3.21.2",
"http-errors": "2.0.0",
"http-status-codes": "2.1.4",
"http2": "^3.3.7",
"joi": "17.13.3",
"json5": "2.2.3",
"jsrsasign": "11.0.0",
"level": "8.0.0",
"lodash": "4.17.21",
"long": "5.2.3",
"multer": "1.4.5-lts.1",
Expand All @@ -99,6 +116,10 @@
"ws-identity-client": "1.0.2"
},
"devDependencies": {
"@bufbuild/buf": "1.47.2",
"@bufbuild/protoc-gen-es": "2.2.2",
"@grpc/grpc-js": "1.13.3",
"@grpc/proto-loader": "0.7.13",
"@hyperledger/cactus-plugin-keychain-memory": "2.1.0",
"@hyperledger/cactus-test-tooling": "2.1.0",
"@types/bn.js": "5.1.0",
Expand All @@ -107,6 +128,7 @@
"@types/elliptic": "6.4.16",
"@types/express": "5.0.1",
"@types/fs-extra": "11.0.4",
"@types/google-protobuf": "3.15.12",
"@types/http-errors": "2.0.4",
"@types/jsrsasign": "8.0.13",
"@types/lodash": "4.14.172",
Expand All @@ -118,7 +140,9 @@
"@types/uuid": "10.0.0",
"body-parser": "1.20.3",
"fs-extra": "11.2.0",
"grpc_tools_node_protoc_ts": "5.3.3",
"internal-ip": "6.2.0",
"protobufjs": "7.2.5",
"socket.io": "4.6.2",
"ws-wallet": "1.1.5"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ model_deploy_contract_v1_request_constructor_args.go
model_deploy_contract_v1_response.go
model_deployment_target_org_fabric2x.go
model_deployment_target_organization.go
model_endorsed_proposal_response.go
model_endorsement.go
model_error_exception_response_v1.go
model_event_type.go
model_fabric_certificate_identity_v1.go
model_fabric_contract_invocation_type.go
model_fabric_signing_credential.go
model_fabric_signing_credential_type.go
model_fabric_view.go
model_fabric_x509_certificate_v1.go
model_file_base64.go
model_full_block_transaction_action_v1.go
Expand All @@ -53,8 +57,13 @@ model_get_discovery_results_response_v1_orderers_value_endpoints_inner.go
model_get_discovery_results_response_v1_peers_by_msp_value.go
model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner.go
model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner_chaincodes_inner.go
model_get_latest_block_number_request_v1.go
model_get_latest_block_number_response_v1.go
model_get_transaction_receipt_response.go
model_proposal_response_payload.go
model_run_delegated_sign_transaction_request.go
model_run_invoke_request.go
model_run_invoke_response.go
model_run_transaction_request.go
model_run_transaction_response.go
model_run_transaction_response_type.go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**GetBlockV1**](docs/DefaultApi.md#getblockv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block | Get block from the channel using one of selectors from the input. Works only on Fabric 2.x.
*DefaultApi* | [**GetChainInfoV1**](docs/DefaultApi.md#getchaininfov1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info | Get fabric ledger chain info.
*DefaultApi* | [**GetDiscoveryResultsV1**](docs/DefaultApi.md#getdiscoveryresultsv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results | Get fabric ledger node structure (from the discovery service).
*DefaultApi* | [**GetLatestBlockNumberV1**](docs/DefaultApi.md#getlatestblocknumberv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number | Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x.
*DefaultApi* | [**GetPrometheusMetricsV1**](docs/DefaultApi.md#getprometheusmetricsv1) | **Get** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics | Get the Prometheus Metrics
*DefaultApi* | [**GetTransactionReceiptByTxIDV1**](docs/DefaultApi.md#gettransactionreceiptbytxidv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-transaction-receipt-by-txid | get a transaction receipt by tx id on a Fabric ledger.
*DefaultApi* | [**RunDelegatedSignTransactionV1**](docs/DefaultApi.md#rundelegatedsigntransactionv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-delegated-sign-transaction | Runs a transaction on a Fabric ledger using user-provided signing callback.
Expand All @@ -105,11 +106,15 @@ Class | Method | HTTP request | Description
- [DeployContractV1Response](docs/DeployContractV1Response.md)
- [DeploymentTargetOrgFabric2x](docs/DeploymentTargetOrgFabric2x.md)
- [DeploymentTargetOrganization](docs/DeploymentTargetOrganization.md)
- [EndorsedProposalResponse](docs/EndorsedProposalResponse.md)
- [Endorsement](docs/Endorsement.md)
- [ErrorExceptionResponseV1](docs/ErrorExceptionResponseV1.md)
- [EventType](docs/EventType.md)
- [FabricCertificateIdentityV1](docs/FabricCertificateIdentityV1.md)
- [FabricContractInvocationType](docs/FabricContractInvocationType.md)
- [FabricSigningCredential](docs/FabricSigningCredential.md)
- [FabricSigningCredentialType](docs/FabricSigningCredentialType.md)
- [FabricView](docs/FabricView.md)
- [FabricX509CertificateV1](docs/FabricX509CertificateV1.md)
- [FileBase64](docs/FileBase64.md)
- [FullBlockTransactionActionV1](docs/FullBlockTransactionActionV1.md)
Expand All @@ -136,8 +141,13 @@ Class | Method | HTTP request | Description
- [GetDiscoveryResultsResponseV1PeersByMSPValue](docs/GetDiscoveryResultsResponseV1PeersByMSPValue.md)
- [GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.md)
- [GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.md)
- [GetLatestBlockNumberRequestV1](docs/GetLatestBlockNumberRequestV1.md)
- [GetLatestBlockNumberResponseV1](docs/GetLatestBlockNumberResponseV1.md)
- [GetTransactionReceiptResponse](docs/GetTransactionReceiptResponse.md)
- [ProposalResponsePayload](docs/ProposalResponsePayload.md)
- [RunDelegatedSignTransactionRequest](docs/RunDelegatedSignTransactionRequest.md)
- [RunInvokeRequest](docs/RunInvokeRequest.md)
- [RunInvokeResponse](docs/RunInvokeResponse.md)
- [RunTransactionRequest](docs/RunTransactionRequest.md)
- [RunTransactionResponse](docs/RunTransactionResponse.md)
- [RunTransactionResponseType](docs/RunTransactionResponseType.md)
Expand Down
Loading
Loading