![image.png](https://files.peakd.com/file/peakd-hive/crypto-shots/EpA8j33LxpfEX1y7gNA1j4k2UfJLGJ7wyp6wGoXTwrGjwKdrSjiSk8JrRXihaeUjzxR.png) ![image.png](https://files.peakd.com/file/peakd-hive/crypto-shots/23xyQce79HZgod1KH9hhEKVeosz1xK1HBeJES5mXWNVTqL7Sfumo7ptsY6VKKqVwyWqtU.png)
AI image generated starting from a screenshot of our game

**`npm hiverewards`** is out on @cryptoshots.nft's **GitHub** as an Open Source library! ##### https://github.com/Crypto-Shots/Hive-Earnings   A new npm library designed to make it easier for both end users and developers to **track HIVE-based earnings** and **reliably interact with the Hive ecosystem APIs** for different purposes. ----- - Have you ever wondered how much you earned from a Hive game or project in the past week/month? - Have you spent hours/days wiring up a Hive app just to later find out that it's misbehaving because of a node issue?   Hive Rewards is here to simplify your life. With a very little coding experience you can now execute some queries to find out your daily/weekly/monthly earnings. Run such searches in your HTML page, directly in a terminal, or in your NodeJS scripts/backend. ----- `npm hiverewards` takes care of all the plumbing under the hood: 💰 **Automatic price lookups** and **$ conversions**, so you always know the dollar value you received in any specific time range. 👨‍🔧 **Retry mechanisms, node switching, smart caching** and **exponential back-off** - meaning for example no surprises when a node hiccups. 🏥 **Health checks** to ensure the node is available before trying to fetch your data. -----   Hive Rewards offers two SDKs out of the box: 1. **Hive Earnings SDK** - Quickly compute how much **HIVE and Hive-Engine tokens** each target user has received over any time window (hours, days, weeks, or months). - Handy insights for project owners/maintainers: monitor token distributions for marketing campaigns or manage your tokenomics with confidence. - Rather than (or on top of) storing user data in a database that you maintain, hiverewards allows you to pull player earnings straight from the Hive and Hive-Engine blockchains. No centralized ledger required. Or run it alongside your existing system as an audit tool, comparing your database reward records against the on-chain data to spot any discrepancies or anomalies.   2. **Hive & Hive-Engine API wrappers** with automatic node switching - Forget manually configuring endpoints or handling flaky RPC calls — our methods like `hiveApiCall()` and `hiveEngineApiCall()` will automatically and gracefully rotate and retry using other healthy nodes when one fails. - Extendable to any sidechain — the same pattern applies whether you’re talking to Hive Engine today or a brand-new chain tomorrow.
-----
**Project Readme**
  📑 **CONTENTS**
- 💸 **[Hive Rewards]()** [usage – NodeJS & Browser](#usage---nodejs--browser) - [CLI Usage](#usage---cli) - [Custom Configuration](#configuration)
- 😺 **[Peakd’s Beacon Wrapper](#peakds-beacon-wrapper)**  and  **[Hive / HiveEngine API Wrappers](#peakds-beacon-wrapper)**   - 😺 **[Usage in Crypto Shots](#usage-in-crypto-shots)**
----- # Hive Rewards An SDK for Node.js and the browser, and a command‑line tool to scan HIVE and Hive‑Engine token transfers: - **Inbound** — sum HIVE & tokens and USD value received by specified accounts, tracking specific sender accounts. - **Outbound** — map all recipients, tokens and USD values sent by a given sender. --- ## Usage - NodeJS and Browser ```js import { hiveRewards } from 'hiverewards'; const analyzer = await hiveRewards({ verbose: true }); const inbound = await analyzer.inbounds({ receivers: ['zillionz', 'obifenom'], hiveSenders: { PVP_HIVE: 'cryptoshots.tips' }, tokenSenders: { PVP_TOKENS: 'cryptoshots.tips' }, hours: 2, }); console.log(inbound); const outbound = await analyzer.outbounds({ senders: ['cryptoshots.tips', 'karina.gpt'], ignoredReceivers: ['keychain.swap'], days: 1, }); console.log(outbound); ``` #### Self-hosted bundle A bundled build can be generated with Webpack: 1. Clone the project 2. Build it with ```bash npm run build:web # outputs dist/hiverewards.bundle.js ``` 3. Host the generated dist folder on your server 4. Import it in your frontend and use it this way: ```html ``` ----- ## Usage - CLI ```bash git clone cd npm install ``` ```bash npm start -- --inbound obifenom zillionz --from pvpRewards=cryptoshots.tips pveRewards=cryptoshotsdoom --hours 24 ```
https://files.peakd.com/file/peakd-hive/crypto-shots/Enyo2YyRrVSqz9NbmC8uW6ud7WifLhwRp9z1P6JDSqJ6NK5v4z3nrFFR5CLc9EavQ9p.PNG
```bash npm start -- --outbound cryptoshots.tips karina.gpt --days 1 ```
https://files.peakd.com/file/peakd-hive/crypto-shots/23sweHokLUFCRSzr4uBHmJgaGz1BfTPehosLx4Bxn9dEan9mjT5rxoQGAh8ugbG2kJEfz.PNG
Note: append `--verbose` for verbose logging ----- ## Configuration | Env var | Default | |-------------------------------|----------------------------------------------------------------| | `HIVE_PRICE_URL` | `https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd` | You can also override the initial Hive / Hive Engine node by passing a config object to the `hiveRewards()` factory in code. eg. ```js const analyzer = await hiveRewards({ hiveNodeUrl: 'https://your.hive.node', hiveEngineRpcUrl: 'https://your.he.rpc', hiveEngineHistoryUrl: 'https://your.he.history', }); ``` **Other Overrides:** | Constructor Attribute | Description | Default | |-------------------------------|---------------------------|-----------------------------| | fetch | Fetch API implementation | `npm cross-fetch`| | hiveJs | pass in another @hiveio/hive-js version, if needed | v2 | | log | custom logger | console | | apiCallsDelay | default wait time for api call retries | 500 (with exp backoff) | | priceCacheMins | how long Hive price is cached for | 10 mins | | hiveHistoryLimit | page size (max account‐history ops per call) | 500 | | heHistoryLimit | page size (max Hive-Engine history records per call) | 250 |
--- # Peakd's Beacon Wrapper Wrapper for [@peakd](https://peakd.com/@peakd)'s [Beacon](https://beacon.peakd.com) APIs. **Usage:** ```js import { peakdBeaconWrapper } from 'hiverewards'; const { getHealthyHiveNode, getHealthyHeNode, getHealthyHeHistoryNode } = peakdBeaconWrapper; const hiveUrl = await getHealthyHiveNode(); const heUrl = await getHealthyHeNode(); const hehUrl = await getHealthyHeHistoryNode(); // Now you can configure your client: hiveApi.api.setOptions({ url: hiveUrl }); ``` ...our use our Hive / Hive Engine **client wrappers** that automatically rotate healthy nodes: ```js import { healthyApisWrapper } from 'hiverewards'; const { hiveApiCall, hiveEngineApiCall, hiveEngineHistoryApiCall } = healthyApisWrapper; const history = await hiveApiCall('getAccountHistory', ['cryptoshotsdoom', -1, 10]); console.log(history); const metrics = await hiveEngineApiCall({ jsonrpc: '2.0', method: 'find', params: { contract: 'market', table: 'metrics', query: { symbol: 'DOOM' }, limit: 1, offset: 0 }, id: 1 }); console.log(metrics); const history = await hiveEngineHistoryApiCall('cryptoshotstips', 20); console.log(history); ```
--- ## Usage in CRYPTO SHOTS **[DISCORD](https://crypto-shots.com/discord):** - Earnings report for Daily Tournaments - Weekly/monthly Top Earners leaderboard
https://files.peakd.com/file/peakd-hive/crypto-shots/23tRvekMJz9DJoJpgEvMGKgRsTyFTcvexASDrnfdi9DyvJp8RDqrUrVaFbujTTd8feodEGXnJwQrvBBYwJ9EXvktBUUTJRZYvhvzZdWL33asTWncPJ7JwTrZkGocCrP5uihqXFr.png
[**GAME UI**](https://crypto-shots.com/pvp): Coming Soon
--- ### Coming Next - Support for additional Hive sidechains - Porting into Unity as an Open Source plugin ---
![cs-logo.png](https://files.peakd.com/file/peakd-hive/crypto-shots/23xoaireZsyZCrvZLKneUuKiKWkGSajVRi9FspoMe3F5bpYmsQR8tyvNzoiQ3uJLLfqPy.png)
## Support us   - #### [VOTE](https://vote.hive.uno/@crypto-shots) for our witness 🙇‍♂️ https://files.peakd.com/file/peakd-hive/crypto-shots/23tmmNARc8i8heJWyuny1JTT2VL5PUWJ7PFPsYuJkKTzhH2XsTNcioYZYaKuioQmV53oH.png   - Use the [Issues](https://github.com/Crypto-Shots/Hive-Earnings/issues) tab to report bugs. - Create [Merge Requests](https://github.com/Crypto-Shots/Hive-Earnings/pulls) for potential improvements and fixes.
</div> </div>