Skip to content

teploniweta/encoins-relay

 
 

Repository files navigation

ENCOINS Relay App

Encoins Relay server and console client applications. Instead of running following commands through cabal, you can use this script to build all executables, and run them directly from encoins-tools (you still need cabal for this).

Build server

  1. With ghcup tui set GHC to 8.10.7and cabal to 3.6.2.0
  2. Fetch submodule git submodule update --init --recursive
  3. Run ./build.sh

Server usage:

  1. Run encoins-relay server:
$ cabal run encoins-relay-server -- run
  1. Mint and send encoins beacon token:
$ cabal run encoins-relay-server -- setup
  1. Run verifier server:
$ cabal run encoins-relay-verifier

Client usage:

  1. Run client in which it will generate and send a request to selected endpoint with an average interval seconds:
$ cabal run encoins-relay-client -- [ping | funds | newTx | serverTx | submitTx | status] --auto interval

  For example:

$ cabal run encoins-relay-client -- serverTx --auto 30
  1. Run client in manual mode in which it will burn specified encoins tokens or mint tokens equals to specified amount of ada:
$ cabal run encoins-relay-client -- [ping | funds | newTx | serverTx | submitTx | status] --manual [mada|btoken],[mada|btoken], ...

  For example:

$ cabal run encoins-relay-client -- serverTx --manual m30,m4,b0x05e229b5959b43c4cf5358e1687d68d253fb08aa96068ab47f19f2be7207d9ec

Note that the maximum number of tokens in one request is 5.

ServerTx and NewTx endpoints:

  1. ServerTx and NewTx endpoints can also work in ledger mode as follows:
$ cabal run encoins-relay-client -- serverTx LedgerMode --manual m1,b0xad5b57acbaf171803b94696847c8fa0114bd5df16bcd71fcbcb15b4d3bad761d
  1. These endpoints can also be used to make transactions that produce utxos:
$ cabal run encoins-relay-client -- --manual "addr_test1vrnptddmxuwzqqnx8f40ljfggdsfc3hmzmzvnsjtt9wzhdclkhhn5,Value {coin = \"2000000\", multiasset = Just (MultiAsset (fromList [(\"05338963283a4c49b8007aa37b7c2f36ab882f108eb524846fda7949\",fromList [(\"\",\"1\")])]))}"

Status endpoint:

  1. Get the maximum amount of ada that can be taken from a single utxo bound to a ledger address:
$ cabal run encoins-relay-client -- status --manual ada
  1. Get all ledger utxos containing 6 or fewer tokens (including ada) and at least one encoins token:
$ cabal run encoins-relay-client -- status --manual encoins

Running tests

To use encoins-relay, you need to have cardano-node, cardano-wallet and kupo installed. To run the tests, follow these steps:

  1. Update the paths to the cardano-node socket, cardano-node database and kupo database in the config.json.

  2. If you want to use your own wallet, place it in the wallets directory. If you have changed the name of the wallet file, make sure to update it in the config.json. To run the tests successfully, the wallet should have a small amount (around 30₳) of ada.

  3. If you want to run delegation tests, then you need to put your blockfrost and maestro tokens in the configuration folder.

  4. Execute the prepare_tests.sh script and wait for cardano-wallet to fully sync.

$ ./prepare_tests.sh

You can proceed to the next step when you see a message like this in the cardano-wallet terminal:

[cardano-wallet.wallet-engine:Notice:42] [current-time]: In sync! Applied n blocks...
  1. If you want to view any server logs, run the encoins-relay server and the verifier server in a separate terminal windows. Otherwise, you can skip this step.
$ cabal run encoins-relay-verifier
$ cabal run encoins-relay-server
  1. Run the server tests.
$ cabal run encoins-relay-test

About

ENCOINS Relay App

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Haskell 97.8%
  • Shell 2.2%