Notify block mint results and Next Block Schedule to any message platform.
Japanese, English, Portuguese, Spanish, French, Korean, Thai, and Vietnamese
LINE / Discord / Slack / Telegram
English Ver.
-
It is necessary to set up cncli.sh developed by the guild operator in advance. https://cardano-community.github.io/guild-operators/Scripts/cncli/
-
This program must be installed on the server where cncli.sh and the accompanying CNCLI blocklog are set up.
Update OS Packages
sudo apt update && sudo apt upgrade -yCheck python version
python3 -VPython 3.10 over
If you have Python 3.9 or lower, please use this tool to update.
cd
wget https://raw.githubusercontent.com/btbf/spojapanguild/master/scripts/pythonUpdate.sh
chmod +x pythonUpdate.sh
./pythonUpdate.sh
Install dependencies
sudo apt install -y build-essential libssl-dev libffi-dev python3-dev python3-pip python3-testresourcespip3 install watchdog pytz python-dateutil requests discordwebhook slackweb i18niceDownload the executable script and configuration file
bn_release="$(curl -s https://api.github.com/repos/btbf/block-notify/releases/latest | jq -r '.tag_name')"
wget https://github.com/btbf/block-notify/archive/refs/tags/${bn_release}.tar.gz -P $NODE_HOME/scripts
cd $NODE_HOME/scripts
tar zxvf ${bn_release}.tar.gz block-notify-${bn_release}/block_notify.py block-notify-${bn_release}/config.ini block-notify-${bn_release}/i18n/
mv block-notify-${bn_release} block-notify
rm ${bn_release}.tar.gzEditing Configuration Files
cd block-notify
nano config.ini
| item | Valus | usage |
|---|---|---|
pool_ticker |
ex.) SJG | pool ticker name |
notify_language |
english:enjapanese: jaPortuguese: ptFrench: frSpanish: es |
notification language |
notify_timezone |
Asia/Tokyo Timezone List |
Specify yourTimezone |
notify_platform |
LineDiscordSlackTelegram |
Specify the platform to be notified (Multiple designations are invalid.) |
notify_level |
All:AllOther Confirm: ExceptCofirmOnly Miss: OnlyMissed |
Set notification level |
nextepoch_leader_date |
Only Summary:SummaryOnlySummary and date: SummaryDate |
Notification of next epoch schedule date/time If you do not want the list of next epoch schedule dates to flow to notifications, please include SummaryOnly. |
line_notify_token |
Line notify token id | Enter Line Notify token |
discord_webhook_url |
discord_webhook_url | Enter discord_webhook_url |
slack_webhook_url |
slack web hookurl | Enter slack web hookurl |
telegram_token |
Telegram API Token | Enter Telegram API Token |
telegram_id |
Telegram Chat id | Enter Telegram Chat id |
node_home |
ex.)/home/usr/cnode |
Enter 'node_home' Directory Path |
guild_db_dir |
ex.)%(node_home)s/guild-db/blocklog/ |
Enter the path to guild-db Do not change %(node_home)s as it is a variable |
shelley_genesis |
ex.)%(node_home)s/files/shelley-genesis.json |
Enter the file path for shelley_genesis Do not change %(node_home)s as it is a variable |
byron_genesis |
ex.)%(node_home)s/files/byron-genesis.json |
Enter the file path for byron_genesis Do not change %(node_home)s as it is a variable |
cat > $NODE_HOME/service/cnode-blocknotify.service << EOF
# file: /etc/systemd/system/cnode-blocknotify.service
[Unit]
Description=Cardano Node - SPO Blocknotify
BindsTo=cnode-cncli-sync.service
After=cnode-cncli-sync.service
[Service]
Type=simple
User=$(whoami)
WorkingDirectory=${NODE_HOME}/scripts/block-notify
ExecStart=/bin/bash -c 'cd ${NODE_HOME}/scripts/block-notify/ && python3 -u block_notify.py'
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cnode-blocknotify
[Install]
WantedBy=cnode-cncli-sync.service
EOFsudo cp $NODE_HOME/service/cnode-blocknotify.service /etc/systemd/system/cnode-blocknotify.service
sudo chmod 644 /etc/systemd/system/cnode-blocknotify.service
sudo systemctl daemon-reload
sudo systemctl enable cnode-blocknotify.service
Activate SPO BlockNotify
sudo systemctl start cnode-blocknotify.service
Add an alias for checking logs to the environment variable
echo alias blocknotify='"journalctl --no-hostname -u cnode-blocknotify -f"' >> $HOME/.bashrc
Environment variable reloading
source $HOME/.bashrc
Startup Confirmation
blocknotify
The following indications are fine.
[xxx] SPO Block Notify has been started.
日本語 Ver.
-
事前にギルドオペレータが開発したcncli.shのセットアップが必要です。 https://cardano-community.github.io/guild-operators/Scripts/cncli/
-
このプログラムはcncli.shと付随するCNCLI blocklogがセットアップされたサーバーへインストールする必要があります。
-
SPO JAPAN GUILDマニュアルを使用している場合は、こちらのセットアップガイドをご参照ください。
Python環境をセットアップする
パッケージを更新する
sudo apt update && sudo apt upgrade -ypythonバージョンを確認する
python3 -VPython 3.10以上
Python 3.9以下の場合こちらのツールでアップデートしてください
cd
wget https://raw.githubusercontent.com/btbf/spojapanguild/master/scripts/pythonUpdate.sh
chmod +x pythonUpdate.sh
./pythonUpdate.sh
依存関係をインストールする
sudo apt install -y build-essential libssl-dev libffi-dev python3-dev python3-pip python3-testresourcespip3 install watchdog pytz python-dateutil requests discordwebhook slackweb i18nice実行スクリプトと設定ファイルをダウンロードする
bn_release="$(curl -s https://api.github.com/repos/btbf/block-notify/releases/latest | jq -r '.tag_name')"
wget https://github.com/btbf/block-notify/archive/refs/tags/${bn_release}.tar.gz -P $NODE_HOME/scripts
cd $NODE_HOME/scripts
tar zxvf ${bn_release}.tar.gz block-notify-${bn_release}/block_notify.py block-notify-${bn_release}/config.ini block-notify-${bn_release}/i18n/
mv block-notify-${bn_release} block-notify
rm ${bn_release}.tar.gz設定ファイルの編集
cd block-notify
nano config.ini
| 項目 | 値 | 使用用途 |
|---|---|---|
pool_ticker |
ex.) SJG | プールティッカー名を入力する |
notify_language |
英語:en日本語: jaポルトガル語: ptフランス語: frスペイン語: es |
通知言語を入力する |
notify_timezone |
Asia/Tokyo タイムゾーン一覧 |
お住いのタイムゾーンを指定する |
notify_platform |
LineDiscordSlackTelegram |
通知先プラットフォームを指定する (複数指定は無効) |
notify_level |
全て:AllConfirm以外: ExceptCofirmMissのみ: OnlyMissed |
通知基準を設定する |
nextepoch_leader_date |
概要のみ:SummaryOnly概要と日付: SummaryDate |
次エポックスケジュール日時の通知有無 次エポックスケジュール日付一覧を通知に流したくない場合は SummaryOnlyを記載してください |
line_notify_token |
LINE設定の(8)で発行したトークンID | Line Notifyトークンを入力する |
discord_webhook_url |
Discord設定の(7)で発行したウェブフックURL | DiscordウェブフックURLを入力する |
slack_webhook_url |
Slack設定の(4)で発行したWebhook URL | SlackウェブフックURLを入力する |
telegram_token |
Telegram設定の(5)で発行したAPIトークン | Telegram APIトークンを入力する |
telegram_id |
Telegram設定の(9)で表示されたChat id | Telegram ChatIDを入力する |
node_home |
ex.)/home/usr/cnode |
node_homeディレクトリパスを入力する |
guild_db_dir |
ex.)%(node_home)s/guild-db/blocklog/ |
guild-dbのパスを入力する%(node_home)sは変数のため変更しないでください |
shelley_genesis |
ex.)%(node_home)s/files/shelley-genesis.json |
shelley_genesisのファイルパスを入力する%(node_home)sは変数のため変更しないでください |
byron_genesis |
ex.)%(node_home)s/files/byron-genesis.json |
byron_genesisのファイルパスを入力する%(node_home)sは変数のため変更しないでください |
cat > $NODE_HOME/service/cnode-blocknotify.service << EOF
# file: /etc/systemd/system/cnode-blocknotify.service
[Unit]
Description=Cardano Node - SPO Blocknotify
BindsTo=cnode-cncli-sync.service
After=cnode-cncli-sync.service
[Service]
Type=simple
User=$(whoami)
WorkingDirectory=${NODE_HOME}/scripts/block-notify
ExecStart=/bin/bash -c 'cd ${NODE_HOME}/scripts/block-notify/ && python3 -u block_notify.py'
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cnode-blocknotify
[Install]
WantedBy=cnode-cncli-sync.service
EOFsudo cp $NODE_HOME/service/cnode-blocknotify.service /etc/systemd/system/cnode-blocknotify.service
sudo chmod 644 /etc/systemd/system/cnode-blocknotify.service
sudo systemctl daemon-reload
sudo systemctl enable cnode-blocknotify.service
SPO BlockNotifyを起動する
sudo systemctl start cnode-blocknotify.service
環境変数にログ確認用エイリアスを追加する
echo alias blocknotify='"journalctl --no-hostname -u cnode-blocknotify -f"' >> $HOME/.bashrc
環境変数再読み込み
source $HOME/.bashrc
起動確認
blocknotify
以下の表示なら正常です。
[xxx] ブロック生成ステータス通知を起動しました

