Advanced Functionalities
Surfnet goes beyond replicating mainnet on localnet—it lets you enhance and modify core Solana features by changing accounts, system variables, and blockchain state.
These modifications happen through RPC calls to Surfnet, enabling changes both programmatically (for automated test environments) and via terminal commands (for one-off operations).
To execute RPC calls in your code, use:
const surfnetCall = {
"jsonrpc": "2.0",
"id": 1,
"method": "<surfnet-method>",
"params": [<surfnet-method-params]
}
await fetch(connection.rpcEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(surfnetCall)
});
To execute RPC calls in your terminal, use:
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "<surfnet-method>",
"params": [<surfnet-method-params]
}' \
http://localhost:8899
Customize System Variables
Time Travel
Jump to any point in blockchain history using the surfnet_timeTravel
method. This is invaluable for testing how your program behaves at different network states or reproducing bugs that occurred at specific times.
Specify one of: absoluteEpoch
, absoluteSlot
, or absoluteTimestamp
like this:
{
"jsonrpc": "2.0",
"id": 1,
"method": "surfnet_timeTravel",
"params": [
{
"absoluteEpoch": 0
}
]
}
Pause and Resume Block Production
Control block progression to debug transactions step-by-step or test time-sensitive logic. Use surfnet_pauseClock
to halt block production and surfnet_resumeClock
to continue:
{
"jsonrpc": "2.0",
"id": 1,
"method": "surfnet_pauseClock", // or "surfnet_resumeClock"
"params": []
}
Modify Account Data
Set SOL Parameters
Configure SOL supply parameters to test economic scenarios or edge cases.
The surfnet_setSupply
method accepts circulating
, nonCirculating
, nonCirculatingAccounts
, and total
parameters:
{
"jsonrpc": "2.0",
"id": 1,
"method": "surfnet_setSupply",
"params": [
{
"circulating": 1000000000,
"nonCirculating": 1000000000,
"nonCirculatingAccounts": [],
"total": 1000000000
}
]
}
Transfer Accounts Between Programs
Clone program accounts from one program to another using surfnet_cloneProgramAccount
. Useful for testing program upgrades or migrating state between different program versions.
Requires both destinationProgramId
and sourceProgramId
:
{
"jsonrpc": "2.0",
"id": 1,
"method": "surfnet_cloneProgramAccount",
"params": [
{
"destinationProgramId": "string",
"sourceProgramId": "string"
}
]
}
Update Account Data
Modify any account's properties including lamports, data, owner, and executable status using surfnet_setAccount
.
The method requires a pubkey
and accepts optional fields for data
, executable
, lamports
, owner
, and rentEpoch
:
{
"jsonrpc": "2.0",
"id": 1,
"method": "surfnet_setAccount",
"params": [
"1111111QLbz7JHiBTspS962RLKV8GndWFwiEaqKM",
{
"data": "0x123456",
"executable": false,
"lamports": 1000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 0
}
]
}
Additionally, for token account modifications, use the specialized surfnet_setTokenAccount
method, which simplifies changing data for Token Accounts.
Requires owner
and mint
parameters, with optional fields for amount
, closeAuthority
, delegate
, delegateAmount
, state
, and tokenProgram
:
{
"jsonrpc": "2.0",
"id": 1,
"method": "surfnet_setTokenAccount",
"params": [
"1111111ogCyDbaRMvkdsHB3qfdyFYaG1WtRUAfdh",
"11111112D1oxKts8YPdTJRG5FzxTNpMtWmq8hkVx3",
{
"amount": 1000000000,
"closeAuthority": "111111131h1vYVSYuKP6AhS86fbRdMw9XHiZAvAaj",
"delegate": "11111112cMQwSC9qirWGjZM6gLGwW69X22mqwLLGP",
"delegatedAmount": 1000000000,
"state": "initialized"
},
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
]
}