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).
- With
ghcup tui
setGHC
to8.10.7
andcabal
to3.6.2.0
- Fetch submodule
git submodule update --init --recursive
- Run
./build.sh
- Run encoins-relay server:
$ cabal run encoins-relay-server -- run
- Mint and send encoins beacon token:
$ cabal run encoins-relay-server -- setup
- Run verifier server:
$ cabal run encoins-relay-verifier
- 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
- 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
andNewTx
endpoints can also work in ledger mode as follows:
$ cabal run encoins-relay-client -- serverTx LedgerMode --manual m1,b0xad5b57acbaf171803b94696847c8fa0114bd5df16bcd71fcbcb15b4d3bad761d
- 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\")])]))}"
- 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
- 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
To use encoins-relay, you need to have cardano-node, cardano-wallet and kupo installed. To run the tests, follow these steps:
-
Update the paths to the cardano-node socket, cardano-node database and kupo database in the config.json.
-
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.
-
If you want to run delegation tests, then you need to put your blockfrost and maestro tokens in the configuration folder.
-
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...
- 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
- Run the server tests.
$ cabal run encoins-relay-test
NOTE: it doesn't work due to hasql
ERROR: Warning: Failed to build documentation for hasql-1.6.4.3
- Compile
cabal-hoogle
with
cabal install --constraint="Cabal == 3.10.1.0" --overwrite-policy=always exe:cabal-hoogle
- Add
cabal.project.local
to root dir ofencoins-relay
with following content:
ignore-project: False
constraints:
Cabal == 3.10.1.0
optimization: True
Cabal == 3.10.1.0
wanted because of deps of encoins-relay
can't use newer and
also it uses Setup.hs
optimization: True
wanted because cabal-hoogle
use it.
See issue 4 for more.
- Clean cache
cabal clean
- Build project
cabal build all
- Build haddock documentation
cabal-hoogle generate
- Run hoogle server
cabal-hoogle run -- server --local --port 9000