Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/odnoletkov/tzkt-push-balance
tzkt-push-balance
https://github.com/odnoletkov/tzkt-push-balance
Last synced: 11 days ago
JSON representation
tzkt-push-balance
- Host: GitHub
- URL: https://github.com/odnoletkov/tzkt-push-balance
- Owner: odnoletkov
- Created: 2022-10-15T02:18:53.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-16T15:14:17.000Z (about 2 years ago)
- Last Synced: 2024-12-13T21:07:45.437Z (11 days ago)
- Language: Clojure
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TZKT Push Balance Demo
WebSocket server that tracks Tezos blockchain progress and pushes balance updates to connected clients.
* Client POV:
* Connects via WebSocket to track specific Tezos address
* Receives current balance on initial connection
* Receives 'real time' balance updates
* Exactly one update per each relevant transaction
* Balance updates are strictly ordered* Server POV:
* Fetches balance for specific Tezos address ~once (barring racing clients and level coordination between APIs)
* Tracks blockchain progress via poll
* Fails explicitly on network errors
* Uses [TZKT REST APIs](https://api.tzkt.io):
* [/operations/transactions](https://api.tzkt.io/#operation/Operations_GetTransactions)
* [/accounts/{address}](https://api.tzkt.io/#operation/Accounts_GetByAddress)
* Assumes response body is always consistent with `tzkt-level` header
* Relies on eventual `tzkt-level` coordination between APIs for progress (not for correctness)## Install
brew install clojure
## Run Server
PORT=3000 clj -M -m server.core
## Test with curl
curl --no-buffer \
--header "Upgrade: websocket" \
--header "Sec-WebSocket-Key: ." \
localhost:3000/ws/tz1dtzgLYUHMhP6sWeFtFsHkHqyPezBBPLsZSample output:
```
?
5405017337?
5405067337?
5405073562?
5405081062?
5405106062
```