Skip to content

Commit

Permalink
updated the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
logicalmechanism committed Dec 31, 2023
1 parent ac673c7 commit e1d8f98
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The `tx_simulation` tool facilitates transaction simulation using `aiken tx simulate` in conjunction with Koios.

The simulation script assumes the contracts are implemented using PlutusV2, relies on reference script UTxOs, and operates under the assumption that within a transaction, only the scripts themselves contain datums. It's important to note that specific edge cases may need to be considered when transitioning to a production environment. Additionally, the simulation script currently supports both the mainnet and pre-production environments but does not provide support for preview environments at this time.
The simulation script assumes the contracts are implemented using PlutusV2, relies on reference script UTxOs, and operates under the assumption that within a transaction, only the script UTxOs have datums. `tx_simulation` currently supports the mainnet and pre-production environments. Support for the preview environment is not implemented at this time.

The tx simulation script was tested with `Python 3.10.12`, `Aiken v1.0.21`, and `Ubuntu 22.04.2 LTS`.

Expand All @@ -12,6 +12,12 @@ It is highly suggested that Aiken is installed and on path.

[Install Aiken](https://aiken-lang.org/installation-instructions)

If Aiken is already installed then upgrade to the newest version with `aikup`.

```bash
aikup
```

A precompile version of Aiken may be used with the `from_file` or `from_cbor` functions.

## Development
Expand All @@ -34,41 +40,39 @@ pip install -r requirements.txt

## Use

The `tx_simulation` script can simulate a transaction from a draft file or from pure cbor.
The `tx_simulation` script can simulate a transaction from a transaction file or from pure cbor.

```bash
import tx_simulation

# can be used on a tx.draft file
required_units = tx_simulation.from_file('tx.draft')
execution_units = tx_simulation.from_file('path/to/tx.draft')

# can be used directory on the tx cbor
required_units = tx_simulation.from_cbor(tx_cbor)
execution_units = tx_simulation.from_cbor(tx_cbor)
```

It will either return a list of dictionaries of the units or a list with an empty dict if it fails. An output example is shown below.
It will either return a list of dictionaries of the execution units or a list with an empty dict if it fails. An output example is shown below.

Success example:

Success example
```json
[{
"mem": 443656,
"cpu": 171399581
}]
```

Failure example
Failure example:

```json
[{}]
```

## Testing

Inside the `tests` folder are pytest tests for `tx_simulation.py`. The tests can be ran with the command below.
Inside the `tests` folder are pytest tests for `tx_simulation`. The tests can be ran with the command below.

```bash
pytest
```

## Known Issues

Any scripts involving fee logic always error resulting in an empty dictionary being returned.

0 comments on commit e1d8f98

Please sign in to comment.