{"id":20994969,"url":"https://github.com/cake-tech/autoforward-autoconvert","last_synced_at":"2026-04-22T12:34:23.793Z","repository":{"id":103423258,"uuid":"553037014","full_name":"cake-tech/autoforward-autoconvert","owner":"cake-tech","description":"Python cron jobs to detect and forward incoming XMR to an address, and then convert to a specified asset using Kraken","archived":false,"fork":false,"pushed_at":"2023-02-17T16:44:00.000Z","size":43,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T08:49:58.755Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cake-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-17T16:01:33.000Z","updated_at":"2024-01-04T07:58:28.000Z","dependencies_parsed_at":"2024-01-21T16:22:34.435Z","dependency_job_id":null,"html_url":"https://github.com/cake-tech/autoforward-autoconvert","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cake-tech%2Fautoforward-autoconvert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cake-tech%2Fautoforward-autoconvert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cake-tech%2Fautoforward-autoconvert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cake-tech%2Fautoforward-autoconvert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cake-tech","download_url":"https://codeload.github.com/cake-tech/autoforward-autoconvert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243410229,"owners_count":20286387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T07:20:48.204Z","updated_at":"2025-12-27T16:04:50.953Z","avatar_url":"https://github.com/cake-tech.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monero autoforward and autoconvert\n\nThese steps will allow you to set up a simple Monero wallet program that will automatically forward all received contents to another Monero wallet address. This is useful if you receive XMR with BTCPay Server and need to forward it to a static exchange address to sell. There is another cron job to autoconvert with Kraken.\n\n## High level process\n\nThis is intended to run a fresh Ubuntu/Linux install.\n\nThe high-level process is:\n\n1. Create/transfer a Monero wallet file\n2. Run Monero Wallet RPC on the server\n3. Set up a cron job to autoforward every X minutes\n4. Set up a cron job to autoconvert every X minutes (or use BTC Transmuter)\n\n## Prerequisities\n\n### Spare server; can be super low spec\n\nBasically any VPS will do. Do yourself a favor and use an SSD though. If you are using this for a critical production deployment, consider 2+ CPU cores for faster scanning.\n\n### Installed python3\n\nThis could possibly work with other versions, but install the latest version of python.\n\n`sudo apt update`\n\n`sudo apt install python3`\n\n### Installed latest [Monero CLI tools](https://getmonero.org/downloads/#cli)\n\nYou'll need monero-wallet-rpc, and possibly monero-wallet-cli.\n\n### Installed Docker\n\n```\nsudo apt-get update \u0026\u0026 sudo apt-get upgrade -y\nsudo apt-get install -y ufw curl\ncurl -fsSL https://get.docker.com -o get-docker.sh\nsudo sh get-docker.sh\nsudo usermod -aG docker $USER\nsu - $USER\n```\n\n### Hardened Firewall\n\nKeep the bad guys out.\n\n```\nsudo ufw default deny incoming\nsudo ufw default allow outgoing\nsudo ufw allow ssh\nsudo ufw enable\n```\n\n### For autoconvert: Kraken account\n\nWe recommend creating an [additional Kraken account](https://support.kraken.com/hc/en-us/articles/360001214163-Can-I-create-multiple-accounts-). This cron job will autoconvert all balances in this account to the specific asset.\n\nYou can optionally use an exchange that supports auto-convert functionality, for example one that auto converts XMR deposited into an address to USDC.\n\n## Create/transfer a Monero wallet file\n\nIf you already have a Monero wallet file, then skip these steps and simply transfer your wallet file over to the server instead.\n\nRun `monero-wallet-cli`\n\nCreate a new wallet name that you'll remember, such as `autoforward`. Choose a STRONG password, though if this box is compromised, people can steal any funds that are in the wallet at that point and any point in the future.\n\nMake sure the wallet files have the proper permissions: `chmod 700 /path/to/file`\n\n## Run Monero Wallet RPC on the server\n\nWe will use [Seth's](https://sethforprivacy.com) `simple-monero-wallet-rpc` Docker image. This will allow it to auto update and restart without any further modifications.\n\nChange `\u003cRPCPASSWORD\u003e`, `\u003cFILE\u003e` (use the .keys file), and `\u003cPASSWORD\u003e`. Optionally change the daemon address to your own daemon.\n\n```\ndocker run -d --restart unless-stopped --name=\"monero-wallet-rpc\" -p 18081:18081 -v bitmonero:/home/monero sethsimmons/simple-monero-wallet-rpc:latest --rpc-bind-port=18081 --daemon-address=xmr-node.cakewallet.com:18081 --wallet-file=\u003cFILE\u003e.keys --password=\u003cPASSWORD\u003e --rpc-login=monero:\u003cRPCPASSWORD\u003e\ndocker run -d \\\n    --name watchtower --restart unless-stopped \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    containrrr/watchtower --cleanup\n```\n\nConfirm monero-wallet-rpc is started correctly by checking the logs: `docker logs --follow monero-wallet-rpc`\n\n### Setting up a service instead\n\nIf you have issues using Docker (eg: unable to find the wallet file), I recommend manually configuring a service.\n\n#### Initial setup (thanks SethForPrivacy)\n\n```\n# Create a system user and group to run monerod\nsudo addgroup --system monero\nsudo adduser --system --home /var/lib/monero --ingroup monero --disabled-login monero\n\n# Create necessary directories for monerod\nsudo mkdir /var/run/monero\nsudo mkdir /var/log/monero\nsudo mkdir /etc/monero\n\n# Set permissions for new directories\nsudo chown monero:monero /var/run/monero\nsudo chown monero:monero /var/log/monero\nsudo chown -R monero:monero /etc/monero\n```\n\n\nEdit the service script file: `nano /etc/systemd/system/autoforward.service`\n\nPaste the following:\n\n```\n[Unit]\nDescription=Autoforwards with monero-wallet-rpc\nAfter=network.target\n\n[Service]\n# Process management\n####################\n\nType=forking\nPIDFile=/var/run/monero/monerod.pid\nExecStart=/var/lib/monero/monero-wallet-rpc --rpc-bind-port=18081 --daemon-address=xmr-node.cakewallet.com:18081 --wallet-file=/var/lib/monero/autoforward.keys --password=\u003cPASSWORD\u003e --rpc-login=monero:\u003cRPCPASSWORD\u003e --detach\nRestart=on-failure\nRestartSec=30\n\n# Directory creation and permissions\n####################################\n\n# Run as monero:monero\nUser=monero\nGroup=monero\n\n# /run/monero\nRuntimeDirectory=monero\nRuntimeDirectoryMode=0710\n\n# /var/lib/monero\nStateDirectory=monero\nStateDirectoryMode=0710\n\n# /var/log/monero\nLogsDirectory=monero\nLogsDirectoryMode=0710\n\n# /etc/monero\nConfigurationDirectory=monero\nConfigurationDirectoryMode=0710\n\n# Hardening measures\n####################\n\n# Provide a private /tmp and /var/tmp.\nPrivateTmp=true\n\n# Mount /usr, /boot/ and /etc read-only for the process.\nProtectSystem=full\n\n# Deny access to /home, /root and /run/user\nProtectHome=true\n\n# Disallow the process and all of its children to gain\n# new privileges through execve().\nNoNewPrivileges=true\n\n[Install]\nWantedBy=multi-user.target\n\n```\n\nMake sure to change the rpc file path, wallet .keys file path, wallet password, and RPC password.\n\nI was unable to get the wallet to open if the wallet password was provided in a .conf file, so I needed to save the wallet password to the .service file. If you are getting errors about another user having access to the Monero .keys file, then change ownership of the file to the user and group you are running the command from.\n\nDouble-check to ensure that the autoforward files are owned by the `monero` user.\n\nRestart systemctl:\n\n`sudo systemctl daemon-reload`\n\n`sudo systemctl enable autoforward`\n\n`sudo systemctl start autoforward`\n\n## Set up a cron job to autoforward every X minutes\n\nFirst, decide how often you want the command to run. If you want to only forward occasionally, then setting it to every 60 minutes or even 24 hours may be fine. If you want the fastest performance, setting up forwarding every minute is reasonable.\n\nCalculate the necessary operation for timings using [this website](https://crontab.guru). Here are some common ones:\n\n```\n*/5 * * * *`           every 5 minutes\n0 */1 * * *`           every 1 hour\n0 0 * * */1`           every 1 day\n```\n\nSave `autoforward-monero.py`, available in this repo. Make sure to change the address, password, and (if needed) index.\n\nFind where python is on your device.\n\n`type -a python3`\n\nSet up the cron function to run this python command.\n\n`crontab -e`\n\nAppend the following job:\n \n`*/5 * * * * /usr/bin/python3 /var/lib/monero/autoforward-monero.py`\n\n`/usr/bin/python3` is the location of your Python installation. Replace it and the monero-forwarder paths as necessary. Save the file.\n\nEnable the cron service:\n\n`sudo systemctl enable cron.service`\n\nYou're done! The cron task will run every 5 minutes, or whatever other duration you specified.\n\n## Set up a cron job to autoconvert every X minutes\n\nThis uses Kraken. If you want to write a python script for another exchange, then we're happy to add it here!\n\n### Create Kraken API key\n\n[Click here](https://www.kraken.com/u/security/api/new), then create a new API key with the following parameters:\n\n* Choose your own description.\n* Leave the \"Nonce window\" as 0, unless you know why you want to change it.\n* Enable \"Query funds\".\n* Enable \"Create and modify orders\".\n* Recommended: enable IP whitelisting, and add your VPS IP address as the only valid address. IPs can be changed latter without revoking the key.\n\n### Configure cron job\n\nSave `autoconvert-kraken-XXX-to-XXX.py` (selecting your convert from and convert to assets as desired), available in this repo. Make sure to add `API_KEY_KRAKEN` and `API_SEC_KRAKEN`. If your specific convert to and convert from assets aren't supported, use one as a template and modify, or open an issue to request it.\n\nFind where python is on your device.\n\n`type -a python3`\n\nSet up the cron function to run this python command.\n\n`crontab -e`\n\nAppend the following job:\n \n`*/5 * * * * /usr/bin/python3 /root/autoconvert-kraken.py`\n\n`/usr/bin/python3` is the location of your Python installation. Replace it and the autoconvert-kraken paths as necessary. Save the file.\n\nEnable the cron service:\n\n`sudo systemctl enable cron.service`\n\nYou're done! The cron task will run every 5 minutes, or whatever other duration you specified.\n\nTrading will not occur if the balance (and thus the trade size) is below the [minimum order size](https://support.kraken.com/hc/en-us/articles/205893708-What-is-the-minimum-order-size-). As of 2022-12-07, this is 0.02 XMR and 0.0001 BTC.\n\n# Credits\n\nThanks to [Seth](https://sethforprivacy.com) for their docker image, and the initial instructions about Monero node/service hardening.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcake-tech%2Fautoforward-autoconvert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcake-tech%2Fautoforward-autoconvert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcake-tech%2Fautoforward-autoconvert/lists"}