Skip to content

Commit

Permalink
Merge pull request #96 from geniusyield/update-docker-compose-to-use-…
Browse files Browse the repository at this point in the history
…seed-phrase

Update docker compose to use payment signing key
  • Loading branch information
4TT1L4 authored Nov 10, 2024
2 parents f5abf92 + d1b68e4 commit 1f96f93
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -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=stake1uhpdg7r5hjw5u2c59vtdgn3hmcjttlf8hdr5lx7ca5ut6rscues4h
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ cabal.project.local~
var/
.envrc
secrets/

.env
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,29 @@ After cloning the repository only a few environment variables must be set. As s
# Clone the repository:
git clone [email protected]: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:
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:
Expand Down
10 changes: 7 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -27,8 +26,13 @@ services:
MARKET_MAKER_CONFIG: |
{
"mbc_user": {
"ur_s_key_path": "/root/payment-signing-key.skey",
"ur_coll": "${COLLATERAL_UTXO}"
"ur_mnemonic": {
"mnemonic": ${SEED_PHRASE},
"acc_ix": 0,
"addr_ix": 0
},
"ur_coll": "${COLLATERAL_UTXO}",
"ur_stake_address": "${STAKE_ADDRESS}"
},
"mbc_delay": 120000000,
"mbc_price_config": {
Expand Down
10 changes: 9 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1f96f93

Please sign in to comment.