Asteria LogoBy TxPipe

Explore a web implementation to execute transactions for the Asteria challenge, built with the Tx3 toolkit.

CREATE SHIP

This is the first step in order to play the game.

This transaction creates a ShipState UTxO locking min ada, a ShipToken (minted in this tx) and an INITIAL_FUEL amount of fuel tokens (minted in this tx), specifying in the datum the initial pos_x and pos_y coordinates of the ship, the ship and pilot token names and the last_move_latest_time as the upper bound of the transaction's validity range (posix time). Also adds to the AsteriaUTxO value the SHIP_MINT_LOVELACE_FEE paid by the user.

Rules to take into account:

  • the ship number has to be exactly +1 of the last ship minted
  • the tip slot must be recent because it's used during validation of the tx
  • the start position has to be at a certain distance (manhattan distance) of coordinates (0,0). For the mainnet challenge the minimum distance is 50.

You can query the next available ship and pilot token names using the following curl:

curl --location 'https://8000-ethereal-audience-bb83g6.us1.demeter.run/graphql' \
--header 'Content-Type: application/json' \
--data '{"query":"query { nextShipTokenName(spacetimePolicyId: \"0291ae7aebaf064b785542093c2b13169effb34462301e68d4b44f43\", spacetimeAddress: \"addr1wypfrtn6awhsvjmc24pqj0ptzvtfalang33rq8ng6j6y7scnlkytx\") { shipName pilotName } }","variables":{}}'

You can query the tip of the chain using the following curl:

curl --location 'https://8000-ethereal-audience-bb83g6.us1.demeter.run/graphql' \
--header 'Content-Type: application/json' \
--data '{"query":"query { lastSlot { slot } }","variables":{}}'

Diagram

createShip diagram

MOVE SHIP

With this transaction you can move the ship through the space.

This transaction updates the pos_x, pos_y and fuel datum fields of the ShipState UTxO by adding the delta_x and delta_y values specified in the redeemer, and subtracts from the ship value the amount of fuel tokens needed for the displacement (which are burnt in this tx). Also updates the last_move_latest_time field with the transaction's validity range latest posix time.

Rules to take into account:

  • the ship number has to be the one controlled by the pilot token in your wallet.
  • the total distance you travel is constrained by the number of slots between your tx validity range (ttl end - ttl start).
  • the amount of fuel you pass is proportional to the total distance you travel (deltaX + deltaY).

Diagram

moveShip diagram

GATHER FUEL

With this transaction you can gather fuel from the fuel pellets for your ship.

Updates the amount of fuel tokens in both ShipState and PelletState UTxOs, adding the amount (specified in the redeemer) from the first and subtracting it from the latter. Also allows the ship owner to get any amount of the prize tokens held in the pellet.

Rules to take into account:

  • the ship number has to be the one controlled by the pilot token in your wallet.
  • the ship has to be in the same position than the pellet
  • the ship can't have more than 5 fuel units

Diagram

gatherFuel diagram

GATHER TOKEN

With this transaction you can gather fuel from the fuel pellets for your ship and retrieve tokens from the pellet.

Updates the amount of fuel tokens in both ShipState and PelletState UTxOs, adding the amount (specified in the redeemer) from the first and subtracting it from the latter. Also allows the ship owner to get any amount of the prize tokens held in the pellet.

Rules to take into account:

  • the ship number has to be the one controlled by the pilot token in your wallet.
  • the ship has to be in the same position than the pellet
  • the ship can't have more than 5 fuel units

Diagram

gatherFuel diagram

MINE ASTERIA

With this transaction you can retrieve the asteria prize.

Subtracts from the AsteriaUTxO at most MAX_ASTERIA_MINING% of the ada value, and pays that amount to the owner of the ship that reached Asteria, together with the min ada locked in the ShipState UTxO. The ShipToken and the remaining fuel tokens are burnt.

Rules to take into account:

  • the ship number has to be the one controlled by the pilot token in your wallet.
  • the ship has to be in the position (0,0)

Diagram

mineAsteria diagram

QUIT GAME

With this transaction you can remove your ship from the game.

Pays the min ada locked in the ShipState UTxO back to the ship owner. Also burns the ShipToken and the remaining fuel tokens.

Rules to take into account:

  • the ship number has to be the one controlled by the pilot token in your wallet.