4. Simulation

Overview

This feature enables users to interact with a validator (smart contract) by uploading a Plutus JSON file compiled from Aiken using the Aiken CLI compiler. Users can specify a Datum, Redeemer, select UTXOs, and lock/unlock assets to seamlessly test and validate the contract’s behavior.

User Story

As a user, I want to interact with a validator (smart contract) by uploading a Plutus JSON file compiled from Aiken, specifying a datum, redeemer, selecting UTXOs, and locking/unlocking assets so that I can test and validate the contract’s behavior before executing transactions mainnet.

User Flow

1

User navigates to the Simulation page in the extension.

2

User uploads a Plutus JSON file generated using the Aiken compiler

3

User selects whether to lock or unlock assets (Spending Validator) based on the contract interaction requirements.

4

User enters a datum or redeemer as required by the contract

5

User selects UTXOs for transaction.

6

User clicks 'Execute transaction' to initiate the transaction process.

7

The system interacts with the blockchain provider to process the transaction.

User Flow Diagrams

Troubleshooting & Common Issues

Issue

Possible Cause

Solution

Unable to execute transaction

API request failed

Check console logs for errors

"Request Timed Out" error

Network issue or API down

Retry after a few minutes

API Reference

Get Contract (Validator) Address

Get address of contract (validator)

POST /validator/address

Headers

Name
Value

Content-Type

application/json

Body

Name
Type
Description

compiledCode

string

Response

{
    "data": {
        "contractAddress": ""
    },
    "msg": "OK",
    "code": 201
}

Execute Transaction

POST /validator/execute

Execute transaction from validator

Headers

Name
Value

Content-Type

application/json

Body

Name
Type
Description

datumOrRedeemer

{ "dataType": string,

"title": string,

"value: string }

Lock uses datum; unlock uses redeemer

contractAddress

string

seedPhrase

string

To access your wallet

isLock

boolean

For Spending Validator (2 modes: lock and unlock)

validator

{ "type": string,

"script": string }

Format required for Lucid SDK to execute a transaction"

unitsQuantity

{ [key: string]: number | bigint }

Amount of native token (lovelace) or other assets

Response

{
    "data": {
       "txHash": ""
    },
    "msg": "OK",
    "code": 201
}

Demo

Screenshot

Video

🔹 For any issues, please refer to the Troubleshooting Section or open an Issue on GitHub.

Last updated