SafeTrust is a decentralized platform designed to revolutionize P2P transactions, providing secure deposits and payments powered by blockchain and trustless technologies. πβ¨ Experience transparency and reliability in every cryptocurrency transaction. πΈπ
π Trustless Technology: Secure and block deposits without intermediaries.
πΎ Blockchain-Powered Transparency: Immutable, auditable, and verifiable transactions.
π± Crypto-Payment Support: Manage cryptocurrency payments safely and efficiently.
β
Automated Refunds: Streamlined processes ensure refunds and payment releases happen automatically.
π οΈ Trustless Escrow:
Funds are securely held in blockchain-based escrow accounts until all terms are met.
π Blockchain Transparency:
Every transaction is logged on the blockchain for full visibility and accountability. π
π° Crypto Payments:
Supports irreversible and secure cryptocurrency payments while reducing risks of fraud or disputes.
π Trustline Process:
Verified trustlines between parties add an extra layer of transaction security. π
π€ Automated Refund System:
Ensures funds are automatically released based on the terms of the agreement, with no manual intervention required.
| Tool | Version | Notes |
|---|---|---|
| Docker & Docker Compose | β₯ 24 | Required |
| Hasura CLI | β₯ 2.x | Required for migrations & seeds |
| curl | any | Used by health-check loop |
cp .env.example .env # fill in your values, then:
bin/dc_prep # starts all containers, runs migrations, seeds, and metadataOnce bin/dc_prep completes, open the Hasura console in a separate terminal:
bin/dc_prep performs the following steps automatically, in order:
| Step | Action |
|---|---|
| 1 | Start postgres, graphql-engine, and webhook via Docker Compose (waits for healthy) |
| 2 | Poll GET /healthz until Hasura is ready (up to 3 min) |
| 3 | Build and deploy tenant metadata for all tenants (metadata/setup-tenant.sh) |
| 4 | Apply all database migrations (hasura migrate apply) |
| 5 | Reload Hasura metadata |
| 6 | Apply seed data (hasura seed apply) |
Copy .env.example to .env and fill in the required values before running bin/dc_prep:
POSTGRES_PASSWORD=your_postgres_password
# Must be valid JSON with a minimum 32-character key for HS256
HASURA_GRAPHQL_JWT_SECRET={"type":"HS256","key":"replace-with-min-32-char-secret-here"}
HASURA_EVENT_SECRET=your_event_secretWindows users: Run
bin/dc_prepandbin/dc_consoleinside WSL (Ubuntu) or Git Bash, as they are Bash scripts targeting a Linux container environment.
The metadata/ folder contains the Hasura GraphQL Engine configuration per tenant.
backend/
βββ metadata/
βββ base/
β βββ actions.graphql
β βββ actions.yaml
β βββ allow_list.yaml
β βββ api_limits.yaml
β βββ backend_configs.yaml
β βββ cron_triggers.yaml
β βββ graphql_schema_introspection.yaml
β βββ inherited_roles.yaml
β βββ metrics_config.yaml
β βββ network.yaml
β βββ opentelemetry.yaml
β βββ query_collections.yaml
β βββ remote_schemas.yaml
β βββ rest_endpoints.yaml
β βββ version.yaml
βββ build/
β βββ tenant_a/
β βββ tenant_b/
β βββ ...
βββ tenants/
β βββ safetrust/
β β βββ databases/
β β βββ tables/
β β βββ functions/
β β βββ databases.yaml
β βββ hotel_industry/
β βββ databases/
β βββ tables/
β βββ functions/
β βββ databases.yaml
βββ build-metadata.sh
βββ deploy-tenant.sh
βββ setup-tenant.sh
Folder guide:
base/β Hasura base configuration and GraphQL dependencies shared across all tenantsbuild/β Generated output: tenants merged with base dependencies, ready to deploytenants/β Tenant-specific database files, tables, functions, relations, and triggersbuild-metadata.shβ Prepares a tenant by merging it with base configurationsdeploy-tenant.shβ Deploys a built tenant to Hasura (tracks tables and relationships)setup-tenant.shβ Runs both steps above in one command β
Tip:
bin/dc_prephandles metadata setup automatically. Use the steps below only for targeted tenant work.
cd metadata
./setup-tenant.sh <tenant_name> [--admin-secret SECRET] [--endpoint URL]Example:
./setup-tenant.sh safetrust --endpoint http://localhost:8080Default values: --admin-secret myadminsecretkey Β· --endpoint http://localhost:8080
- Build the tenant:
./build-metadata.sh <tenant_name> --admin-secret myadminsecretkey --endpoint <endpoint>-
Verify the
build/folder contains the correct tenant data. -
Deploy the tenant:
./deploy-tenant.sh <tenant_name> --admin-secret myadminsecretkey --endpoint <endpoint>Tip:
bin/dc_prephandles migrations automatically. Use the manual steps below only for targeted work.
From the project root:
hasura migrate apply \
--database-name safetrust \
--endpoint http://localhost:8080 \
--admin-secret myadminsecretkeyTo apply a single version:
hasura migrate apply \
--database-name safetrust \
--version <timestamp> \
--type upTip:
bin/dc_prepapplies seeds automatically. Use the manual step below when you need to re-seed.
From the project root:
hasura seed apply \
--database-name safetrust \
--endpoint http://localhost:8080 \
--admin-secret myadminsecretkeyThis project uses the Karate framework for API testing. Tests run in a Docker environment.
docker compose -f docker-compose-test.yml run --rm --build karateThis command will:
- Build the test container
- Start PostgreSQL and Hasura containers
- Run all Karate tests
- Show test results in the console
- Generate HTML reports in
target/karate-reports/
After running the tests, find the HTML reports at:
- Summary:
tests/results/karate-summary.html - Detailed:
tests/results/karate-tags.html
- Create new
.featurefiles intests/karate/features/ - Follow the Karate DSL syntax
- Tests are automatically picked up when running the test command
- Main config:
tests/karate/src/test/resources/karate-config.js - Database config:
docker-compose-test.yml - Test environment:
Dockerfile.test