node-util/README.md

53 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

# lethean-util
CryptoNote node utility for Lethean — address generation, validation, and block/transaction processing.
2019-03-14 17:17:40 +01:00
This is Lethean's equivalent of `cryptoforknote-util`. It's a C++ native Node.js addon that links against the Lethean blockchain source tree.
## Install
```bash
npm install
# Requires: cmake, g++, libboost-all-dev
# The native addon links against ../blockchain/src/ via the Lethean symlink
```
## Usage
```javascript
var cn = require('lethean-util');
// Validate address
var decoded = cn.address_decode(Buffer.from('iTHNUNiuu3VP...'));
// Get block hash
var hash = cn.get_pow_hash(blockBlob);
// Convert block blob
var converted = cn.convert_blob(blockBlob);
```
## Functions
| Function | Purpose |
|----------|---------|
| `address_decode` | Decode a Lethean address (iTHN prefix) |
| `is_address_valid` | Validate address format |
| `convert_blob` | Convert block blob for mining |
| `get_pow_hash` | Calculate ProgPoWZ proof-of-work hash |
| `get_hash_from_block_template_with_extra` | Hash with extra data |
| `get_blob_from_block_template` | Extract blob from template |
| `get_id_hash` | Get block ID hash |
| `get_merged_mining_nonce_size` | Merged mining nonce size |
| `baseDiff` | Base difficulty calculation |
## Network
| Property | Value |
|----------|-------|
| Address prefix | iTHN (standard), iTHn (integrated) |
| Decimal places | 12 |
| Coin units | 1,000,000,000,000 |
Based on: https://github.com/Snipa22/node-cryptonote-util