hiverewards
v1.0.14
Published
SDK for analysing HIVE & Hive-Engine earnings
Readme
Contents
- Hive Rewards
- Usage - NodeJS and Browser
- Usage - CLI
- Configuration
- Peakd's Beacon Wrapper
- Usage in Crypto Shots
Hive Rewards
An SDK for Node.js and the browser, and a command-line tool to scan HIVE, HBD, and Hive-Engine token transfers:
- Inbound - sum HIVE, HBD, and token rewards plus USD value received by specified accounts, tracking specific sender accounts.
- Outbound - map all recipients plus HIVE, HBD, token, and USD values sent by a given sender.
Usage - NodeJS and Browser
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
- Clone the project.
- Build it with:
npm run build:web- Host the generated
distfolder on your server. - Import it in your frontend:
<script src="dist/hiverewards.bundle.js"></script>
<script>
(async () => {
const analyzer = await window.HiveRewards.hiveRewards();
const result = await analyzer.inbounds({
receivers: ['obifenom'],
hiveSenders: { PVP_GAME_REWARDS: 'cryptoshots.tips' },
days: 7,
});
console.log(result);
})();
</script>Usage - CLI
git clone <repo>
cd <repo>
npm installnpm start -- --inbound obifenom zillionz --from pvpRewards=cryptoshots.tips pveRewards=cryptoshotsdoom --hours 24npm start -- --outbound cryptoshots.tips karina.gpt --days 1Append --verbose for verbose logging.
Configuration
| Env var | Default |
|---|---|
| HIVE_PRICE_URL | https://api.coingecko.com/api/v3/simple/price?ids=hive,hive_dollar&vs_currencies=usd |
You can also override the initial Hive / Hive Engine node by passing a config object to the hiveRewards() factory in code:
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 |
| priceCacheMins | How long Hive/HBD prices are cached for | 10 mins |
| hiveHistoryLimit | Max account-history ops per Hive call | 500 |
| heHistoryLimit | Max Hive-Engine history records per call | 250 |
Peakd's Beacon Wrapper
Wrapper for @peakd's Beacon APIs.
Usage:
import { peakdBeaconWrapper } from 'hiverewards';
const { getHealthyHiveNode, getHealthyHeNode, getHealthyHeHistoryNode } = peakdBeaconWrapper;
const hiveUrl = await getHealthyHiveNode();
const heUrl = await getHealthyHeNode();
const hehUrl = await getHealthyHeHistoryNode();
hiveApi.api.setOptions({ url: hiveUrl });You can also use the Hive / Hive Engine client wrappers that automatically rotate healthy nodes:
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 heHistory = await hiveEngineHistoryApiCall('cryptoshotstips', 20);
console.log(heHistory);Usage in Crypto Shots
- Earnings report for daily tournaments
- Weekly/monthly top earners leaderboard

Support us
- VOTE for our witness
- Use the Issues tab to report bugs
- Create Merge Requests for improvements and fixes
