Alpha preview. Not for production use.
Working anonymously. to save your work permanently.
New

Ghost Testing

Test your contracts in a sandboxed environment without deploying to any network.

What is Ghost Testing?

Ghost testing lets you execute your smart contract in a simulated environment. No deployment, no ALGO spent, instant results.

Benefits

  • Free - No gas fees or deployment costs
  • Fast - Instant execution without network delays
  • Safe - Test failure scenarios without risk
  • Detailed - See exactly what happens at each step

The ghost testing concept was pioneered by d13. Check out the original Ghost of AVM repository for more background on the approach.

Creating a Test

  1. Build your contract successfully
  2. Click the Ghost tab in the right sidebar
  3. Click New Test
  4. Configure initial state (optional)
  5. Add method calls to the test sequence
  6. Click Run Test

Configuring Initial State

Before running tests, you can set up the initial contract state:

Global State

Pre-populate global state values:

  • Click Initial State in the test config
  • Add key-value pairs for global state
  • Values are set before any method calls execute

Box Storage

Create boxes with initial data:

  • Click Boxes in the test config
  • Add box names and initial contents
  • Boxes are created before test execution

Account Balances

Configure account ALGO and asset balances:

  • Set the test sender's ALGO balance
  • Add ASA balances for asset operations

Building Test Sequences

Add method calls to execute in order:

Adding Calls

  1. Click Add Call
  2. Select the method from the dropdown
  3. Fill in argument values
  4. Configure sender address (optional)

Reordering Calls

Drag and drop calls to reorder the sequence.

Removing Calls

Click the X button on a call to remove it.

Tip
Test multiple scenarios by creating separate test suites. You can save and reload tests.

Understanding Results

Success/Failure

Each call shows whether it succeeded or failed. Failed calls show the error message.

Return Values

Methods that return values show the decoded result according to the ABI type.

State Diff

See exactly what state changed:

  • Green - New state added
  • Yellow - Existing state modified
  • Red - State removed

Cost Breakdown

View opcode usage for each call. Helps identify expensive operations and optimize your contract.

Execution Trace

Expand for a detailed step-by-step trace showing every opcode executed, stack values, and scratch space.

Saving Tests

Save your test sequences for later:

  1. Configure your test
  2. Click Save Test
  3. Enter a name for the test
  4. Test is saved to your project

Loading Saved Tests

  1. Click Saved Tests
  2. Select a test to load
  3. Modify if needed and run

Testing Failure Cases

It's important to test that your contract fails correctly:

  • Invalid inputs - Test with edge cases and invalid data
  • Access control - Call admin methods from non-admin accounts
  • Insufficient funds - Try to withdraw more than available
  • State constraints - Violate business rules
Note
A test that fails as expected is a passing test! Mark expected failures appropriately.