A comprehensive token platform built on Solana using the Token-2022 protocol.
Features • Architecture • Installation • Usage • Development • Deployment • Security • License
VCoin provides an all-in-one solution for creating and managing tokens on the Solana blockchain using the powerful Token-2022 program:
- Token-2022 Integration: Full support for Solana's next-generation token program
- Built-in Transfer Fees: Configure and collect transfer fees on token transactions
- Custom Metadata Management: Create and update token metadata through a custom implementation
- Presale Management: Handle the entire presale process with configurable parameters
- Vesting Schedule: Manage token vesting schedules for team, investors, and partners
- Authority Controls: Role-based permissions and authority transfer functionality
VCoin consists of two main components:
The on-chain program is written in Rust and handles all token operations:
program/
├── src/ # Smart contract source files
│ ├── lib.rs # Main entry point for the program
│ ├── entrypoint.rs # Contract entrypoint
│ ├── instruction.rs # Instruction definitions
│ ├── processor.rs # Instruction processing logic
│ ├── state.rs # On-chain data structures
│ └── error.rs # Error definitions
├── Cargo.toml # Rust dependencies
└── tests/ # Program tests
The off-chain client is written in TypeScript and provides a user-friendly interface:
src/
├── create-token.ts # Token creation functionality
├── presale.ts # Presale management
├── vesting.ts # Vesting schedule management
├── update-metadata.ts # Token metadata update functionality
├── allocate-token.ts # Token allocation functionality
├── authority-controls.ts # Authority management
├── upgrade-governance.ts # Governance functionality
├── token2022-client.ts # Token-2022 specific client
└── utils.ts # Shared utilities
- Solana CLI v1.16.23 or later
- Node.js v16 or later
- Rust and Cargo
- Clone the repository:
git clone https://github.com/yourusername/vcoin.git
cd vcoin- Install dependencies:
npm install- Configure environment:
cp .env.example .env
# Edit .env with your settingsCreate a new SPL Token-2022 token with metadata and transfer fees:
npm run create-tokenThis interactive process will:
- Generate or use an existing keypair for token authority
- Configure token name, symbol, and decimals
- Set initial supply and metadata URI
- Configure transfer fees (basis points and maximum fee amount)
- Create the token on the Solana blockchain using the Token-2022 program
Set or update transfer fees for your token:
npm run authority -- --set-transfer-feeYou can configure:
- Fee basis points (e.g., 100 = 1%)
- Maximum fee amount
- Fee authority (who can change fees)
- Withdraw authority (who can withdraw collected fees)
Set up and manage a token presale:
npm run presaleConfigure parameters including:
- Token price
- Presale timeframe (start and end dates)
- Hard cap and soft cap
- Minimum and maximum purchase amounts
Create and manage token vesting schedules:
npm run vestingFeatures include:
- Configure vesting start time
- Set release interval and number of releases
- Add multiple beneficiaries
- Release vested tokens according to schedule
Modify token information:
npm run update-metadataUpdate:
- Token name
- Token symbol
- Metadata URI
Control token permissions:
npm run authorityFunctions:
- Transfer token authority
- Set fee authority
- Manage multisig authorities
VCoin uses a secure configuration management system to protect critical settings:
# Initialize authority configuration
npm run authority:init
# Check configuration integrity and version
npm run authority:check
# Upgrade configuration to latest version
npm run authority:upgrade
# Create secure backup of configuration
npm run authority:backupKey security features:
- Mandatory signature verification: All configuration files are cryptographically signed
- Version control: Configuration files include version tracking for safe upgrades
- Production safeguards: Enhanced security checks in production environments
- Backup mechanism: Securely create and restore configuration backups
- Role-based access: Configuration changes require proper authority verification
- Start a local Solana validator:
solana-test-validator- Configure for local development:
solana config set --url localhost- Build the program:
cd program
cargo build- Deploy locally:
solana program deploy target/deploy/vcoin_program.so- Run client in development mode:
cd ..
npm run startRun the test suites:
# Run all tests
npm run test:all
# Run specific test suites
npm run test:unit # Unit tests
npm run test:integration # Integration tests
npm run test:security # Security-focused tests
npm run test:e2e # End-to-end tests
# Run program tests
cd program
cargo testFor testing in a live environment:
# Configure for Devnet
solana config set --url devnet
# Ensure you have SOL for deployment
solana balance
# Airdrop if needed
solana airdrop 1
# Build and deploy
cd program
cargo build --release
solana program deploy target/release/libvcoin_program.soFor production deployment:
# Configure for Mainnet
solana config set --url mainnet-beta
# Verify you have SOL for deployment
solana balance
# Build and deploy
cd program
cargo build --release
solana program deploy target/release/libvcoin_program.soAlternatively, use the deployment script:
node deployment/deploy_local.js| Instruction | Description | Required Accounts |
|---|---|---|
InitializeToken |
Creates a new SPL Token-2022 with metadata and transfer fee | Authority, Mint, TokenProgram, SystemProgram, Rent, Metadata |
SetTransferFee |
Updates token transfer fee configuration | Authority, Mint, TokenProgram |
| Instruction | Description | Required Accounts |
|---|---|---|
InitializePresale |
Sets up a token presale | Authority, PresaleState, Mint, Treasury, SystemProgram, Rent |
BuyTokens |
Purchases tokens during presale | Buyer, PresaleState, Mint, BuyerATA, Authority, TokenProgram, SystemProgram, Treasury, Clock |
InitializeVesting |
Creates a vesting schedule | Authority, VestingState, Mint, SystemProgram, Rent |
AddVestingBeneficiary |
Adds vesting recipient | Authority, VestingState |
ReleaseVestedTokens |
Releases tokens per schedule | Authority, VestingState, Mint, BeneficiaryATA, TokenProgram, Clock |
UpdateTokenMetadata |
Updates token metadata | Authority, Metadata, Mint, TokenProgram |
EndPresale |
Finalizes a presale | Authority, PresaleState |
- Never share private keys or seed phrases
- Always review transactions before signing
- Use hardware wallets for production deployments
- Follow the principle of least privilege for authorities
- Test thoroughly on Devnet before Mainnet deployment
- Authority Controls: Separate authorities for different operations (mint, freeze, transfer fee)
- Input Validation: Bounds checking on all numeric inputs
- Arithmetic Safety: Checked math operations to prevent overflows
- Access Control: Account ownership verification and signature requirements
- Token-2022 Security: Leveraging the robust security features of the Token-2022 program
- Solana Program Version: 1.16.23
- SPL Token-2022 Version: 0.9.0
- Borsh Version: 0.10.3
- Programming Languages: Rust (program), TypeScript (client)
- Testing Frameworks: Rust unit tests, Jest for client tests
VCoin is actively developed with ongoing improvements and feature additions. Core functionality is implemented and tested, including Token-2022 integration with transfer fees, presale management, vesting schedules, metadata updates, and authority controls.
- Enhanced governance mechanisms
- Staking functionality
- Integration with additional DeFi protocols
- Mobile wallet support
- Analytics dashboard for token metrics
Contributions are welcome! Please see CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the ISC License - see the LICENSE file for details.
- Solana Labs for the Solana blockchain platform
- The SPL Token-2022 program developers
- All contributors to this project
Program ID: 9ZskGH6R3iVYPeQMf1XiANgDZQHNMUvZgAC8Xxxj7zae
Contact: [Your Contact Information]
This README provides instructions for deploying and running VCoin in a production environment.
- Node.js: Version 16.x or higher
- Solana CLI: Latest stable version
- Environment: A secure Linux server with proper firewall configuration
- Network: Production deployment should target Solana mainnet-beta
- Hardware: Recommended minimum 4GB RAM, 2 CPU cores, 50GB SSD
Create a .env file with the following required configuration:
# Network Configuration
SOLANA_NETWORK=mainnet-beta
NODE_ENV=production
# Security Configuration
KEYPAIR_PASSWORD=your-secure-password-minimum-16-chars
# Authority-specific passwords (optional but recommended for multiple keypairs)
KEYPAIR_PASSWORD_AUTHORITY=your-secure-authority-password
KEYPAIR_PASSWORD_PRESALE=your-secure-presale-password
KEYPAIR_PASSWORD_VESTING=your-secure-vesting-password
Ensure proper file permissions:
# Secure the .env file
chmod 600 .env
# Secure the keypairs directory
chmod 700 keypairsnpm install --productionnpm run buildnpm run authority:initnpm run create-tokennpm run allocate-tokenAll scripts are configured to run in production mode by default. For example:
# Start the main application
npm start
# Run presale operations
npm run presale [command]
# Manage authority
npm run authority [command]
# Manage upgrade governance
npm run upgrade [command]Regularly back up your configuration files and keypairs:
# Back up authority configuration
npm run authority:backup
# Back up upgrade governance (manually)
cp upgrade-governance.json upgrade-governance.backup-$(date +%Y%m%d).json- Keypair Security: Never expose your keypair files. They should be securely encrypted.
- Regular Audits: Check audit logs regularly to detect unauthorized operations.
- Permission Controls: Ensure all files maintain secure permissions.
- Multi-Signature: Use multi-signature operations for critical actions.
- Monitoring: Implement monitoring for critical operations.
If you encounter issues in production:
- Check log files for errors
- Verify environment variables are correctly set
- Ensure file permissions are secure
- Validate signature verification is working correctly
- Confirm network connectivity to Solana
For production support, contact:
- Email: support@vcoin-example.com
- Security team: security@vcoin-example.com