From 6b87fc5c970c2855e06b8712f341546191ceec89 Mon Sep 17 00:00:00 2001 From: 4TT1L4 <2914096+4TT1L4@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:11:10 +0100 Subject: [PATCH 1/4] Update docker compose to use payment signing key --- .env.template | 4 ++++ .gitignore | 2 +- Makefile | 3 +++ README.md | 9 +++++---- docker-compose.yml | 4 ++-- start.sh | 10 +++++++++- 6 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..67ee282 --- /dev/null +++ b/.env.template @@ -0,0 +1,4 @@ +MAESTRO_API_KEY=aBcDefghijoXj3v0LB3txySofSPrP3Vf2 +COLLATERAL_UTXO=d235edd34566a425668a4751233dfc2c1cs23b11287340b202c35093433491df#0 +SEED_PHRASE=[road, road, road, road, road, anger, anger, anger, anger, anger, antenna, antenna, antenna, antenna, token, token, token, cart, cart, cart, cart, cart, cart, cart] +STAKE_ADDRESS=addr1vxt3v8v5dreedfp0pjwq0gm69jlcc37473estvpjhleuc6sjxfq55 diff --git a/.gitignore b/.gitignore index 9aad285..f658902 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,4 @@ cabal.project.local~ var/ .envrc secrets/ - +.env diff --git a/Makefile b/Makefile index 830a579..69219db 100644 --- a/Makefile +++ b/Makefile @@ -36,3 +36,6 @@ lint_check: requires_nix_shell requires_nix_shell: @ [ "$(IN_NIX_SHELL)" ] || echo "The $(MAKECMDGOALS) target must be run from inside a nix shell" @ [ "$(IN_NIX_SHELL)" ] || (echo " run 'nix develop' first" && false) + +build: + docker build -t ghcr.io/geniusyield/market-maker:latest . diff --git a/README.md b/README.md index 011c02a..a2039bb 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,11 @@ After cloning the repository only a few environment variables must be set. As s # Clone the repository: git clone git@github.com:geniusyield/market-maker.git cd market-maker -# TODO: update the following values with your own configuration. -export MAESTRO_API_KEY=aBcDefghijoXj3v0LB3txySofSPrP3Vf2 -export PAYMENT_SIGNING_KEY='{ "type": "PaymentSigningKeyShelley_ed25519", "description": "Payment Signing Key", "cborHex": "4210268dsb870d08s83a4cf6a4408240248ea551a35bb22bf443586c233ae56bc340" }' -export COLLATERAL_UTXO=d235edd34566a425668a4751233dfc2c1cs23b11287340b202c35093433491df#0 +cp ./.env.template ./.env + +# Update the .env files with your own values (including seed phrase and other configuration values): +nano .env + # Update the docker images: docker compose pull # Start the MM bot with your config: diff --git a/docker-compose.yml b/docker-compose.yml index c116691..bb6b1e8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,6 @@ services: environment: # Supported modes: MM for market making and CANCEL for canceling ALL the orders. MODE: ${MODE:-MM} - PAYMENT_SIGNING_KEY: ${PAYMENT_SIGNING_KEY} PROVIDER_CONFIG: | { "coreProvider": { @@ -27,8 +26,9 @@ services: MARKET_MAKER_CONFIG: | { "mbc_user": { - "ur_s_key_path": "/root/payment-signing-key.skey", + "ur_mnemonic": "${SEED_PHRASE}", "ur_coll": "${COLLATERAL_UTXO}" + "ur_stake_address": "${STAKE_ADDRESS}" }, "mbc_delay": 120000000, "mbc_price_config": { diff --git a/start.sh b/start.sh index b31031b..ba14dff 100644 --- a/start.sh +++ b/start.sh @@ -1,11 +1,19 @@ #!/bin/bash +echo "Initializing market maker..." echo $PROVIDER_CONFIG >> ~/config.json echo $MARKET_MAKER_CONFIG >> ~/market-maker-config.json -echo $PAYMENT_SIGNING_KEY >> ~/payment-signing-key.skey + +if [[ -n "$PAYMENT_SIGNING_KEY" ]]; then + echo " -> Storing payment signing key..." + echo $PAYMENT_SIGNING_KEY >> ~/payment-signing-key.skey +fi + if [[ "${MODE:=MM}" == "CANCEL" ]]; then echo "Canceling all the orders..." + set -x cabal run geniusyield-market-maker-exe -- Cancel ~/config.json ~/market-maker-config.json else echo "Starting market maker..." + set -x cabal run geniusyield-market-maker-exe -- Run ~/config.json ~/market-maker-config.json fi From 495e2ca37658bb0d2a3d25692289ab5021dfe945 Mon Sep 17 00:00:00 2001 From: 4TT1L4 <2914096+4TT1L4@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:26:28 +0100 Subject: [PATCH 2/4] Update docker compose to use payment signing key #96 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index bb6b1e8..0f404c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: { "mbc_user": { "ur_mnemonic": "${SEED_PHRASE}", - "ur_coll": "${COLLATERAL_UTXO}" + "ur_coll": "${COLLATERAL_UTXO}", "ur_stake_address": "${STAKE_ADDRESS}" }, "mbc_delay": 120000000, From e79c85ad5bb00b99d8ef97f15ef3f99d66abf4dc Mon Sep 17 00:00:00 2001 From: 4TT1L4 <2914096+4TT1L4@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:32:18 +0100 Subject: [PATCH 3/4] [MMB] Seed phrase support in startup script #95 --- .env.template | 4 ++-- docker-compose.yml | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.env.template b/.env.template index 67ee282..e05baaa 100644 --- a/.env.template +++ b/.env.template @@ -1,4 +1,4 @@ MAESTRO_API_KEY=aBcDefghijoXj3v0LB3txySofSPrP3Vf2 COLLATERAL_UTXO=d235edd34566a425668a4751233dfc2c1cs23b11287340b202c35093433491df#0 -SEED_PHRASE=[road, road, road, road, road, anger, anger, anger, anger, anger, antenna, antenna, antenna, antenna, token, token, token, cart, cart, cart, cart, cart, cart, cart] -STAKE_ADDRESS=addr1vxt3v8v5dreedfp0pjwq0gm69jlcc37473estvpjhleuc6sjxfq55 +SEED_PHRASE=["road", "road", "road", "road", "road", "anger", "anger", "anger", "anger", "anger", "antenna", "antenna", "antenna", "antenna", "token", "token", "token", "cart", "cart", "cart", "cart", "cart", "cart", "cart"] +STAKE_ADDRESS=stake1uhpdg7r5hjw5u2c59vtdgn3hmcjttlf8hdr5lx7ca5ut6rscues4h diff --git a/docker-compose.yml b/docker-compose.yml index 0f404c5..9daf405 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,11 @@ services: MARKET_MAKER_CONFIG: | { "mbc_user": { - "ur_mnemonic": "${SEED_PHRASE}", + "ur_mnemonic": { + "mnemonic": ${SEED_PHRASE}, + "acc_ix": 0, + "addr_ix": 0 + }, "ur_coll": "${COLLATERAL_UTXO}", "ur_stake_address": "${STAKE_ADDRESS}" }, From d1b68e45564722a83638b2dfb31c367e94db393d Mon Sep 17 00:00:00 2001 From: 4TT1L4 <2914096+4TT1L4@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:38:16 +0100 Subject: [PATCH 4/4] Updated README.md --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a2039bb..1265d6f 100644 --- a/README.md +++ b/README.md @@ -74,16 +74,21 @@ nano .env # Update the docker images: docker compose pull # Start the MM bot with your config: -docker compose up +docker compose up -d +# Check the logs: +docker compose logs mm ``` -As in the example above; the following environment variables must be specified before calling `docker compose up`: +The variables must be specified in the `.env` file before calling `docker compose up -d`: - `MAESTRO_API_KEY`: The MAINNET API key to be used for accessing the Maestro services. -- `PAYMENT_SIGNING_KEY`: The payment signing key to be used. Please see the [signing key generator](https://github.com/geniusyield/signing-key-generator) for details. -- `COLLATERAL_UTXO`: A suitable UTxO with 5 ADA to be used as collateral UTxO. +- `SEED_PHASE`: The seed phrase to be used. +- `COLLATERAL_UTXO`: A suitable UTxO with 5 ADA to be used as collateral UTxO. (e.g.: `d235edd34566a425668a4751233dfc2c1cs23b11287340b202c35093433491df#0) +- `STAKE_ADDRESS`: The stake address to be used. (e.g.: `stake1uhpdg7r5hjw5u2c59vtdgn3hmcjttlf8hdr5lx7ca5ut6rscues4h) + +For example values plase see the `.env.template` file. The configuration values used for these environment variables in the example above are just placeholders. These must be replaced by your own -configuration values. A MAINNET Maestro API key is needed, a payment signing key must be generated and a collateral UTxO must be provided after +configuration values. A MAINNET Maestro API key, a seed phrase and aa collateral UTxO must be provided after sending funds to the address given by the payment signing key and the (optional) stake address. In order to determine this address, you could use `cardano-cli address build`, but you can also just run the market maker - the address will be printed as the first log of "Info" severity: