本项目基于Go进行开发,主要用于对InkFinance Governance Module进行数据支持。
其主要实现:
- Web3.0账号与Social账户绑定
- InkFinance不同的合约(包括不限于派生出来的DAO|Committee|Proposal)事件监听及数据关联
- 链上数据中心化统一存储查询功能
- 特定业务场景下的接口工具(比如限制某些操作等判断)
- chain 扫链业务代码,通过与
- conf 数据库配置及初始化
- constant 系统中常量的定义
- httprouter 接口路由定义
- request 请求数据定义
- scripts 脚本(数据库)
- service 接口定义及实现
- cmd 基于GORM的数据库对象生成脚本
- dal 自动生成的数据库操作对象及数据模型
- transport 服务接口与Handler绑定的定义
- 安装go (建议安装:1.18)
- 克隆本项目git仓库
- 安装MySQL数据库
- 执行初始化脚本
- 进入到项目根目录,找到./scripts/db_inkfinance_init.sql 在第3步安装到MySQL执行脚步初始化数据库及相关表结构
- 执行监听链任务的脚本
- 进入到项目根目录,找到./scripts/init_scan_task.sql 执行脚步(确保在第4步执行完成后执行)
- 配置环境文件
- 基于项目根目录第config-[env].yml, 把[env]替换为相关的执行环境,并且把文件内的MySQL 以及区块链RPC访问配置为需要的链接
- 指定配置文件启动项目
- 全部配置完成后,在项目根目录执行:go run main [env],即开始扫链,同时根据接口返回对应的链上事件抛出的加工后的数据来满足查询需求。
This project is based on Golang. It supports INK Governance Module with the searching of on-chain data, to improve the frontend system's performance.
It's mainly achieved:
- Social media account binding.
- Automatic monitoring of the events generated by different contracts(e.g., DAO/Committee/Proposal), and building relations between those events.
- High-performance and centralized data query services.
- Special case tools for frontend user process control.
- /chain blockchain event scanning
- /conf database configuration and initialization
- /constant constants of the system
- /httprouter router definitions
- /request request definitions
- /scripts database scripts(initialize database)
- /service business logic implements.
- /cmd scripts to generate database model and data access object
- /dal auto-generated database models and data access object
- /transport service definitions and handler
- install Go (suggest 1.18)
- clone this project
- install MySQL database(suggest ^5.6)
- initialize database scripts; the script is located in ./scripts/db_inkfinance_init.sql
- run ./scripts/init_scan_task.sql to initialize the scanning task(make sure the 4th step runs successfully)
- update configuration: find the config-[env].yml file and replace [env] as any environment you want(e.g., dev/prd/test/), and update the MySQL connection and blockchain RPC service.
- once all the previous steps are done, go to the root folder of the project and run: go run main [env](the [evn] is what you named in the step 6)
- Enjoy!