17 Commits

Author SHA1 Message Date
sword-smith
5c81a94487 Add endpoint for providing a PoW solution 2025-08-21 09:10:40 +02:00
sword-smith
1d8aa52902 Add endpoint for fetching address-specific pow puzzle 2025-08-21 08:48:39 +02:00
danda
af5496ed11 feat: monitor for stalled chain and send alert
closes #7.

adds a blockchain watchdog that checks every hour if the tip height has
advanced or not.  Sends alert email if height is less or equal to
height at the last check and enters a warning mode.  In warning mode
it waits until the height is greater than previous, and then sends a
recovery alert and switches to normal mode.
2024-12-31 17:39:11 -08:00
danda
508f6ecc28 feat: add --smtp-port
Enables changing the smtp-port for alert emails.

Also enables two additional smtp modes: opportunistic and plaintext.
2024-05-28 15:39:46 -07:00
danda
c2fe657e04 perf: replace RwLock with ArcSwap
ArcSwap is lock-free and optimized for our use-case of lots of
concurrent reads and infrequent updates.

So it is pretty close to a shared-nothing architecture.

Some small changes were necessary, but its mostly a drop-in
replacement for RwLock.
2024-05-27 17:24:01 -07:00
danda
71cf752b41 feat: add neptune-core rpc connection watchdog
closes #1

Implements a background watchdog task that:
1. calls neptune-core /network rpc every N seconds (default: 10)
2. emits log message on any state change
3. sends detailed email alert to admin on any state change

Changes:
* AppState now has internal Arc<RwLock<AppStateInner>> to permit
  watchdog task to mutate the rpc_client field.
* adjust application to AppState changes (use locks)
* not_found functions no longer accept state arg
* move state initialization into AppState::init()
* add optional alert parameters: admin-email, smtp-*
* add neptune_rpc module with watchdog task
* add alert_email module
* simplify main()
* log warnings if alert parameters not set
* add chrono dep
* add lettre dep
2024-05-25 19:16:36 -07:00
danda
d99fe3ff84 feat: add --listen-port and rename --port
Changes:
 * adds --listen-port for specifying http port to listen on.
 * renames --port to --neptune-rpc-port which is clearer
 * updates README accordingly
2024-05-22 19:41:21 -07:00
danda
e4fda1a806 refactor: add anyhow, remove unwrap/expect
converts unwrap and expect calls in main.rs into anyhow .with_context()
calls to provide better error messages
2024-05-22 19:39:46 -07:00
danda
0c54b50b83 refactor: use wildcard paths, remove dup handlers
We use axum route wildcards to merge duplicate page routes and handlers
into a single route and handler.

This makes the routes simpler/cleaner as well as the handlers, as there
is now just one of each for each html page.

Previous:
   .route("/block/:selector", get(block_page))
   .route("/block/:selector/value", get(block_page_with_value))

New:
   .route("/block/*selector", get(block_page))

This is achieved by replacing PathBlockSelector with
BlockSelectorExtended which wraps BlockSelector to provide parsing for
height_or_digest/value.  (which is needed for javascript-free input
form)

Changes:
 * merge dup handlers for each of block, block_digest, block_info
 * merge routes for same
 * add BlockSelectorExtended and HeightOrDigest
 * remove PathBlockSelector
2024-05-22 17:18:51 -07:00
danda
29834dbe50 feat: get rid of all javascript
implements a generic solution to redirect query strings generated by
forms to path based URIs that can be handled by existing routes.

This eliminates the need for javascript that was doing the equivalent
client-side.
2024-05-22 17:18:51 -07:00
danda
faf303bbdd feat: integrate team feedback
Changes:
 + present not-found page for unhandled uri paths, eg /stuff
 + display the tip-height on front page
 + add favicon and neptune logo to front page
 + use ServerDir instead of ServeFile for /image and /css
 + add help tooltips for fields on front page
 + use monospace font for digests
2024-05-22 17:18:51 -07:00
danda
ac27329bda chore: update to neptune-core tip
adapts to some changes in neptune-core.

BlockInfo and BlockSelector location changed.
2024-05-22 17:18:50 -07:00
danda
0f9cbdf0b4 feat: pico css styling and not-found page.
Changes:

 1. integrates pico minimal responsive css framework for light/dark
    themes and overall better looks.

 2. adds a not-found page for bad url queries.

 3. catches axum/serde deserialization errors of user input and routes
    them to the not-found page with a helpful hint (parse error msg)
2024-05-22 17:18:50 -07:00
danda
e53d80d9fa chore: move src/web --> templates/web 2024-05-22 17:18:50 -07:00
danda
7fa11f3ec2 refactor: break main.rs into separate files 2024-05-22 17:18:50 -07:00
danda
4509b1f9a6 feat: add boilerplate templates, utxo page 2024-05-22 17:18:50 -07:00
danda
951758902a initial commit of neptune-explorer files 2024-05-22 17:18:46 -07:00