Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 2.17 KB

File metadata and controls

61 lines (41 loc) · 2.17 KB

bitcoin-status-bash

This is small bash script to generate a Bitcoin node status page. It uses simple templating to separate data retrieval and logic from HTML generation.

Table oc Contents

  1. Requirements
  2. Getting Started
  3. Configuration
  4. Licensing

Requirements

To run this script, you will need:

  • A Bitcoin node.
  • The bitcoin client bitcoin-cli with access to the bitcoin node.
  • A web-server to deliver the generated html file.*

Getting Started

On a standard bitcoin core node, bitcoin-cli is installed at /usr/local/bin and has access to the bitcoind when you run it as the user you installed the bitcoind configuration. So all you need is bash and sed and any web server set up to deliver your status page.

Copy the files in the app directory to your bitcoin node, i.e. in the home directory of your bitcoin user. Create a directory that serves as the docroot of your status page and set this directory as the outputdir in the configuration part of refreshe_status_page. Make sure that refresh_status_page is executable (chmod +x generate_status_page).

Run the script every 10 minutes by adding to your crontab:

*/10 * *   *   *     /path/to/your/refresh_status_page

Configuration

At the beginning of the script, you can set several variables:

  • outputdir - the directory where the files are generated/copied
  • donation_address - a Bitcoin address to recieve donations
  • qr_image - the path to a qr code image with your Bitcoin adress
  • IP - the IP address of your bitcoin node

And of cause you can adjust the HTML template status_template. In the template you can use all the variables that you have set in the configuration section and all the values that are returned by bitcoin-cli getinfo. Usefull parameters are:

  • version
  • protocolversion
  • blocks
  • connections
  • difficulty

These are set as shell variables so insert them as ${variable}.

Important

As the templates is evaluated by the shell, properly escape all double quotes.

Licensing