Skip to Content
Cheatcodes

Cheatcodes

Cheatcodes are custom JSON-RPC methods. They do what a real chain never lets you. Each one is a POST to the running fork at http://127.0.0.1:9123/, with the standard JSON-RPC 2.0 envelope.

Headers

NameTypeDescription
Content-TypestringRequired. application/json.

Envelope

Every request body is { "jsonrpc": "2.0", "id": <n>, "method": "<method>", "params": { ... } }. Every reply is HTTP 200 and carries either a result payload or a JSON-RPC error object. The Parameters tables below describe the params object; the Response blocks show just the result.

Amounts are strings, so they stay exact past 2^53. Addresses and object ids are 0x hex. Types are full Move types, like 0x2::sui::SUI.

galene_mintCoin

Fabricate a Coin<T> with any balance and owner.

POSTgalene_mintCoin

Parameters

NameTypeRequiredDescription
typestringYesFull coin type, like 0x2::sui::SUI.
amountstringYesBalance in base units.
recipientstringYesOwner address.

HTTP response status codes

Status codeDescription
200OK. The result is in result, or a JSON-RPC error object on failure.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_mintCoin", "params": { "type": "0x2::sui::SUI", "amount": "1000000000", "recipient": "0xalice" } }'

Response

Status: 200OK
{ "objectId": "0x9a3c...e1f0", "type": "0x2::sui::SUI", "balance": 1000000000, "owner": "0xalice" }

galene_faucet

Mint a known coin by symbol. This wraps galene_mintCoin with a built-in registry: SUI, USDC, USDT, WAL, DEEP. For anything else, use galene_mintCoin with a full type.

POSTgalene_faucet

Parameters

NameTypeRequiredDescription
coinSymbolstringYesOne of the known symbols.
amountstringYesBalance in base units.
recipientstringYesOwner address.
coinstringNoA full coin type, instead of coinSymbol.

HTTP response status codes

Status codeDescription
200OK. A known symbol also returns its decimals.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_faucet", "params": { "coinSymbol": "USDC", "amount": "1000000", "recipient": "0xalice" } }'

Response

Status: 200OK
{ "objectId": "0x4b71...c2a9", "type": "0xdba3...::usdc::USDC", "balance": 1000000, "owner": "0xalice", "decimals": 6 }

galene_setGas

Fund any address with SUI gas. Now you never run out mid-test.

POSTgalene_setGas

Parameters

NameTypeRequiredDescription
addressstringYesAddress to fund.
amountstringNoSUI amount in MIST. Defaults to a large balance.

HTTP response status codes

Status codeDescription
200OK. Returns the funded gas coin.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_setGas", "params": { "address": "0xalice" } }'

Response

Status: 200OK
{ "objectId": "0x77de...0b14", "type": "0x2::sui::SUI", "balance": 1000000000000, "owner": "0xalice" }

galene_setObject

Overwrite any object’s contents or owner. This writes a new version. It never clobbers the old one.

POSTgalene_setObject

Parameters

NameTypeRequiredDescription
objectIdstringYesObject to overwrite.
contentsobjectYesNew contents.
ownerstringYesNew owner address.
typestringNoObject type, as addr::module::Name.

HTTP response status codes

Status codeDescription
200OK. version is the new version this write created.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_setObject", "params": { "objectId": "0x...", "contents": { "balance": "42" }, "owner": "0xalice" } }'

Response

Status: 200OK
{ "objectId": "0x...", "version": 2, "owner": "0xalice", "contents": { "balance": "42" } }

galene_warpEpoch

Jump forward by epochs. Good for epoch-locked logic.

POSTgalene_warpEpoch

Parameters

NameTypeRequiredDescription
nnumberNoEpochs to advance. Defaults to 1.

HTTP response status codes

Status codeDescription
200OK.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_warpEpoch", "params": { "n": 3 } }'

Response

Status: 200OK
{ "epoch": 3, "advancedBy": 3 }

galene_setClock

Set the on-chain clock. This is the Clock at 0x6. Good for time-locked logic.

POSTgalene_setClock

Parameters

NameTypeRequiredDescription
timestampMsnumberYesUnix time in milliseconds.

HTTP response status codes

Status codeDescription
200OK. The clock is monotonic; vmClockMs is what the Move VM reads.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_setClock", "params": { "timestampMs": 1893456000000 } }'

Response

Status: 200OK
{ "clockMs": 1893456000000, "vmClockMs": 1893456000000 }

galene_impersonate

Act as any address. The address is funded with gas for you.

POSTgalene_impersonate

Parameters

NameTypeRequiredDescription
addressstringYesThe address to act as.

HTTP response status codes

Status codeDescription
200OK. gasFunded is the MIST auto-funded to the new sender.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_impersonate", "params": { "address": "0xwhale" } }'

Response

Status: 200OK
{ "activeSender": "0xwhale", "gasFunded": 1000000000000, "gasObjectId": "0x12ab...9f0c" }

galene_overridePackage

Hot-swap a published package’s code for your local build. The patched modules are injected at the package id, preserving its linkage and types, so execution runs the patch against live mainnet state. This powers the exploit-patch workflow.

POSTgalene_overridePackage

Parameters

NameTypeRequiredDescription
packageIdstringYesThe published package id.
modulesobjectYes{ "<moduleName>": "<base64 compiled module>" }. At least one module.
rpcstringNoFullnode to source the original package from. Defaults to the fork’s source.

HTTP response status codes

Status codeDescription
200OK.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_overridePackage", "params": { "packageId": "0x...", "modules": { "pool": "<base64>" } } }'

Response

Status: 200OK
{ "packageId": "0x...", "version": 2, "modulesPatched": ["pool"], "modulesTotal": 3, "overridden": true, "overrideCount": 1 }

galene_forkObject

Fork a real mainnet object into the engine, on demand.

POSTgalene_forkObject

Parameters

NameTypeRequiredDescription
objectIdstringYesThe mainnet object id.
rpcstringNoFullnode to fetch from. Defaults to the fork’s source.

HTTP response status codes

Status codeDescription
200OK. The object arrives at its real mainnet version.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_forkObject", "params": { "objectId": "0x6" } }'

Response

Status: 200OK
{ "objectId": "0x6", "type": "0x2::clock::Clock", "version": 78231445, "forkedIntoEngine": true }

galene_executeTransactionBlock

Submit a serialized transaction. Galene forks every object it needs, then runs it. See How it works for the full loop.

POSTgalene_executeTransactionBlock

Parameters

NameTypeRequiredDescription
txBytesstringYesBase64 BCS TransactionData. The bytes the SDK builds before signing.
signaturesstring[]NoEmpty or absent runs as an unchecked impersonation. A non-empty list is verified per call, like a real node.

HTTP response status codes

Status codeDescription
200OK. autoForked lists the objects Galene fetched to run it.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_executeTransactionBlock", "params": { "txBytes": "<base64-bcs>" } }'

Response

Status: 200OK
{ "digest": "8Qb...kFa", "success": true, "netGasUsed": 1976280, "created": 1, "mutated": 2, "sender": "0xwhale", "autoForked": ["0xabc...001", "0xabc...002"], "balanceChanges": [ { "owner": "0xwhale", "coinType": "0x2::sui::SUI", "amount": "-1976280" } ] }

galene_publishPackage

Deploy a new Move package into the fork, then call it against forked mainnet state. No testnet round-trip. A publish is a real on-fork transaction, so it shows up in history and on the Studio transaction feed.

POSTgalene_publishPackage

Parameters

NameTypeRequiredDescription
modulesstring[] | objectYesCompiled modules as base64: an array, or { "<name>": "<base64>" }.
depsstring[]NoDependency package ids the modules link against. Defaults to the framework (0x1, 0x2).

HTTP response status codes

Status codeDescription
200OK. failure is null on success.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_publishPackage", "params": { "modules": ["<base64-module>"] } }'

Response

Status: 200OK
{ "packageId": "0x5f2d...a07e", "modules": ["my_module"], "digest": "Dk9...3Tu", "success": true, "failure": null, "netGasUsed": 12663200 }

galene_snapshot

Capture the current fork state and get an id to roll back to later. Pairs with galene_revert.

POSTgalene_snapshot

Parameters

This method takes no parameters. Send an empty params object.

HTTP response status codes

Status codeDescription
200OK. max is the snapshot limit (32).

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_snapshot", "params": {} }'

Response

Status: 200OK
{ "snapshotId": 0, "max": 32, "snapshots": [0] }

galene_revert

Roll the fork back to a snapshot taken with galene_snapshot. Restores the object store, epoch, clock, sender, and package overrides, and unwinds the engine. This and any later snapshots are invalidated.

POSTgalene_revert

Parameters

NameTypeRequiredDescription
snapshotIdnumberYesThe id returned by galene_snapshot.

HTTP response status codes

Status codeDescription
200OK.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_revert", "params": { "snapshotId": 0 } }'

Response

Status: 200OK
{ "reverted": true, "snapshotId": 0, "epoch": 42, "objectsInStore": 12, "snapshots": [] }

galene_reset

Wipe all fork state back to a fresh genesis: objects, package overrides, sender, and the engine. The upstream source and epoch cadence are kept, so the next read re-forks from a clean slate.

POSTgalene_reset

Parameters

This method takes no parameters. Send an empty params object.

HTTP response status codes

Status codeDescription
200OK. Returns the counts cleared and the current epoch.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_reset", "params": {} }'

Response

Status: 200OK
{ "reset": true, "clearedObjects": 12, "clearedForkedIntoEngine": 8, "clearedPackageOverrides": 1, "epoch": 0 }

galene_dumpState

Serialize the whole fork (forked, minted, and execution-created objects, package overrides, epoch, and clock) to a portable JSON dump. Save it and reload it later with galene_loadState or galene start --load-state <file>. Anvil-style.

POSTgalene_dumpState

Parameters

This method takes no parameters. Send an empty params object.

HTTP response status codes

Status codeDescription
200OK. The result is the portable JSON dump.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_dumpState", "params": {} }'

galene_loadState

Reset the fork and reload a state previously produced by galene_dumpState.

POSTgalene_loadState

Parameters

NameTypeRequiredDescription
stateobjectYesA dump from galene_dumpState. The params themselves are accepted too.

HTTP response status codes

Status codeDescription
200OK. objects and packages are the counts re-injected.

Code samples

Request

curl -X POST http://127.0.0.1:9123/ \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "galene_loadState", "params": { "state": { "...": "a dump from galene_dumpState" } } }'

Response

Status: 200OK
{ "loaded": true, "objects": 8, "packages": 2, "epoch": 42, "source": "https://fullnode.mainnet.sui.io:443" }
Last updated on