A Python Script that communicates with your x42-FullNode.
The script will check your x42-FullNode every 60 seconds to determine if you have staked a block or received an x42 deposit. If a block has been staked, you will receive an "App" Notification via IFTTT. If a deposit is received, a similar alert will trigger notifying how much was deposited. Both alerts will contain the TX id.
- x42-FullNode
- Python 3.x
(Personal Preference: Python3-dev [sudo apt install python3-dev])
- Pip3
sudo apt install python3-pip
- Requests
pip3 install requests
- Emoji
pip3 install emoji
- IFTTT Account and Application
- General edits that need to be made in
ifttt.py
:apiBase="http://IP:42220/api/"
- Replace IP based on node configuration with either127.0.0.1
,localhost
or the INTERNAL IP (ex.192.168.1.205
) of the Node. The x42.conf may need editing, check Side-Notes for more informationwalletName="NAME"
- Replace NAME with your x42 Wallet name (NAME
.wallet.json
, do not append.wallet.json
)r.post("https://maker.ifttt.com/trigger/TRIGGERNAME/with/key/APIKEY", data=)
- There are 3 entries ofr.post()
that need edits. Replace TRIGGERNAME with the IFTTT Event Name and the APIKEY with your Webhooks URL (ex.WbSpblmUBWY16RH5AtTWORSbwJNpFH8zKVNckNtP095
)
You have a few options on how to run the script. You can run it on a separate device within the same network, or on the device running the x42-FullNode.
- Same Device - Use nohup (Linux and Mac)... Command:
nohup python3 -u ifttt.py &
- press Enter twice and you're done.- Nohup will output information to
nohup.out
- Nohup will output information to
- Separate Device - Use the regluar command
python3 ifttt.py
OR the nohup command above.
- If you ONLY have Python 3.x installed without Python 2.x you can use the command
python ifttt.py
instead ofpython3 ifttt.py
- Nohup is not available for Windows. A possible alternative to run minimized is
start /min python ifttt.py
- Take this command with a grain of salt though as I use Linux not Windows. You may have access to nohup if you're using WSL on Windows 10.
- Nohup is not available for Windows. A possible alternative to run minimized is
- This script REQUIRES 3 IFTTT applets:
- Staked:
Block staked! {{Value1}}Your new x42 balance is: {{Value2}} {{Value3}}Reported on: {{OccurredAt}}
- Received:
{{Value1}}Your new x42 balance is: {{Value2}} {{Value3}}Reported on: {{OccurredAt}}
- Connection Error:
The connection was refused while checking your Balance. Your x42 Node may be down! {{Value1}}Retrying in 30s...{{Value2}} Reported on: {{OccurredAt}}
- Staked:
Create the Applet(s):
- My Applets
- New Applet
- if THIS = Webhooks
- Trigger = Receive a Web Request
- TRIGGERNAME
(stake, received, connect_error)
- Then = Notifications
- Send a notification from the IFTTT app
- Message = use config(s) above.
- Create Action
- For my personal configuration (not advised), I adjusted the
x42.conf
and edited the lineapiuri=
under####API Settings####
. Setapiuri=http://0.0.0.0
to allow the use of the internal IP and/or localhost in theapiBase
rather than127.0.0.1
only.- NOTE: Port 42220 is NOT open externally and I DO NOT advise opening it EVER. Leave the port CLOSED to prevent external network access to your node api.
- If you're using a VPS:
- Do NOT edit the
apiuri
in thex42.conf
. - Set the
apiBase
IP to127.0.0.1
. - If you're not binding the port to your local system, use the Same Device option in the How-To.
- If you are binding the port locally, you will still use
127.0.0.1
for the IP in theapiBase
using the Separate Device option in the How-To instead.
- Do NOT edit the
- x42: XKCm56Q4GmxRYbk3aS8seAQaHdtUDpgEfx
- BTC: 145QLo9jopWK3Z7h43fEgTy7AbUA239Ghz
- LTC: LVkLucNkv43Zwpqx1Vb1mymnQR2YLPXzZR
- Add IFTTT Python Script
- IFTTT Applet Configurations
- IFTTT Notification Image(s)/Preview
-
Re-organize readme? (:thinking:) - Add License
- Script Adjustments? (possibly add
x42 sent
alert) - ?