ContextCoin (CTX) is a Solana-based token designed to provide a secure and scalable solution for accessing resources within the Model Context Protocol (MCP) ecosystem. This token facilitates micro-payments for resource access, effectively preventing spam and DDoS attacks, while encouraging a thriving, decentralized economy.
This project introduces a novel way to use blockchain technology to manage access to resources within the MCP ecosystem. By requiring nominal payments for each resource access request using CTX tokens, we create a cost barrier that discourages malicious activities and aligns incentives for both resource providers and consumers.
Key Features:
Clone the repository:
bash
git clone <repository-url>
cd contextcoin
Build the smart contract:
bash
cargo build-bpf --target bpfel-unknown-unknown --release
Generate a new keypair for your program:
bash
solana-keygen new -o ./program-keypair.json
2. Deploy the smart contract:
bash
solana program deploy target/bpfel-unknown-unknown/release/contextcoin.so --keypair ./program-keypair.json
Note: Replace <your-program-id> with the output of the solana program deploy command.
Update the src/client.rs with your program id:
rust
let program_id = Pubkey::from_str("YourProgramIdHere").expect("Invalid Program ID"); // Replace with your program ID
Run the client:
bash
cargo run --package contextcoin --bin client
This client will showcase the basic functionality of the program, allowing you to initialize the ICO, simulate buying and selling, withdraw from the escrow, and create / access resources.
The smart contract is written in Rust and leverages the Solana program library. It provides the following functionality:
ICO Initialization: Sets up the initial state for token distribution and pricing.
Token Purchasing: Allows users to buy CTX tokens using SOL, while adhering to the configured bonding curve.
Token Selling: Allows users to sell back CTX tokens, receiving SOL.
Withdraw Funds: Allows the owner of the ICO to withdraw the accumulated SOL from the escrow.
Resource Creation: Enables MCP resource providers to register their resources and set access fees.
Resource Access: Facilitates pay-per-access to resources, rewarding resource providers and preventing malicious attacks.
src/lib.rs: Main smart contract entry point.
src/state.rs: Data structures (ICO state, resource state).
src/error.rs: Custom error types.
src/instruction.rs: Instruction data formats.
src/processor.rs: Instruction processing logic.
src/client.rs: Basic client implementation showcasing how to interact with the smart contracts.
We welcome contributions to this project! If you have ideas, bug fixes, or feature requests, please submit a pull request or open an issue on GitHub.
This project is provided as-is and is for educational and experimental purposes. Please use it responsibly and do your own due diligence before making any financial decisions. No guarantees are made about the security or stability of the system.
This project is licensed under the MIT-0 License - see the file for details.