hyperledger-cacti / cacti

Hyperledger Cacti is a new approach to the blockchain interoperability problem
https://wiki.hyperledger.org/display/cactus
Apache License 2.0
343 stars 284 forks source link

Refactor CDBC example #3118

Open RafaelAPB opened 8 months ago

RafaelAPB commented 8 months ago

We need to Dockerize SATP applications for easy deployment and testing. It should be configurable and take configuration from ENV variables.

Tasks.

  1. Re-add CBDC add that Andre Augusto created, https://github.com/hyperledger/cacti/commit/d9b70e1765da01d2b8774ca3c9ac60d89206f3f3 Essentially, CBDC example is a script that 1) spawns infrastructure (gateways, connectors, test ledgers, instantiates smart contracts); 2) sends transfer request to a gateway and process response.
    1. Update CBDC app to use the latest SATP implementation - this is using SATP client API (API3) for the CBDC example to make a gateway request.
  2. Create a Dockerfile for an example that uses SATP gateways, with the executable being src/main/typescript/app-cli.ts. See example examples/cactus-example-carbon-accounting-backend/src/main/typescript/carbon-accounting-app-cli.ts. We assume that the gateways are running, the CBDC code spawns the rest. Boilerplate:
    
    # Build stage
    FROM node:16 AS build

WORKDIR /app

COPY package*.json ./ RUN npm ci

COPY . . RUN npm run build

Production stage

FROM node:20

WORKDIR /app

COPY --from=build /app/package*.json ./ COPY --from=build /app/dist ./dist COPY --from=build /app/node_modules ./node_modules

Set up environment variables

ENV NODE_ENV=production ENV PORT=3000

Expose necessary ports

EXPOSE $PORT

Start the SATP gateway example

CMD ["node", "dist/src/main/typescript/app-cli.js"]



Please see the other examples of dockerized plugins. plugin `packages/cactus-plugin-persistence-fabric/Dockerfile` is dockerized by `examples/carbon-accounting/Dockerfile`. another example: `examples/cactus-example-cbdc-bridging-frontend/Dockerfile`

This issue also needs work on the UI:
Extend the existing CBDC example user interface to showcase the gateway's processes: creating transaction, sending, asking for user permission, balances changed. This includes leveraging the Grafana board that has been created, which should be linked to the user interface.

1. User interface should preserve existing functionality (do transfers)
2. Should be possible control transfer phases in the interface, and track the transactions in real time
3. Record an end to end demo
LordKubaya commented 8 months ago

hi

eduv09 commented 3 months ago

👍