solforge 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +323 -364
- package/cli.cjs +126 -69
- package/package.json +1 -1
- package/scripts/install.sh +112 -0
- package/scripts/postinstall.cjs +66 -58
- package/server/methods/program/get-token-accounts-by-owner.ts +7 -2
- package/server/ws-server.ts +4 -1
- package/src/api-server-entry.ts +91 -91
- package/src/cli/commands/rpc-start.ts +4 -1
- package/src/cli/main.ts +39 -14
- package/src/cli/run-solforge.ts +20 -6
- package/src/commands/add-program.ts +324 -328
- package/src/commands/init.ts +106 -106
- package/src/commands/list.ts +125 -125
- package/src/commands/mint.ts +246 -246
- package/src/commands/start.ts +834 -831
- package/src/commands/status.ts +80 -80
- package/src/commands/stop.ts +381 -382
- package/src/config/manager.ts +149 -149
- package/src/gui/public/app.css +1556 -1
- package/src/gui/public/build/main.css +1569 -1
- package/src/gui/server.ts +20 -21
- package/src/gui/src/app.tsx +56 -37
- package/src/gui/src/components/airdrop-mint-form.tsx +17 -11
- package/src/gui/src/components/clone-program-modal.tsx +6 -6
- package/src/gui/src/components/clone-token-modal.tsx +7 -7
- package/src/gui/src/components/modal.tsx +13 -11
- package/src/gui/src/components/programs-panel.tsx +27 -15
- package/src/gui/src/components/status-panel.tsx +31 -17
- package/src/gui/src/components/tokens-panel.tsx +25 -19
- package/src/gui/src/index.css +491 -463
- package/src/index.ts +161 -146
- package/src/rpc/start.ts +1 -1
- package/src/services/api-server.ts +470 -473
- package/src/services/port-manager.ts +167 -167
- package/src/services/process-registry.ts +143 -143
- package/src/services/program-cloner.ts +312 -312
- package/src/services/token-cloner.ts +799 -797
- package/src/services/validator.ts +288 -288
- package/src/types/config.ts +71 -71
- package/src/utils/shell.ts +75 -75
- package/src/utils/token-loader.ts +77 -77
package/README.md
CHANGED
|
@@ -1,523 +1,482 @@
|
|
|
1
|
-
# SolForge
|
|
1
|
+
# 🔥 SolForge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Lightning-fast Solana localnet for developers** ⚡
|
|
4
|
+
> Drop-in replacement for `solana-test-validator` with sub-second startup and minimal memory footprint.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
| ----------------- | --------------------- | ---------------- |
|
|
9
|
-
| **Startup Time** | 10-30 seconds | < 1 second |
|
|
10
|
-
| **Memory Usage** | 500MB+ | ~50MB |
|
|
11
|
-
| **Configuration** | Complex setup | Zero config |
|
|
12
|
-
| **Airdrops** | Rate limited | Unlimited |
|
|
13
|
-
| **Database** | Full ledger | Ephemeral SQLite |
|
|
6
|
+
[](https://github.com/nitishxyz/solforge)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://github.com/litesvm/litesvm)
|
|
14
9
|
|
|
15
10
|
## ✨ Features
|
|
16
11
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
- 🖥️ **Built-in GUI dashboard** for airdrops, mints, and asset management
|
|
25
|
-
- 🎯 **CLI tools** for tokens, programs, and accounts
|
|
12
|
+
- **⚡ Blazing Fast**: Sub-second startup, ~50MB memory (vs 500MB+ for test-validator)
|
|
13
|
+
- **🔌 Drop-in Compatible**: Works with Solana CLI, Anchor, web3.js, and @solana/kit
|
|
14
|
+
- **💰 Unlimited Airdrops**: Built-in faucet with no rate limits
|
|
15
|
+
- **🎨 Web GUI**: Interactive dashboard for airdrops, minting, and monitoring
|
|
16
|
+
- **📦 Program Cloning**: Import programs and accounts from mainnet
|
|
17
|
+
- **🔄 WebSocket Support**: Real-time transaction subscriptions (in the works)
|
|
18
|
+
|
|
26
19
|
|
|
27
|
-
##
|
|
20
|
+
## 🚀 Quick Install
|
|
28
21
|
|
|
29
|
-
###
|
|
22
|
+
### One-Liner Install (Recommended)
|
|
30
23
|
|
|
31
24
|
```bash
|
|
32
|
-
|
|
33
|
-
git clone https://github.com/nitishxyz/solforge
|
|
34
|
-
cd solforge
|
|
35
|
-
bun install
|
|
36
|
-
|
|
37
|
-
# Start the server
|
|
38
|
-
bun start
|
|
39
|
-
# or with debug logging
|
|
40
|
-
DEBUG_RPC_LOG=1 bun start
|
|
25
|
+
curl -fsSL https://install.solforge.sh | sh
|
|
41
26
|
```
|
|
42
27
|
|
|
43
|
-
###
|
|
28
|
+
### Manual Install
|
|
44
29
|
|
|
45
|
-
|
|
46
|
-
# Download and run
|
|
47
|
-
curl -L https://github.com/nitishxyz/solforge/releases/latest/download/solforge-$(uname -s)-$(uname -m) -o solforge
|
|
48
|
-
chmod +x solforge
|
|
49
|
-
./solforge # first run guides you through setup
|
|
50
|
-
```
|
|
30
|
+
Download the latest binary from [GitHub Releases](https://github.com/nitishxyz/solforge/releases) and add to your PATH.
|
|
51
31
|
|
|
52
|
-
###
|
|
32
|
+
### NPM/Bun Install
|
|
53
33
|
|
|
54
34
|
```bash
|
|
55
|
-
#
|
|
56
|
-
|
|
57
|
-
|
|
35
|
+
# Using npm
|
|
36
|
+
npm install -g solforge
|
|
37
|
+
|
|
38
|
+
# Using bun
|
|
39
|
+
bun install -g solforge
|
|
58
40
|
```
|
|
59
41
|
|
|
60
|
-
## 🎯
|
|
42
|
+
## 🎯 Quick Start
|
|
61
43
|
|
|
62
|
-
###
|
|
44
|
+
### 1️⃣ Start the Localnet
|
|
63
45
|
|
|
64
46
|
```bash
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
solforge
|
|
48
|
+
```
|
|
67
49
|
|
|
68
|
-
|
|
69
|
-
solana airdrop 1000
|
|
50
|
+
This starts:
|
|
70
51
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
- 🌐 **RPC Server**: `http://127.0.0.1:8899`
|
|
53
|
+
- 📡 **WebSocket**: `ws://127.0.0.1:8900`
|
|
54
|
+
- 🎨 **Web GUI**: `http://127.0.0.1:42069`
|
|
74
55
|
|
|
75
|
-
###
|
|
56
|
+
### 2️⃣ Configure Solana CLI
|
|
76
57
|
|
|
77
|
-
```
|
|
78
|
-
|
|
58
|
+
```bash
|
|
59
|
+
solana config set -u http://127.0.0.1:8899
|
|
60
|
+
```
|
|
79
61
|
|
|
80
|
-
|
|
62
|
+
### 3️⃣ Get Some SOL
|
|
81
63
|
|
|
82
|
-
|
|
83
|
-
|
|
64
|
+
```bash
|
|
65
|
+
# Using Solana CLI
|
|
66
|
+
solana airdrop 1000
|
|
84
67
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.requestAirdrop(
|
|
88
|
-
address,
|
|
89
|
-
lamports(1_000_000_000n), // 1 SOL
|
|
90
|
-
)
|
|
91
|
-
.send();
|
|
68
|
+
# Using SolForge CLI
|
|
69
|
+
solforge airdrop --to <PUBKEY> --sol 100
|
|
92
70
|
```
|
|
93
71
|
|
|
94
|
-
|
|
72
|
+
## 📚 Command Reference
|
|
95
73
|
|
|
96
|
-
|
|
97
|
-
import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
|
|
74
|
+
### 🔧 Server Commands
|
|
98
75
|
|
|
99
|
-
|
|
76
|
+
#### Start Server
|
|
100
77
|
|
|
101
|
-
|
|
102
|
-
|
|
78
|
+
```bash
|
|
79
|
+
# Basic start
|
|
80
|
+
solforge start
|
|
103
81
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
```
|
|
82
|
+
# Custom ports
|
|
83
|
+
solforge start --port 8899 --ws-port 8900
|
|
107
84
|
|
|
108
|
-
|
|
85
|
+
# Bind to 0.0.0.0 for LAN access
|
|
86
|
+
solforge start --network
|
|
87
|
+
```
|
|
109
88
|
|
|
110
|
-
|
|
111
|
-
// anchor.toml - use default settings
|
|
112
|
-
[provider]
|
|
113
|
-
cluster = \"http://127.0.0.1:8899\"
|
|
114
|
-
wallet = \"~/.config/solana/id.json\"
|
|
89
|
+
### 💰 Airdrop Commands
|
|
115
90
|
|
|
116
|
-
|
|
117
|
-
anchor build
|
|
118
|
-
anchor deploy
|
|
119
|
-
anchor test --skip-local-validator # SolForge is already running
|
|
120
|
-
```
|
|
91
|
+
#### Send SOL
|
|
121
92
|
|
|
122
|
-
|
|
93
|
+
```bash
|
|
94
|
+
# Airdrop to specific address
|
|
95
|
+
solforge airdrop --to <PUBKEY> --sol 100
|
|
123
96
|
|
|
124
|
-
|
|
97
|
+
# Interactive mode
|
|
98
|
+
solforge airdrop
|
|
99
|
+
```
|
|
125
100
|
|
|
126
|
-
|
|
127
|
-
- Live RPC metrics (slot, block height, transaction count, blockhash, faucet balance).
|
|
128
|
-
- Tables of cloned programs and token mints with one-click modals to import additional assets.
|
|
101
|
+
### 🪙 Token Commands
|
|
129
102
|
|
|
130
|
-
|
|
103
|
+
#### Create Token
|
|
131
104
|
|
|
132
105
|
```bash
|
|
133
|
-
#
|
|
134
|
-
|
|
106
|
+
# Interactive token creation
|
|
107
|
+
solforge mint
|
|
135
108
|
|
|
136
|
-
#
|
|
137
|
-
|
|
109
|
+
# Create new token
|
|
110
|
+
solforge token create --decimals 9 --supply 1000000
|
|
138
111
|
|
|
139
|
-
#
|
|
140
|
-
|
|
141
|
-
```
|
|
112
|
+
# Clone from mainnet
|
|
113
|
+
solforge token clone <MINT_ADDRESS>
|
|
142
114
|
|
|
143
|
-
|
|
115
|
+
# Adopt mint authority
|
|
116
|
+
solforge token adopt-authority <MINT_ADDRESS>
|
|
117
|
+
```
|
|
144
118
|
|
|
145
|
-
|
|
119
|
+
### 📦 Program Commands
|
|
146
120
|
|
|
147
|
-
|
|
148
|
-
| ------------------------- | ------------------------------------ |
|
|
149
|
-
| `GET /api/status` | Aggregated RPC stats + faucet info |
|
|
150
|
-
| `GET /api/programs` | List the registered programs |
|
|
151
|
-
| `GET /api/tokens` | Detailed SPL mint metadata |
|
|
152
|
-
| `POST /api/airdrop` | Proxy to `requestAirdrop` |
|
|
153
|
-
| `POST /api/mint` | Proxy to `solforgeMintTo` |
|
|
154
|
-
| `POST /api/clone/program` | Proxy to program clone helpers |
|
|
155
|
-
| `POST /api/clone/token` | Proxy to token clone helpers |
|
|
121
|
+
#### Clone Program
|
|
156
122
|
|
|
157
|
-
|
|
123
|
+
```bash
|
|
124
|
+
# Clone program from mainnet
|
|
125
|
+
solforge program clone <PROGRAM_ID>
|
|
158
126
|
|
|
159
|
-
|
|
127
|
+
# Clone with accounts
|
|
128
|
+
solforge program clone <PROGRAM_ID> --with-accounts
|
|
160
129
|
|
|
130
|
+
# Clone specific accounts
|
|
131
|
+
solforge program accounts clone <PROGRAM_ID> --limit 100
|
|
161
132
|
|
|
162
|
-
|
|
133
|
+
# Load local program
|
|
134
|
+
solforge program load --file ./program.so --id <PROGRAM_ID>
|
|
135
|
+
```
|
|
163
136
|
|
|
164
|
-
|
|
137
|
+
### ⚙️ Configuration Commands
|
|
165
138
|
|
|
166
|
-
|
|
139
|
+
#### Initialize Config
|
|
167
140
|
|
|
168
141
|
```bash
|
|
169
|
-
#
|
|
170
|
-
|
|
171
|
-
export DEBUG_RPC_LOG=1 # Log all RPC calls
|
|
142
|
+
# Create default config
|
|
143
|
+
solforge config init
|
|
172
144
|
|
|
173
|
-
#
|
|
174
|
-
|
|
175
|
-
export SOLFORGE_DB_PATH=.solforge/db.db
|
|
145
|
+
# Get config value
|
|
146
|
+
solforge config get server.rpcPort
|
|
176
147
|
|
|
177
|
-
#
|
|
178
|
-
|
|
148
|
+
# Set config value
|
|
149
|
+
solforge config set server.rpcPort 9999
|
|
179
150
|
```
|
|
180
151
|
|
|
181
|
-
|
|
152
|
+
## 📝 Configuration File
|
|
182
153
|
|
|
183
|
-
|
|
184
|
-
# Generate default config
|
|
185
|
-
bun src/cli/main.ts config init
|
|
186
|
-
|
|
187
|
-
# Edit configuration
|
|
188
|
-
bun src/cli/main.ts config set server.rpcPort 9000
|
|
189
|
-
bun src/cli/main.ts config get server.db.mode
|
|
190
|
-
```
|
|
154
|
+
Create `sf.config.json` in your project root:
|
|
191
155
|
|
|
192
156
|
```json
|
|
193
157
|
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
\"db\": {
|
|
198
|
-
\"mode\": \"ephemeral\",
|
|
199
|
-
\"path\": \".solforge/db.db\"
|
|
200
|
-
}
|
|
158
|
+
"server": {
|
|
159
|
+
"rpcPort": 8899,
|
|
160
|
+
"wsPort": 8900,
|
|
201
161
|
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
162
|
+
"svm": {
|
|
163
|
+
"initialLamports": "1000000000000000",
|
|
164
|
+
"faucetSOL": 1000
|
|
205
165
|
},
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
166
|
+
"clone": {
|
|
167
|
+
"endpoint": "https://api.mainnet-beta.solana.com",
|
|
168
|
+
"programs": [
|
|
169
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
170
|
+
"11111111111111111111111111111111"
|
|
171
|
+
],
|
|
172
|
+
"tokens": ["So11111111111111111111111111111111111111112"],
|
|
173
|
+
"programAccounts": [
|
|
174
|
+
{
|
|
175
|
+
"programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
176
|
+
"limit": 10
|
|
177
|
+
}
|
|
178
|
+
]
|
|
211
179
|
},
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
180
|
+
"gui": {
|
|
181
|
+
"enabled": true,
|
|
182
|
+
"port": 42069
|
|
215
183
|
},
|
|
216
|
-
|
|
217
|
-
|
|
184
|
+
"bootstrap": {
|
|
185
|
+
"airdrops": [
|
|
186
|
+
{
|
|
187
|
+
"address": "YOUR_WALLET_ADDRESS",
|
|
188
|
+
"amountSol": 100
|
|
189
|
+
}
|
|
190
|
+
]
|
|
218
191
|
}
|
|
219
192
|
}
|
|
220
193
|
```
|
|
221
194
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
SolForge includes powerful CLI tools for development:
|
|
195
|
+
### 🔑 Configuration Options
|
|
225
196
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
197
|
+
| Option | Description | Default |
|
|
198
|
+
| --------------------- | ------------------------------------------- | ------------------------------------- |
|
|
199
|
+
| `server.rpcPort` | HTTP RPC port | `8899` |
|
|
200
|
+
| `server.wsPort` | WebSocket port | `8900` |
|
|
201
|
+
| `server.network` | Bind to `0.0.0.0` for LAN access | `false` |
|
|
202
|
+
| `svm.initialLamports` | Initial lamports for accounts | `1000000000000000` |
|
|
203
|
+
| `svm.faucetSOL` | SOL amount per airdrop | `1000` |
|
|
204
|
+
| `clone.endpoint` | RPC endpoint for cloning | `https://api.mainnet-beta.solana.com` |
|
|
205
|
+
| `clone.programs` | Program IDs to clone on startup | `[]` |
|
|
206
|
+
| `clone.tokens` | Token mints to clone on startup | `[]` |
|
|
207
|
+
| `gui.enabled` | Enable web GUI | `true` |
|
|
208
|
+
| `gui.port` | GUI port | `42069` |
|
|
209
|
+
| `bootstrap.airdrops` | Auto-airdrops on startup | `[]` |
|
|
232
210
|
|
|
233
|
-
|
|
234
|
-
bun src/cli/main.ts program clone <program-id>
|
|
235
|
-
bun src/cli/main.ts token clone <mint-address>
|
|
211
|
+
## 🌍 Environment Variables
|
|
236
212
|
|
|
237
|
-
|
|
238
|
-
bun src/cli/main.ts config init
|
|
239
|
-
bun src/cli/main.ts config set server.rpcPort 9000
|
|
240
|
-
```
|
|
213
|
+
Override configuration with environment variables:
|
|
241
214
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
**Account Operations**
|
|
247
|
-
|
|
248
|
-
- `getAccountInfo`, `getMultipleAccounts`, `getBalance`
|
|
249
|
-
- `getParsedAccountInfo`, `getProgramAccounts`
|
|
215
|
+
```bash
|
|
216
|
+
# Server settings
|
|
217
|
+
export RPC_PORT=8899
|
|
218
|
+
export SOLFORGE_GUI_PORT=3000
|
|
250
219
|
|
|
251
|
-
|
|
220
|
+
# Debug mode
|
|
221
|
+
export DEBUG_RPC_LOG=1 # Log all RPC calls
|
|
252
222
|
|
|
253
|
-
|
|
254
|
-
|
|
223
|
+
# Start with env vars
|
|
224
|
+
solforge start
|
|
225
|
+
```
|
|
255
226
|
|
|
256
|
-
|
|
227
|
+
## 🔌 Integration Examples
|
|
257
228
|
|
|
258
|
-
|
|
259
|
-
- `getSlot`, `getSlotLeader`, `getSlotLeaders`
|
|
229
|
+
### Anchor Framework
|
|
260
230
|
|
|
261
|
-
|
|
231
|
+
Configure `Anchor.toml`:
|
|
262
232
|
|
|
263
|
-
|
|
264
|
-
|
|
233
|
+
```toml
|
|
234
|
+
[provider]
|
|
235
|
+
cluster = "http://127.0.0.1:8899"
|
|
236
|
+
wallet = "~/.config/solana/id.json"
|
|
265
237
|
|
|
266
|
-
|
|
238
|
+
[scripts]
|
|
239
|
+
test = "solforge start && anchor test --skip-local-validator"
|
|
240
|
+
```
|
|
267
241
|
|
|
268
|
-
|
|
242
|
+
### @solana/web3.js
|
|
269
243
|
|
|
270
|
-
|
|
244
|
+
```javascript
|
|
245
|
+
import { Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
|
|
271
246
|
|
|
272
|
-
|
|
273
|
-
- Other subscriptions (stubbed but functional)
|
|
247
|
+
const connection = new Connection("http://127.0.0.1:8899", "confirmed");
|
|
274
248
|
|
|
275
|
-
|
|
249
|
+
// Request airdrop
|
|
250
|
+
const signature = await connection.requestAirdrop(
|
|
251
|
+
new PublicKey("YOUR_WALLET"),
|
|
252
|
+
100 * LAMPORTS_PER_SOL,
|
|
253
|
+
);
|
|
276
254
|
|
|
277
|
-
|
|
278
|
-
|
|
255
|
+
// Get balance
|
|
256
|
+
const balance = await connection.getBalance(publicKey);
|
|
257
|
+
```
|
|
279
258
|
|
|
280
|
-
|
|
259
|
+
### @solana/kit (Recommended)
|
|
281
260
|
|
|
282
|
-
|
|
261
|
+
```typescript
|
|
262
|
+
import { createSolanaRpc } from "@solana/kit";
|
|
263
|
+
import { address, lamports } from "@solana/web3.js";
|
|
283
264
|
|
|
284
|
-
|
|
285
|
-
- Perfect for testing and development
|
|
286
|
-
- Stores full transaction history during session
|
|
265
|
+
const rpc = createSolanaRpc("http://127.0.0.1:8899");
|
|
287
266
|
|
|
288
|
-
|
|
267
|
+
// Request airdrop
|
|
268
|
+
await rpc
|
|
269
|
+
.requestAirdrop(address("YOUR_WALLET"), lamports(1_000_000_000n))
|
|
270
|
+
.send();
|
|
289
271
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
export SOLFORGE_DB_MODE=persistent
|
|
293
|
-
bun start
|
|
272
|
+
// Get balance
|
|
273
|
+
const balance = await rpc.getBalance(address("YOUR_WALLET")).send();
|
|
294
274
|
```
|
|
295
275
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
```sql
|
|
299
|
-
-- Transactions with full metadata
|
|
300
|
-
CREATE TABLE transactions (
|
|
301
|
-
signature TEXT PRIMARY KEY,
|
|
302
|
-
slot INTEGER,
|
|
303
|
-
raw_transaction BLOB, -- Full transaction data
|
|
304
|
-
logs TEXT, -- JSON array of logs
|
|
305
|
-
status TEXT, -- success/error
|
|
306
|
-
fee INTEGER,
|
|
307
|
-
timestamp INTEGER
|
|
308
|
-
);
|
|
276
|
+
## 🎨 Web GUI
|
|
309
277
|
|
|
310
|
-
|
|
311
|
-
CREATE TABLE accounts (
|
|
312
|
-
address TEXT PRIMARY KEY,
|
|
313
|
-
lamports INTEGER,
|
|
314
|
-
owner TEXT,
|
|
315
|
-
data_len INTEGER,
|
|
316
|
-
last_slot INTEGER
|
|
317
|
-
);
|
|
278
|
+
The built-in GUI provides:
|
|
318
279
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
slot INTEGER
|
|
324
|
-
);
|
|
325
|
-
```
|
|
280
|
+
- **📊 Dashboard**: Current slot, block height, recent transactions
|
|
281
|
+
- **💸 Airdrop Tool**: Quick SOL distribution interface
|
|
282
|
+
- **🪙 Token Minter**: Create and mint SPL tokens
|
|
283
|
+
- **📈 Status Monitor**: Real-time localnet statistics
|
|
326
284
|
|
|
327
|
-
|
|
285
|
+
Access at: `http://127.0.0.1:42069`
|
|
328
286
|
|
|
329
|
-
|
|
330
|
-
const ws = new WebSocket("ws://localhost:8900");
|
|
331
|
-
|
|
332
|
-
// Subscribe to signature updates
|
|
333
|
-
ws.send(
|
|
334
|
-
JSON.stringify({
|
|
335
|
-
jsonrpc: "2.0",
|
|
336
|
-
id: 1,
|
|
337
|
-
method: "signatureSubscribe",
|
|
338
|
-
params: ["<signature>", { commitment: "confirmed" }],
|
|
339
|
-
}),
|
|
340
|
-
);
|
|
287
|
+
## 🏗️ Building from Source
|
|
341
288
|
|
|
342
|
-
|
|
343
|
-
ws.onmessage = (event) => {
|
|
344
|
-
const response = JSON.parse(event.data);
|
|
345
|
-
console.log("Signature update:", response);
|
|
346
|
-
};
|
|
347
|
-
```
|
|
289
|
+
### Prerequisites
|
|
348
290
|
|
|
349
|
-
|
|
291
|
+
- [Bun](https://bun.sh) runtime installed
|
|
292
|
+
|
|
293
|
+
### Build Steps
|
|
350
294
|
|
|
351
295
|
```bash
|
|
352
|
-
#
|
|
353
|
-
|
|
296
|
+
# Clone repository
|
|
297
|
+
git clone https://github.com/nitishxyz/solforge.git
|
|
298
|
+
cd solforge
|
|
354
299
|
|
|
355
|
-
#
|
|
356
|
-
bun
|
|
300
|
+
# Install dependencies
|
|
301
|
+
bun install
|
|
357
302
|
|
|
358
|
-
#
|
|
359
|
-
|
|
360
|
-
```
|
|
303
|
+
# Run from source
|
|
304
|
+
bun src/cli/main.ts start
|
|
361
305
|
|
|
362
|
-
|
|
306
|
+
# Build binary
|
|
307
|
+
bun run build:bin
|
|
363
308
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
├── 🧠 LiteSVM Core # In-memory execution engine
|
|
367
|
-
├── 🌐 HTTP Server # JSON-RPC over HTTP
|
|
368
|
-
├── 🔌 WebSocket Server # Real-time subscriptions
|
|
369
|
-
├── 🗃️ SQLite + Drizzle # Ephemeral data indexing
|
|
370
|
-
├── 💧 Smart Faucet # Unlimited SOL distribution
|
|
371
|
-
└── 🎯 CLI Tools # Developer utilities
|
|
309
|
+
# Build for all platforms
|
|
310
|
+
bun run build:bin:all
|
|
372
311
|
```
|
|
373
312
|
|
|
374
|
-
###
|
|
313
|
+
### Platform-Specific Builds
|
|
375
314
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
- **`src/cli/`**: Command-line interface
|
|
380
|
-
- **`src/config/`**: Configuration management
|
|
381
|
-
- **`src/db/`**: Database schema and operations
|
|
315
|
+
```bash
|
|
316
|
+
# macOS (Apple Silicon)
|
|
317
|
+
bun run build:bin:darwin-arm64
|
|
382
318
|
|
|
383
|
-
|
|
319
|
+
# macOS (Intel)
|
|
320
|
+
bun run build:bin:darwin-x64
|
|
384
321
|
|
|
385
|
-
|
|
322
|
+
# Linux x64
|
|
323
|
+
bun run build:bin:linux-x64
|
|
386
324
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
3. Export from `server/methods/index.ts`
|
|
390
|
-
4. Add to `rpcMethods` object
|
|
325
|
+
# Linux ARM64
|
|
326
|
+
bun run build:bin:linux-arm64
|
|
391
327
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
import type { RpcMethodHandler } from \"../types\";
|
|
395
|
-
|
|
396
|
-
export const yourMethod: RpcMethodHandler = (id, params, context) => {
|
|
397
|
-
try {
|
|
398
|
-
const result = context.svm.someOperation();
|
|
399
|
-
return context.createSuccessResponse(id, result);
|
|
400
|
-
} catch (error: any) {
|
|
401
|
-
return context.createErrorResponse(id, -32603, \"Internal error\");
|
|
402
|
-
}
|
|
403
|
-
};
|
|
328
|
+
# Windows
|
|
329
|
+
bun run build:bin:windows-x64
|
|
404
330
|
```
|
|
405
331
|
|
|
406
|
-
|
|
332
|
+
## 🗂️ Project Structure
|
|
407
333
|
|
|
408
334
|
```
|
|
409
335
|
solforge/
|
|
410
|
-
├──
|
|
411
|
-
├──
|
|
412
|
-
│ ├──
|
|
413
|
-
│ ├──
|
|
414
|
-
│ ├──
|
|
415
|
-
│
|
|
416
|
-
|
|
417
|
-
│
|
|
418
|
-
│
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
│ └── db/ # Database operations
|
|
423
|
-
├── test-client.ts # Integration tests
|
|
424
|
-
└── docs/ # Documentation
|
|
336
|
+
├── src/
|
|
337
|
+
│ ├── cli/ # CLI commands and routing
|
|
338
|
+
│ ├── config/ # Configuration management
|
|
339
|
+
│ ├── db/ # Database schemas and operations
|
|
340
|
+
│ ├── rpc/ # RPC server bootstrap
|
|
341
|
+
│ └── gui/ # Web GUI (React)
|
|
342
|
+
├── server/
|
|
343
|
+
│ ├── methods/ # RPC method implementations
|
|
344
|
+
│ ├── lib/ # Shared utilities
|
|
345
|
+
│ └── types.ts # TypeScript definitions
|
|
346
|
+
├── scripts/ # Build and setup scripts
|
|
347
|
+
└── sf.config.json # Configuration file
|
|
425
348
|
```
|
|
426
349
|
|
|
427
|
-
|
|
350
|
+
## 🔍 Troubleshooting
|
|
428
351
|
|
|
429
|
-
|
|
430
|
-
- Keep files **under 200 lines** (split when larger)
|
|
431
|
-
- Follow **kebab-case** for filenames
|
|
432
|
-
- Write **comprehensive tests**
|
|
433
|
-
- Use **TypeScript strictly**
|
|
352
|
+
### Port Already in Use
|
|
434
353
|
|
|
435
|
-
|
|
354
|
+
```bash
|
|
355
|
+
# Use different port
|
|
356
|
+
solforge start --port 9999
|
|
436
357
|
|
|
437
|
-
|
|
358
|
+
# Or update config
|
|
359
|
+
solforge config set server.rpcPort 9999
|
|
360
|
+
```
|
|
438
361
|
|
|
439
|
-
|
|
362
|
+
### GUI Not Loading
|
|
440
363
|
|
|
441
364
|
```bash
|
|
442
|
-
# Check if port is
|
|
443
|
-
lsof -i :
|
|
365
|
+
# Check if port is available
|
|
366
|
+
lsof -i :42069
|
|
444
367
|
|
|
445
|
-
# Use different port
|
|
446
|
-
|
|
368
|
+
# Use different GUI port
|
|
369
|
+
export SOLFORGE_GUI_PORT=3000
|
|
370
|
+
solforge start
|
|
447
371
|
```
|
|
448
372
|
|
|
449
|
-
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
### Connection Refused
|
|
450
376
|
|
|
451
377
|
```bash
|
|
452
|
-
#
|
|
378
|
+
# Verify server is running
|
|
379
|
+
curl http://127.0.0.1:8899/health
|
|
380
|
+
|
|
453
381
|
# Check logs with debug mode
|
|
454
|
-
DEBUG_RPC_LOG=1
|
|
382
|
+
DEBUG_RPC_LOG=1 solforge start
|
|
455
383
|
```
|
|
456
384
|
|
|
457
|
-
|
|
385
|
+
## 📊 Performance Comparison
|
|
458
386
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
387
|
+
| Metric | SolForge | solana-test-validator |
|
|
388
|
+
| ---------------- | -------- | --------------------- |
|
|
389
|
+
| Startup Time | < 1s | 10-30s |
|
|
390
|
+
| Memory Usage | ~50MB | 500MB+ |
|
|
391
|
+
| CPU Usage (idle) | < 1% | 5-10% |
|
|
392
|
+
| Airdrop Speed | Instant | Rate limited |
|
|
393
|
+
| Program Deploy | < 100ms | 1-2s |
|
|
394
|
+
|
|
395
|
+
## 🤝 Contributing
|
|
396
|
+
|
|
397
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
463
398
|
|
|
464
|
-
|
|
399
|
+
### Development Workflow
|
|
465
400
|
|
|
466
401
|
```bash
|
|
467
|
-
#
|
|
468
|
-
|
|
402
|
+
# Run tests
|
|
403
|
+
bun test
|
|
404
|
+
|
|
405
|
+
# Lint code
|
|
406
|
+
bun run lint
|
|
469
407
|
|
|
470
|
-
#
|
|
471
|
-
bun
|
|
408
|
+
# Format code
|
|
409
|
+
bun run format
|
|
472
410
|
```
|
|
473
411
|
|
|
474
|
-
##
|
|
412
|
+
## 📚 API Coverage
|
|
475
413
|
|
|
476
|
-
###
|
|
414
|
+
### ✅ Fully Implemented (90+ methods)
|
|
477
415
|
|
|
478
|
-
-
|
|
479
|
-
-
|
|
480
|
-
-
|
|
416
|
+
- Account operations
|
|
417
|
+
- Transaction submission/simulation
|
|
418
|
+
- Block/slot queries
|
|
419
|
+
- Token operations
|
|
420
|
+
- Program deployment
|
|
421
|
+
- WebSocket subscriptions (signatures)
|
|
481
422
|
|
|
482
|
-
###
|
|
423
|
+
### 🚧 Partial Support
|
|
483
424
|
|
|
484
|
-
-
|
|
485
|
-
-
|
|
486
|
-
-
|
|
425
|
+
- Stake operations
|
|
426
|
+
- Vote accounts
|
|
427
|
+
- Advanced subscriptions
|
|
487
428
|
|
|
488
|
-
###
|
|
429
|
+
### 📋 Planned
|
|
489
430
|
|
|
490
|
-
-
|
|
491
|
-
-
|
|
492
|
-
-
|
|
431
|
+
- Snapshot/restore
|
|
432
|
+
- Time-travel debugging
|
|
433
|
+
- Multi-tenant support
|
|
493
434
|
|
|
494
|
-
##
|
|
435
|
+
## 🛠️ Advanced Usage
|
|
495
436
|
|
|
496
|
-
|
|
437
|
+
### Custom Program Development
|
|
497
438
|
|
|
498
|
-
|
|
439
|
+
```bash
|
|
440
|
+
# Deploy custom program
|
|
441
|
+
solana program deploy ./my-program.so
|
|
499
442
|
|
|
500
|
-
|
|
443
|
+
# Clone and modify existing program
|
|
444
|
+
solforge program clone <PROGRAM_ID>
|
|
445
|
+
```
|
|
501
446
|
|
|
502
|
-
|
|
503
|
-
- [PROJECT_STRUCTURE.md](./PROJECT_STRUCTURE.md) - Architecture details
|
|
504
|
-
- [SOLFORGE.md](./SOLFORGE.md) - Vision and roadmap
|
|
447
|
+
### CI/CD Integration
|
|
505
448
|
|
|
506
|
-
|
|
449
|
+
```yaml
|
|
450
|
+
# GitHub Actions example
|
|
451
|
+
- name: Setup SolForge
|
|
452
|
+
run: |
|
|
453
|
+
curl -fsSL https://install.solforge.sh | sh
|
|
454
|
+
solforge start &
|
|
455
|
+
sleep 2
|
|
507
456
|
|
|
508
|
-
|
|
457
|
+
- name: Run Tests
|
|
458
|
+
run: |
|
|
459
|
+
anchor test --skip-local-validator
|
|
460
|
+
```
|
|
509
461
|
|
|
510
|
-
|
|
511
|
-
- [Bun](https://bun.sh) - Lightning-fast JavaScript runtime
|
|
512
|
-
- [Drizzle](https://drizzle.team) - TypeScript SQL toolkit
|
|
462
|
+
## 📄 License
|
|
513
463
|
|
|
514
|
-
|
|
464
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
515
465
|
|
|
516
|
-
|
|
466
|
+
## 🔗 Links
|
|
517
467
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
468
|
+
- **GitHub**: [github.com/nitishxyz/solforge](https://github.com/nitishxyz/solforge)
|
|
469
|
+
- **Issues**: [Report bugs or request features](https://github.com/nitishxyz/solforge/issues)
|
|
470
|
+
- **Discord**: [Join our community](#) _(coming soon)_
|
|
471
|
+
|
|
472
|
+
## 🙏 Acknowledgments
|
|
473
|
+
|
|
474
|
+
- Built on [LiteSVM](https://github.com/litesvm/litesvm) - Fast SVM implementation
|
|
475
|
+
- Powered by [Bun](https://bun.sh) - All-in-one JavaScript runtime
|
|
476
|
+
- Inspired by the Solana developer community
|
|
477
|
+
|
|
478
|
+
---
|
|
522
479
|
|
|
523
|
-
|
|
480
|
+
<p align="center">
|
|
481
|
+
Made with ❤️ for Solana developers
|
|
482
|
+
</p>
|