A simple Python script to buy and sell tokens on Solana using Jupiter Exchange.
- Buy tokens with SOL
- Sell tokens for SOL
- USDC default option (just press Enter)
- Direct Jupiter integration
- No additional fees
- Install dependencies:
pip install requests python-dotenv solders- Create a
.envfile:
WALLET_PRIVATE_KEY=your_base58_private_key_here
RPC_URL=https://mainnet.helius-rpc.com/?api-key=your_helius_api_key- Sign up at helius.xyz (free tier available)
- Create a new project
- Copy your RPC URL from the dashboard
- Add it to your
.envfile
python swap_memecoin.pyFollow the prompts to:
- Choose buy or sell
- Enter token contract (or press Enter for USDC)
- Enter amount
- Python 3.7+
- Solana wallet with some SOL for fees
- Helius RPC endpoint (recommended)