2022-10-14 04:50:12 +02:00
|
|
|
# lbcdbloknotify
|
2022-01-04 18:52:39 +01:00
|
|
|
|
2022-10-14 04:50:12 +02:00
|
|
|
This bridge program subscribes to lbcd's notifications over websockets using the rpcclient package.
|
|
|
|
Users can specify supported actions upon receiving this notifications.
|
2022-01-04 18:52:39 +01:00
|
|
|
|
2022-10-14 04:50:12 +02:00
|
|
|
## Building(or Running) the Program
|
2022-01-04 18:52:39 +01:00
|
|
|
|
2022-10-14 04:50:12 +02:00
|
|
|
Clone the lbcd package:
|
2022-01-04 18:52:39 +01:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ git clone github.com/lbryio/lbcd
|
2022-10-14 04:50:12 +02:00
|
|
|
$ cd lbcd/rpcclient/examples
|
|
|
|
|
|
|
|
# build the program
|
|
|
|
$ go build .
|
|
|
|
|
|
|
|
# or directly run it (build implicitly behind the scene)
|
|
|
|
$ go run .
|
2022-01-04 18:52:39 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Display available options:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ go run . -h
|
|
|
|
|
|
|
|
-coinid string
|
|
|
|
Coin ID (default "1425")
|
|
|
|
-rpcpass string
|
|
|
|
LBCD RPC password (default "rpcpass")
|
|
|
|
-rpcserver string
|
|
|
|
LBCD RPC server (default "localhost:9245")
|
|
|
|
-rpcuser string
|
|
|
|
LBCD RPC username (default "rpcuser")
|
|
|
|
-stratum string
|
|
|
|
Stratum server (default "lbrypool.net:3334")
|
|
|
|
-stratumpass string
|
|
|
|
Stratum server password (default "password")
|
2022-09-24 02:48:05 +02:00
|
|
|
-quiet
|
2022-10-14 04:50:12 +02:00
|
|
|
Do not print periodic logs
|
2022-01-04 18:52:39 +01:00
|
|
|
```
|
|
|
|
|
2022-10-14 04:50:12 +02:00
|
|
|
Running the program:
|
2022-01-04 18:52:39 +01:00
|
|
|
|
|
|
|
```bash
|
2022-10-14 04:50:12 +02:00
|
|
|
# Send stratum mining.update_block mesage upon receving block connected notifiations.
|
|
|
|
$ go run . -rpcuser <RPC USERNAME> -rpcpass <RPC PASSWD> --notls -stratum <STRATUM SERVER> -stratumpass <STRATUM PASSWD>
|
2022-01-04 18:52:39 +01:00
|
|
|
|
2022-10-14 04:50:12 +02:00
|
|
|
2022/01/10 23:16:21 Current block count: 1093112
|
2022-01-04 18:52:39 +01:00
|
|
|
...
|
2022-10-14 04:50:12 +02:00
|
|
|
|
|
|
|
# Execute a custome command (with blockhash) upon receving block connected notifiations.
|
|
|
|
$ go run . -rpcuser <RPC USERNAME> -rpcpass <RPC PASSWD> --notls -run "echo %s"
|
2022-01-04 18:52:39 +01:00
|
|
|
```
|
|
|
|
|
2022-10-14 04:50:12 +02:00
|
|
|
## Notes
|
|
|
|
|
|
|
|
* Stratum TCP connection is persisted with auto-reconnect. (retry backoff increases from 1s to 60s maximum)
|
|
|
|
|
|
|
|
* Stratum update_block jobs on previous notifications are canceled when a new notification arrives.
|
|
|
|
Usually, the jobs are so short and completed immediately. However, if the Stratum connection is broken, this
|
|
|
|
prevents the bridge from accumulating stale jobs.
|
|
|
|
|
2022-01-04 18:52:39 +01:00
|
|
|
## License
|
|
|
|
|
|
|
|
This example is licensed under the [copyfree](http://copyfree.org) ISC License.
|