| Crates.io | twisterad |
| lib.rs | twisterad |
| version | 0.3.1 |
| created_at | 2025-04-01 17:31:17.008584+00 |
| updated_at | 2025-04-11 21:35:49.723514+00 |
| description | Rotate twister ads |
| homepage | https://twisterarmy.github.io |
| repository | https://github.com/twisterarmy/twisterad |
| max_upload_size | |
| id | 1615172 |
| size | 34,427 |
Lightweight, in-memory CLI tool & daemon to rotate multiple twister ads on single worker, through modified Bitcoin Core JSON-RPC API library.
Optimal to run as systemd unit that waits for twisterd connection and then begins updating promotional messages with each new block found.
Check out config.json to setup remote or local twisterd connection and update default promotions asset!
See also the project Wiki and The twister P2P Book for more details!
[!NOTE] Stable snaps with pre-compiled binaries available on the Releases page
To install usingcargo, follow rustup instructions to continue with the steps below
cargo install twisterad
twisterad -c path/to/config.jsongit clone https://github.com/twisterarmy/twisterad.gitcd twisteradcargo run -- -c path/to/config.jsonUsage: twisterad [OPTIONS] --config <CONFIG>
Options:
-c, --config <CONFIG> Configuration file, required
-d, --delay <DELAY> Rotation queue delay, seconds [default: 60]
--host <HOST> RPC host [default: 127.0.0.1]
-j, --jobs <JOBS> Processor jobs to mine at once
-l, --latency <LATENCY> Miner latency in seconds, useful when blocks are being generated too quickly
-m, --mode <MODE> Rotation mode: * `c` - cycle * `s` - stop, disable worker [default: c]
-p, --password <PASSWORD> RPC password [default: pwd]
--port <PORT> RPC port [default: 28332]
-r, --rotations <ROTATIONS> Rotations quantity, before apply rotation `mode`
-s, --scheme <SCHEME> RPC scheme [default: http]
-u, --user <USER> RPC user [default: user]
-w, --wait <WAIT> Wait to server reconnect, seconds [default: 900]
-h, --help Print help
-V, --version Print version
To run twisterad as the systemd unit (background process):
cd twisterad - navigate sources directorycargo build --release - compile optimized binaryuseradd twisterad - create new user for twisterad processcp target/release/twisterad /usr/bin/twisterad - copy binary into native system locationchmod 0700 /usr/bin/twisterad - give required permissionschown twisterad:twisterad /usr/bin/twisterad - allow user/group accessmkdir /var/log/twisterad - create destination for the logscp config.conf /etc/twisterad.conf - copy and customize default configCreate new systemd configuration file: nano /etc/systemd/system/twisterad.service
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=twisterad
Group=twisterad
ExecStart=/usr/bin/twisterad -c /etc/twisterad.conf
StandardOutput=file:/var/log/twisterad/debug.log
StandardError=file:/var/log/twisterad/error.log
[Install]
WantedBy=multi-user.target
null for StandardOutput or StandardErrorApply changes:
systemctl daemon-reload - reload unit configurationsystemctl enable - start on system bootsystemctl start twisterad - launchsystemctl status twisterad - check service statusOn change config.json:
systemctl restart twisterad
[!NOTE] After launch,
twisteradlistens for thetwisterdconnection to be established, and then begins rotation according to the configuration and startup arguments;When
twisterdconnection is lost,twisteradwill wait for reconnection and continue rotation from the previous memory state. It could be also useful for the desktop users, who running theirtwisterdnodes periodically.