github.com/lbryio/lbcd@v0.22.119/rpcclient/examples/lbcdblocknotify/README.md (about)

     1  # lbcdbloknotify
     2  
     3  This bridge program subscribes to lbcd's notifications over websockets using the rpcclient package.
     4  Users can specify supported actions upon receiving this notifications.
     5  
     6  ## Building(or Running) the Program
     7  
     8  Clone the lbcd package:
     9  
    10  ```bash
    11  $ git clone github.com/lbryio/lbcd
    12  $ cd lbcd/rpcclient/examples
    13  
    14  # build the program
    15  $ go build .
    16  
    17  # or directly run it (build implicitly behind the scene)
    18  $ go run .
    19  ```
    20  
    21  Display available options:
    22  
    23  ```bash
    24  $ go run . -h
    25  
    26    -coinid string
    27          Coin ID (default "1425")
    28    -rpcpass string
    29          LBCD RPC password (default "rpcpass")
    30    -rpcserver string
    31          LBCD RPC server (default "localhost:9245")
    32    -rpcuser string
    33          LBCD RPC username (default "rpcuser")
    34    -stratum string
    35          Stratum server (default "lbrypool.net:3334")
    36    -stratumpass string
    37          Stratum server password (default "password")
    38    -quiet
    39          Do not print periodic logs
    40  ```
    41  
    42  Running the program:
    43  
    44  ```bash
    45  # Send stratum mining.update_block mesage upon receving block connected notifiations.
    46  $ go run . -rpcuser <RPC USERNAME> -rpcpass <RPC PASSWD> --notls -stratum <STRATUM SERVER> -stratumpass <STRATUM PASSWD>
    47  
    48  2022/01/10 23:16:21 Current block count: 1093112
    49  ...
    50  
    51  # Execute a custome command (with blockhash) upon receving block connected notifiations.
    52  $ go run . -rpcuser <RPC USERNAME> -rpcpass <RPC PASSWD> --notls -run "echo %s"
    53  ```
    54  
    55  ## Notes
    56  
    57  * Stratum TCP connection is persisted with auto-reconnect. (retry backoff increases from 1s to 60s maximum)
    58  
    59  * Stratum update_block jobs on previous notifications are canceled when a new notification arrives.
    60    Usually, the jobs are so short and completed immediately.  However, if the Stratum connection is broken, this
    61    prevents the bridge from accumulating stale jobs.
    62  
    63  ## License
    64  
    65  This example is licensed under the [copyfree](http://copyfree.org) ISC License.