hyperledger-cacti / cacti

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

feat(connector-chia): add plugin implementation #1634

Open petermetz opened 2 years ago

petermetz commented 2 years ago

Summary

Develop a Cactus Chia connector plugin + test infrastructure (container images, container manager class, etc.) from scratch. Include end to end test cases powered by Jest and the said testing infrastructure that prove that the connector is working as intended with a locally simulated Chia network.

You will be creating a new package in the Cactus monorepo from scratch under the packages/cactus-plugin-ledger-connector-chia/ path.

Acceptance Criteria

  1. Chia All-In-One image is created (tools/docker/chia-all-in-one/Dockerfile) which also has a README.md next to it explaining the building and running of the image and it's containers (tools/docker/chia-all-in-one/README.md) 1.1 Container health checks must be be operational and reliable for the image meaning that the HEALTHCHECK keyword needs to be used within the Dockerfile to define when the container has finished launching (e.g. it must only pass once the ledger is up and running, ready to accept transactions)
  2. The AIO image mentioned above is published to the official GitHub Container Registry under the fully qualified image tag of ghcr.io/hyperledger/cactus-chia-all-in-one:2022-MM-DD-$GIT_SHORT_HASH for example ghcr.io/hyperledger/cactus-chia-all-in-one:2021-01-08-7a055c3 (do not use the exact example tag of course)
  3. A packages/cactus-test-tooling/src/main/typescript/chia/chia-test-ledger.ts code file is added with a ChiaTestLedger class in it that is responsible for providing a start() method that takes care of launching
  4. A packages/cactus-plugin-ledger-connector-chia/src/main/typescript/plugin-ledger-connector-chia.ts file is added with a PluginLedgerConnectorChia class in it. This class uses the chia-js npm package under the hood to implement the connector's usual methods.
  5. The functionality of the connector is covered by the end to end tests mentioned earlier. The tests must be using the AIO image to simulate a production Chia ledger with reasonable accuracy.
  6. Web services are implemented so that the connector's functionality can be exposed via the network when the plugin is loaded into the Cactus API server.
  7. Tests are also covering (e.g. using) the generated API client class (for which you'll need to define the necessary request and response types and endpoints in a file at packages/cactus-plugin-ledger-connector-chia/src/main/json/openapi.json file.

Links, Tips, Useful Information

Most important tip: You should study the code of other - already working - connector plugins to see how they implement web services for example. A lot of the code is just boilerplate around the actual logic that translates Cactus API requests into RPC calls to the Chia ledger.

1 .There is a Typescript library facilitating RPC calls to Chia chains: https://www.npmjs.com/package/chia-js The latter should be used for the internal workings of the connector class to keep things simple (e.g. do not go down the rabbit hole of trying to use bindings from another language via IPC or other complex workarounds).

  1. Start with the connector plugin package's implementation by simply copy pasting one of the existing connectors and then find & replace the ledger name within that folder accordingly ($COPIED_LEDGER_NAME => chia)
  2. Double check that in packages/cactus-plugin-ledger-connector-chia/package.json the dependency versions to other Cactus packages are up to date and that the name of the package itself is also up to date.
kamalbuilds commented 2 years ago

Hi @petermetz I am interested to work on this Cactus Chia connector plugin project.

i-dipanshu commented 2 years ago

Hey @petermetz I'm Dipanshu.

I applied for this project through LFX mentorship. I'm excited.

I'm planning to utilize the meantime to understand the workflows of our community.

I'll also try to better understand the enhancements that we'll be making through this project.

Since I'm new to this project and open source in general

I was wondering if you could help me with some specific references to get started

I'd be really help me a lot.

OyePuru commented 2 years ago

Greetings Mentor @petermetz ,

I'm looking forward to working with you. I already sent my application through the LFX mentorships. Here's my email mandalpurushottam66@gmail.com

Thankyou Purushottam @oyepuru

xyzhang7 commented 2 years ago

Hi @petermetz, I am really interested in working on this issue. And I just applied on the LFX mentorships.

Thank you for your consideration. Xinyu xzhang0980@gmail.com

RajGM commented 1 year ago

Hi @petermetz While building the plugin and the pipeline, what are the essential tradeoffs we should keep in mind, and how can I measure the performance metric if it is working?

RajGM commented 1 year ago

Is there any communication channel apart from Github for this project?

RajGM commented 1 year ago

Found the discord link for the Hyperledger Foundation: https://discord.gg/invite/hyperledger

kamalbuilds commented 1 year ago

yes @RajGM you may clarify your doubt over there.

RajGM commented 1 year ago

Hi, @petermetz What is the base image we are going to use for the chai connector? Any particular port we want to expose services with? Are any particular node modules recommended to use apart from chai-js? Any particular chai test pattern?

RajGM commented 1 year ago

https://www.chia.net/ https://registry.hub.docker.com/r/chianetwork/chia-docker/tags https://github.com/Chia-Network/chia-blockchain

RajGM commented 1 year ago

Jumping to step 3 as https://github.com/Chia-Network/chia-docker resolves steps 1-2

RajGM commented 1 year ago

Looking at #1636 @petermetz