
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node wrapper for aeon daemon and wallet rpc
npm install --save aeon-rpc
Instantiate a new Daemon object:
const Daemon = require('aeon-rpc').Daemon
const daemon = new Daemon('http://localhost:11181')
const daemon = new Daemon('http://api.aeonminingpool.com:11181') // or use a remote node
Look up how many blocks are in the longest chain known to the node.
daemon.getLastBlockHeight((err, height) => {
if (err) return console.log(err)
console.log(height) // 993163
})
Look up how many blocks are in the longest chain known to the node.
daemon.getLastBlockHeader((err, header) => {
if (err) return console.log(err)
console.log(header)
/*
* {
* "depth": 0,
* "difficulty": 746963928,
* "hash": "ac0f1e2262...",
* "height": 990793,
* "major_version": 1,
* "minor_version": 1,
* "nonce": 1550,
* "orphan_status": false,
* "prev_hash": "386575e3b0...",
* "reward": 6856609225169,
* "timestamp": 1457589942
* }
*/
})
Block header information can be retrieved using either a block's hash or height.
By height:
daemon.getBlockHeader(990793, (err, header) => {
if (err) return console.log(err)
console.log(header)
/*
* {
* "depth": 0,
* "difficulty": 746963928,
* "hash": "ac0f1e2262...",
* "height": 990793,
* "major_version": 1,
* "minor_version": 1,
* "nonce": 1550,
* "orphan_status": false,
* "prev_hash": "386575e3b0...",
* "reward": 6856609225169,
* "timestamp": 1457589942
* }
*/
})
By hash:
daemon.getBlockHeader('ac0f1e2262...', (err, header) => {
if (err) return console.log(err)
console.log(header)
/*
* {
* "depth": 0,
* "difficulty": 746963928,
* "hash": "ac0f1e2262...",
* "height": 990793,
* "major_version": 1,
* "minor_version": 1,
* "nonce": 1550,
* "orphan_status": false,
* "prev_hash": "386575e3b0...",
* "reward": 6856609225169,
* "timestamp": 1457589942
* }
*/
})
Full block information can be retrieved by either block height or hash, like with the block header calls.
daemon.getBlock('ac0f1e2262...', (err, block) => {
if (err) return console.log(err)
console.log(block) // { ... }
})
Get a new block template for mining.
daemon.getBlockTemplate('46tFLJPaNyy...', 17, (err, template) => {
if (err) return console.log(err)
console.log(template) // { ... }
})
Submit a block to the network.
daemon.submitBlock('...', (err) => {
if (err) return console.log(err)
console.log('hurray') // 'hurray'
})
Check if a key image is spent.
daemon.getKeyImagesSpent(['8d1bd818...', '7319134bf...'], (err, status) => {
if (err) return console.log(err)
console.log(status) // [1, 1]
})
daemon.stop((err) => {
if (err) return console.log(err)
console.log(':(') // ':('
})
Get miscellaneous information about the state of this daemon and the network.
daemon.getInfo((err, info) => {
if (err) return console.log(err)
console.log(info)
/*
* {
* "alt_blocks_count": 5,
* "difficulty": 972165250,
* "grey_peerlist_size": 2280,
* "height": 993145,
* "incoming_connections_count": 0,
* "outgoing_connections_count": 8,
* "status": "OK",
* "target": 60,
* "target_height": 993137,
* "testnet": false,
* "top_block_hash": "",
* "tx_count": 564287,
* "tx_pool_size": 45,
* "white_peerlist_size": 529
* }
*/
})
Get miscellaneous information about the state of this daemon and the network.
daemon.isTestnet((err, testnet) => {
if (err) return console.log(err)
console.log(testnet) // false
})
All amounts are in atomic units. 1 Aeon is 1e12 atomic units.
Start aeon-wallet-rpc:
aeon-wallet-rpc --wallet-file mywallet --rpc-bind-port 18082 --disable-rpc-login
Instantiate a new Wallet object:
const Wallet = require('aeon-rpc').Wallet
const wallet = new Wallet('http://localhost:11182')
Get the wallet's address.
wallet.getAddress((err, address) => {
if (err) return console.log(err)
console.log(address) // '46tFLJPaNyy...'
})
Get the wallet's balance.
wallet.getBalance((err, balance) => {
if (err) return console.log(err)
console.log(balance.total) // 140000000000
console.log(balance.unlocked) // 50000000000
})
Send Aeon.
wallet.transfer({
destinations: [
{ address: '48vegnn...', amount: 10000000 }
],
mixin: 7, // default 7
priority: 0 // default 0
}, (err, result) => {
if (err) return console.log(err)
console.log(result.fee) // 48958481211
console.log(result.tx_hash) // '985180f46863...'
})
Send aeon, and split into multiple transactions if required.
wallet.splitTransfer({
destinations: [
{ address: '48vegnn...', amount: 10000000 }
],
mixin: 7, // default 7
priority: 0 // default 0
}, (err, result) => {
if (err) return console.log(err)
console.log(result)
/*
* {
* "fee_list": [48958481211],
* "tx_hash_list": ['985180f46863...']
* }
*/
})
Get a list of incoming payments using a given payment id.
wallet.getPayments('4279257e...', (err, payments) => {
if (err) return console.log(err)
console.log(payments)
/*
* [
* {
* "amount": 10350000000000,
* "block_height": 994327,
* "payment_id": "4279257e0a2...",
* "tx_hash": "c391089f5b1b02...",
* "unlock_time": 0
* }
* ]
*/
})
Generate a random integrated address.
wallet.getRandomIntegratedAddress((err, result) => {
if (err) return console.log(err)
console.log(result.paymentId) // 'f89f4978b6304b7b'
console.log(result.address) // '46tFLJPaNyy...'
})
Get a list of payments using a list of payment ids from a given height.
wallet.getBulkPayments(['4279257e0a2...'], 990000, (err, result) => {
if (err) return console.log(err)
console.log(result)
/*
* [
* {
* "amount": 10350000000000,
* "block_height": 994327,
* "payment_id": "4279257e0a2...",
* "tx_hash": "c391089f5b1...",
* "unlock_time": 0
* }
* ]
*/
})
Code is linted with eslint and tested with Jest. Run npm test to lint and run
test suite.
This library is not complete. This library probably has bugs. This library
eats babies. Don't use it unless you know what you're getting yourself into.
See the GitHub issues for a list of features which are missing.
Feel free to create a pull request to add your own project.
Released under the 3-Clause BSD License. See LICENSE for more information.
FAQs
> node wrapper for aeon daemon and wallet rpc
We found that aeon-rpc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.