English | Português
Decentralized copy trading platform on Solana blockchain enabling automated trade replication from expert traders to followers with secure on-chain delegation.
This project consists of:
- Solana programs (on-chain) built with the Anchor framework
- Off-chain service built with Node.js/TypeScript and Express
- Integration with AWS services (SNS, SQS)
- Integration with Jupiter aggregator
- Docker support for containerization
programs/: Contains Solana programs (smart contracts)off-chain/: Contains off-chain service code, including web APItests/: Tests for programs and servicesmigrations/: Migration scripts (if any)Anchor.toml: Anchor framework configurationCargo.toml: Rust dependencies for Solana programspackage.json: Node.js dependencies for off-chain service and scriptsDockerfile: Docker image definition for the applicationdocker-compose.yml: Docker services definitionsetup-ec2.sh: EC2 instance setup script
- Rust
- Node.js (version 18+)
- Yarn or npm
- Solana CLI
- Anchor CLI
- Docker (optional, for containerization)
-
Clone the repository:
git clone <REPOSITORY_URL> cd p2a
-
Install Rust dependencies (for on-chain programs):
# Navigate to program directory if needed # cargo build
-
Install Node.js dependencies (for off-chain service):
yarn install # or # npm install
-
Configure environment variables: Create a
.envfile in the project root or in theoff-chain/directory and add the necessary variables (e.g., API keys, endpoints, etc.). Example:SOLANA_CLUSTER_URL=https://api.devnet.solana.com AWS_ACCESS_KEY_ID=your_access_key AWS_SECRET_ACCESS_KEY=your_secret_key AWS_REGION=your_region # Other variables...
-
On-chain Programs (Anchor):
anchor build
-
Off-chain Service (TypeScript): (Usually no explicit build step when using
ts-node, but if you transpile to JS, add the command here)# Example: yarn build
- On-chain Program Tests (Anchor):
or
anchor testyarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts
yarn startThis will start the web server (usually at http://localhost:PORT, check the code in off-chain/src/web/tracking-wallet/routes-v1.ts for the port).
-
Configure the provider and wallet in
Anchor.toml:[provider] cluster = "devnet" # or "mainnet-beta", "testnet" wallet = "/path/to/your/wallet.json"
-
Deploy:
anchor deploy
To build and run the application using Docker:
docker-compose up --build(Check docker-compose.yml for service names and configurations)
- Trader Management: Initialize and manage trader accounts with permissions
- Follower System: Add followers to traders and manage relationships
- Deposit & Apports: Handle user deposits and investment allocations
- Swap Delegation: Delegate swap authority via PDA (Program Derived Address)
- Execute Swaps: Automated trade execution replicating trader actions
- SOL Transfers: Secure on-chain SOL transfer functionality
- Wallet Tracking: Real-time monitoring of trader wallet activities
- Event Processing: AWS SNS/SQS integration for event-driven architecture
- Trade Token Service: Token trading operations and management
- Transaction Processor: Process and validate blockchain transactions
- Smart Contract Service: Interface for interacting with on-chain programs
- Web API: RESTful API for client applications
Blockchain:
- Solana
- Anchor Framework
- Rust
- Jupiter Aggregator
Backend:
- Node.js / TypeScript
- Express.js
- Helius SDK
Cloud & DevOps:
- AWS (SNS, SQS)
- Docker
- EC2
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests. (You will need to create this file)
This project is licensed under the ISC License - see the LICENSE file for details. (Check package.json for the license, which is ISC. You may want to create a LICENSE file with the ISC license text).
9uWnELB4ExQ4HY4YhSPb6pkGchaLCzty1BryX8w5xqVu
Deployed on Solana Devnet