Skip to content
15 changes: 15 additions & 0 deletions runtime/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ pub const GENESIS_DEFAULT_JSON: &str = r#"
],
"datum": "d8799f2703581c7ba97fb6e48018ef131dd08916939350c0ce7050534f8e51b5e0e3a4ff"
},
{
"address": "706a25ad5476105ac4a3784769cb93f92fd67a11932ef9a65a61abd1d6",
"coin": 2000,
"value": [
{
"policy": "6a25ad5476105ac4a3784769cb93f92fd67a11932ef9a65a61abd1d6",
"assets": [ ["FUEL", 120] ]
},
{
"policy": "516238dd0a79bac4bebe041c44bad8bf880d74720733d2fc0d255d28",
"assets": [ ["asteriaAdmin", 1] ]
}
],
"datum": "D8799F0521581C7BA97FB6E48018EF131DD08916939350C0CE7050534F8E51B5E0E3A4FF"
},
{
"address": "0000000000000000000000000000000000000000000000000000000000",
"coin": 314150000,
Expand Down
18 changes: 18 additions & 0 deletions wallet/src/eutxo_examples/game/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Asteria Game Example

This is an example of a simple on-chain game built using the Extended UTXO model. In this game, players can use their ship UTxOs to gather fuel, and use it to move their spaceships to mine resources from the Asteria UTxO, at the center of the game board. You can find more details about the game mechanics in the [game document](../../../../game/README.md).

## Running the Example

You must have a running instance of the Partnerchain node, and run the trace in order using the wallet tx-builder, like in the following example:

```bash
./target/release/griffin-wallet wallet build-tx --tx-info wallet/src/eutxo_examples/game/trace_example/1_create_ship.json
```

Keep in mind that:
- Each transaction `validity_interval_start` and `ttl` are measured in slots. With the default genesis configuration, slots are 3 seconds long.
- The create-ship transaction has a `ttl` of 20, so you must submit it before the corresponding slot is reached (with the default genesis configuration, this means that you must do it within 60 seconds after starting the node).
- In order to respect the time of ship creation, the gather-fuel transaction has a `validity_interval_start` of 20. This means you have to _wait_ until slot 20 is reached before submitting it.
- Similarly, the move-ship transaction has a `validity_interval_start` of 20, so you can run it right after the gather-fuel transaction is confirmed. This transaction has a high `ttl` of 130 in order to respect the max speed of the ship.
- Finally, the mine-asteria transaction has a `validity_interval_start` equal to the previous transaction `ttl`, i.e., 130, so you have to wait until that slot is reached before submitting it.
86 changes: 86 additions & 0 deletions wallet/src/eutxo_examples/game/trace_example/1_create_ship.json

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions wallet/src/eutxo_examples/game/trace_example/2_gather_fuel.json

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions wallet/src/eutxo_examples/game/trace_example/3_move_ship.json

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions wallet/src/eutxo_examples/game/trace_example/4_mine_asteria.json

Large diffs are not rendered by default.