This project is designed to solve two information retrieval problems with the CyberConnect smart contract design. Firstly, it is difficult to obtain all ProfileIds
owned by a specific wallet address. Secondly, it is challenging to retrieve the collect information
set by the publisher when registering an essence on the middleware. Additionally, the CyberConnect API design is not very user-friendly, especially when integrating it into an SDK. It requires prior login verification, which is not ideal.
To address these issues, we have set up a backend that listens to contract events on both the BSC mainnet
and BSC Testnet
. The events monitored are CollectPaidMwSet
and CreateProfile
, and the information is stored in a MySQL database. The backend exposes an API that can be used by external clients to retrieve the stored information.
To install and run the project, follow these steps:
- Clone the repository
- Install the required dependencies using go get
- Set up a MySQL database and create the tables using the provided SQL script
- Set the environment variables for the database connection and the BSC node URL
- Run the project using go run main.go
The following endpoints are exposed by the backend:
- GET
/api/v1/{chainId}/profiles-info/{address}
: Retrieves all ProfileIds owned by the specified wallet address. - GET
/api/v1/{chainId}/collect-info/{profileId}/{essenceId}
: Retrieves the collect information set by the publisher when registering an essence on the middleware.
By setting up this backend, we have made it easier for developers to interact with the CyberConnect smart contract and retrieve the necessary information. If you have any questions or suggestions, please feel free to open an issue or submit a pull request.