
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.
megacoin-node-api
Advanced tools
Megacoin-Node-Api is an Express middleware plugin that exposes URLs for quick development and interfacing with a megacoind Megacoin wallet.
Megacoin-Node-Api is an Express middleware plugin that easily exposes a URL structure for interfacing with a megacoind Megacoin wallet.
NB: The middleware is experimental at present. Certain JSON-RPC methods are not supported yet and/or experimental. These are methods with more complex parameters that do not fit easily into a query string:
These methods will be added in the future. If there any other problems with the other methods, please report the bugs.
npm install megacoin-node-api
var megacoinapi = require('megacoin-node-api');
var express = require('express');
var app = express();
//Username and password relate to those set in the megacoin.conf file
var wallet = {
host: 'localhost',
port: 7950,
user: 'username',
pass: 'password'
};
megacoinapi.setWalletDetails(wallet);
megacoinapi.setAccess('default-safe'); //Access control
app.use('/megacoin/api', megacoinapi.app); //Bind the middleware to any chosen url
app.listen(3000);
Just add the method name after the binded url.
For example:
This returns data exactly as would be expected from the JSON-RPC api.
{
"version": 80300,
"protocolversion": 70001,
"walletversion": 60000,
"balance": 4.3222,
"blocks": 245645,
"timeoffset": -2,
"connections": 8,
"proxy": "",
"difficulty": 21335329.113983,
"testnet": false,
"keypoololdest": 1368414896,
"keypoolsize": 101,
"paytxfee": 0.0001,
"unlocked_until": 0,
"errors": ""
}
Parameters are sent via a query string:
{
"amount": 0.002,
"confirmations": 1321,
"blockhash": "000000000000009d0a2bb76c81dd185d1f6c28256037baef7b3345b7a7e958c7",
"blockindex": 150,
"blocktime": 1372728756,
"txid": "d6c7e35ff9c9623208c22ee37a118ad523ae6c2d137d10053739cb03dbac62e0",
"time": 1372728436,
"timereceived": 1372728436,
"details": [
{
"account": "localtest",
"address": "1Htev475XRVYfenku7ZWXGPSun15ESynCq",
"category": "receive",
"amount": 0.002
}
]
}
Consult the API call list for parameter information.
If you have encrypted your wallet.dat you need to set the passphrase before attaching the middleware.
megacoinapi.setWalletDetails(wallet);
megacoinapi.setWalletPassphrase(passphrase);
app.use('/megacoin/api', megacoinapi.app);
The .setAccess method controls the access to the urls. By default all commands are accessible. The method takes two parameters: type (string) and accesslist (array). To restrict access there are two ways to do this:
The 'only' type only exposes the methods given by an array of methods as the accesslist parameter.
//Only allow the getinfo method
megacoinapi.setAccess('only', ['getinfo']);
The 'restrict' type prevents methods from being accessed.
megacoinapi.setAccess('restrict', ['dumpprivkey', 'sendmany']);
Megacoin-Node-Api has predefined access profiles to make it easy to set up.
It prevents 'dumpprivkey' and 'walletpassphrasechange' being accessed. This prevents potential theft. Also removes the 'stop' command to prevent someone from stopping the server.
megacoinapi.setAccess('default-safe');
This profile only exposes methods that show information. No methods that can send/alter the wallet are exposed.
megacoinapi.setAccess('read-only');
Megacoin-Node-Api is used in the following projects:
If you use Megacoin-Node-Api in your projects submit a pull request to the readme with a link.
Copyright (C) 2013 Niel de la Rouviere
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Megacoin-Node-Api is an Express middleware plugin that exposes URLs for quick development and interfacing with a megacoind Megacoin wallet.
We found that megacoin-node-api 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.