tl;dr Streamline access to POKT Network's decentralized supply network.
The POKT Gateway Server is a comprehensive solution designed to simplify the integration of applications with POKT Network. Its goal is to reduce the complexities associated with directly interfacing with the protocol, making it accessible to a wide range of users, including application developers, existing centralized RPC platforms, and future gateway operators.
Learn more about the vision and overall architecture overview.
- Gateway Operator Quickstart Guide
- Docker Image Releases
- Docker Compose
- Minimum Hardware Requirements
- Database Migrations
- Unit Testing
- Generating DB Queries
- Contributing Guidelines
- Project Structure
To onboard the gateway server without having to dig deep, you can follow the Quick Onboarding Guide.
We have an abundance of information in the docs section:
- Gateway Server Overview
- Gateway Server API Endpoints
- Gateway Server System Architecture
- Gateway Server Node Selection
- POKT Primer
- POKT's Relay Specification
Every release candidate is published to gateway-server/pkgs/container/pocket-gateway-server.
There is an all-inclusive docker-compose file available for development docker-compose.yml
To run a Gateway Server, we recommend the following minimum hardware requirements:
- 1GB of RAM
- 1GB of storage
- 4 vCPUs+
In production, we have observed memory usage increase to 4GB+. The memory footprint will be dependent on the number of app stakes/chains staked and total traffic throughput.
Migrations are like version control for your database, allowing your team to define and share the application's database schema definition.
Before running a migration make sure to install the go lang migration cli on your machine. See golang-migrate/migrate/tree/master/cmd/migrate for reference.
./scripts/migration.sh -n {migration_name}
This command will generate a up and down migration in db_migrations
DB Migrations are applied upon server start, but as well, it can be applied manually through:
./scripts/migration.sh {--down or --up} {number_of_times}
-
To apply all migrations:
./scripts/migration.sh --up
-
To apply a specific number of migrations:
./scripts/migration.sh --up 2
Make sure to provide either the number of migrations to rollback or the --all
flag to rollback all migrations.
-
To roll back a specific number of migrations:
./scripts/migration.sh --down 2
-
To roll back all migrations:
./scripts/migration.sh --down --all
Install Mockery with
go install github.com/vektra/mockery/v2@v2.40.1
You can generate the mock files through:
./scripts/mockgen.sh
By running this command, it will generate the mock files in ./mocks
folder.
Reference for mocks can be found here.
Run this command to run tests:
go test -v -count=1 ./...
Gateway server uses PGGen to create autogenerated type-safe queries.
Queries are added inside queries.sql and re-generated via ./scripts/querygen.sh
.
- Create a Github Issue on the feature/issue you're working on.
- Fork the project
- Create new branch with
git checkout -b "branch_name"
where branch name describes the feature.- All branches should be based off
main
- All branches should be based off
- Write your code
- Make sure your code lints with
go fmt ./...
(This will Lint and Prettify) - Commit code to your branch and issue a pull request and wait for at least one review.
- Always ensure changes are rebased on top of main branch.
A partial high-level view of the code structure (generated)
.
├── cmd # Contains the entry point of the binaries
│ └── gateway_server # HTTP Server for serving requests
├── internal # Shared internal folder for all binaries
├── pkg # Distributable dependencies
└── scripts # Contains scripts for development
Generate via tree -L 2
Olshansky's stream of thought here: https://www.notion.so/buildwithgrove/Olshansky-PATH-Journal-dfc92813ca5945ac88035cca97ccbff5?pvs=4