Skip to content

A simple but secure implementation of a crypto payments gateway, built using Golang (WIP 🚧)

License

Notifications You must be signed in to change notification settings

mateitudose/crype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crype

A simple but secure crypto payments gateway, built with Golang.

Features

  • gRPC API for creating and managing crypto payment orders
  • PostgreSQL database for order and payment address storage
  • Blockchain wallet generation (currently supports USDC on Base)
  • Dockerized development environment
  • Code generation for database models (Jet) and gRPC (Protobuf)

Project Structure

  • server/ - Main gRPC server implementation
  • api/proto/ - Protobuf definitions for gRPC services
  • api/gen_proto/ - Generated Go code from Protobuf
  • api/gen_jet/ - Generated database models and queries (Jet)
  • client/ - (Placeholder for client code)
  • utils/ - Utilities for blockchain and database
  • sql/ - Database schema
  • scripts/ - Helper scripts for code and DB generation

Getting Started

Prerequisites

  • Go 1.24+
  • Docker & Docker Compose
  • Jet CLI (for DB codegen)
  • protoc (for gRPC codegen)

Setup

  1. Copy .env.example to .env and fill in your environment variables.
  2. Start the database:
    docker compose up -d
  3. Generate database models (Jet):
    ./scripts/generate_jet.sh
  4. Generate gRPC code:
    ./scripts/generate_proto.sh
  5. Run the server:
    go run main.go

API

  • gRPC endpoint: localhost:8080
  • Service: OrderService
    • CreateOrder(amount, currency) → returns order ID, payment address, timestamps
    • CheckOrderStatus(id) → streaming response with order status updates and transaction hash

Both endpoints are fully implemented with database integration. The CheckOrderStatus endpoint provides real-time updates on payment status through server-side streaming.

See api/proto/order.proto for complete API definitions and server/order_service.go for implementation details of the OrderService.

Database

  • PostgreSQL, schema auto-initialized from sql/schema.sql
  • Tables:
    • orders - Stores order information including status and transaction hash
    • payment_addresses - Securely stores cryptocurrency addresses and private keys (planning to also implement additional protection of the private keys, such as encryption using KMS)

Blockchain

  • Wallets generated for supported currencies (see utils/blockchain.go)
  • Currently supports: USDC_BASE (USD Coin on Base network)

Development

  • Use the provided scripts in scripts/ for code generation and DB management.
  • To reset the database:
    ./scripts/redeploy_db.sh

License

MIT

About

A simple but secure implementation of a crypto payments gateway, built using Golang (WIP 🚧)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •