Documentation Index
Fetch the complete documentation index at: https://docs.inco.org/llms.txt
Use this file to discover all available pages before exploring further.
Setup
This guide walks through setting up the Private Raffle project.
Prerequisites
| Tool | Version |
|---|
| Rust | Latest stable |
| Solana CLI | 1.18+ |
| Anchor | 0.31.1 |
| Node.js | 18+ |
Clone the Project
git clone https://github.com/Inco-fhevm/raffle-example-solana.git
cd raffle-example-solana
Install Dependencies
Project Structure
private-raffle/
├── programs/
│ └── private-lottery/
│ └── src/
│ ├── lib.rs # Program entry point
│ ├── constants.rs # Inco Lightning program ID
│ ├── error.rs # Custom errors
│ ├── state/
│ │ └── mod.rs # Account structures
│ └── instructions/
│ ├── create_lottery.rs
│ ├── buy_ticket.rs
│ ├── draw_winner.rs
│ ├── check_winner.rs
│ ├── claim_prize.rs
│ └── withdraw_prize.rs
├── tests/
│ └── private-lottery.ts # Integration tests
├── Anchor.toml
└── package.json
Anchor.toml
[toolchain]
package_manager = "yarn"
[features]
resolution = true
skip-lint = false
[programs.devnet]
private_lottery = "BoGG6xcmbV8HpsEA2qHs6pNUS5h5SfmNRvekf2g17PjB"
[provider]
cluster = "devnet"
wallet = "~/.config/solana/id.json"
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
Cargo.toml (Program)
[package]
name = "private-lottery"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
name = "private_lottery"
[dependencies]
anchor-lang = { version = "0.31.1", features = ["init-if-needed"] }
inco-lightning = { version = "0.1.4", features = ["cpi"] }
package.json
{
"dependencies": {
"@coral-xyz/anchor": "^0.31.1",
"@inco/solana-sdk": "^0.0.2",
"tweetnacl": "^1.0.3"
},
"devDependencies": {
"ts-mocha": "^10.0.0",
"typescript": "^5.7.3"
}
}
Build and Deploy
# Build the program
anchor build
# Get your program ID
solana address -k target/deploy/private_lottery-keypair.json
# Update program ID in Anchor.toml and lib.rs
# Then rebuild
anchor build
# Deploy to devnet
anchor deploy --provider.cluster devnet
Run Tests
anchor test --provider.cluster devnet
Next Steps
Learn about the Program instructions and account structures.