A modern Altcoin Core REST and RPC client to execute administrative tasks, wallet operations and queries about network and the blockchain.
Install the package via npm:
The network will automatically determine the port to connect to, just like the bitcoind and bitcoin-cli commands.
By default, when ssl is enabled, strict checking is implicitly enabled.
For compatibility with other Altcoin Core clients.
Since version v0.14.0, it is possible to send commands via the JSON-RPC interface using named parameters instead of positional ones. This comes with the advantage of making the order of arguments irrelevant. It also helps improving the readability of certain function calls when leaving out arguments for their default value.
For instance, take the getBalance() call written using positional arguments:
It is functionally equivalent to using the named arguments account and minconf, leaving out include_watchonly (defaults to false):
This feature is available to all JSON-RPC methods that accept arguments.
By default, all methods are exposed on the client independently of the version it is connecting to. This is the most flexible option as defining methods for unavailable RPC calls does not cause any harm and the library is capable of handling a Method not found response error correctly.
However, if you prefer to be on the safe side, you can enable strict version checking. This will validate all method calls before executing the actual RPC request:
If you want to enable strict version checking for the bleeding edge version, you may set a very high version number to exclude recently deprecated calls:
To avoid potential issues with prototype references, all methods are still enumerable on the library client prototype.
Start the bitcoind with the RPC server enabled and optionally configure a username and password:
These configuration values may also be set on the bitcoin.conf file of your platform installation.
By default, port 8332 is used to listen for requests in mainnet mode, or 18332 in testnet or regtest modes. Use the network property to initialize the client on the desired mode and automatically set the respective default port. You can optionally set a custom port of your choice too.
The RPC services binds to the localhost loopback network interface, so use rpcbind to change where to bind to and rpcallowip to whitelist source IP access.
All RPC methods are exposed on the client interface as a camelcase'd version of those available on bitcoind.
For a more complete reference about which methods are available, check the RPC documentation on the Altcoin Core Developer Reference website.
Batched requests are support by passing an array to the command method with a method and optionally, parameters. The return value will be an array with all the responses.
Note that batched requests will only throw an error if the batch request itself cannot be processed. However, each individual response may contain an error akin to an individual request.
Support for the REST interface is still experimental and the API is still subject to change. These endpoints are also unauthenticated so there are certain risks which you should be aware, specifically of leaking sensitive data of the node if not correctly protected.
Error handling is still fragile so avoid passing user input.
Start the bitcoind with the REST server enabled:
These configuration values may also be set on the bitcoin.conf file of your platform installation. Use txindex=1 if you'd like to enable full transaction query support (note: this will take a considerable amount of time on the first run).
Given a block hash, returns a block, in binary, hex-encoded binary or JSON formats.
Given a block hash, returns amount of block headers in upward direction.
Returns various state info regarding block chain processing.
Returns transactions in the transaction memory pool.
Returns various information about the transaction memory pool. Only supports JSON as output format.
Given a transaction hash, returns a transaction in binary, hex-encoded binary, or JSON formats.
Query unspent transaction outputs (UTXO) for a given set of outpoints. See BIP64 for input and output serialisation.
This client supports SSL out of the box. Simply pass the SSL public certificate to the client and optionally disable strict SSL checking which will bypass SSL validation (the connection is still encrypted but the server it is connecting to may not be trusted). This is, of course, discouraged unless for testing purposes when using something like self-signed certificates.
Please note that the following procedure should only be used for testing purposes.
Generate an self-signed certificate together with an unprotected private key:
On Altcoin Core <0.12, you can start the bitcoind RPC server directly with SSL:
On Altcoin Core >0.12, use must use stunnel (brew install stunnel or sudo apt-get install stunnel4) or an HTTPS reverse proxy to configure SSL since the built-in support for SSL has been removed. The trade off with stunnel is performance and simplicity versus features, as it lacks more powerful capacities such as Basic Authentication and caching which are standard in reverse proxies.
You can use stunnel by configuring stunnel.conf with the following service requirements:
The key option may be omitted if you concatenating your private and public certificates into a single stunnel.pem file.
On some versions of stunnel it is also possible to start a service using command line arguments. The equivalent would be:
Then pass the public certificate to the client:
By default, all requests made with altcoin-rpc are logged using uphold/debugnyan with altcoin-rpc as the logging namespace.
Please note that all sensitive data is obfuscated before calling the logger.
Example output defining the environment variable DEBUG=altcoin-rpc:
A custom logger can be passed via the logger option and it should implement bunyan's log levels.
Currently the test suite is tailored for Docker (including docker-compose) due to the multitude of different bitcoind configurations that are required in order to get the test suite passing.
To test using a local installation of node.js but with dependencies (e.g. bitcoind) running inside Docker:
To test using Docker exclusively (similarly to what is done in Travis CI):
- Poll Shows Crypto Investors Expect ChainLink To Be Top Performing Altcoin in 2020 - newsBTC - January 14th, 2020
- These 4 Factors Suggest the Altcoin Crypto Market Rally is Only Just Beginning - newsBTC - January 14th, 2020
- Is This The Return Of The Altseason? Pumped Up Altcoins Leave Bitcoin In The Wind - ZyCrypto - January 14th, 2020
- Ethereum Classic Cooperative Warns Public Against Apparent Hard Fork Scam - Cointelegraph - January 14th, 2020
- South Korea: Hacked Crypto Exchange Upbit Finally Resumes ETH Deposits and Withdrawals - BTCMANAGER - January 14th, 2020
- Cobinhood is the Latest Altcoin Exchange to Shut Down - NullTX - January 12th, 2020
- Litecoin Gains 10% Against The Dollar, Is This The Start of an Altcoin Rally? - newsBTC - January 12th, 2020
- Dash Surges by Over 16% as Bitcoin Price Hovers At $8,100 - Cointelegraph - January 12th, 2020
- More Altcoin Mining to be Integrated by Mining Pools in 2020 - Report - Cryptonews - January 10th, 2020
- Ethereum, Monero hashrate mainly concentrated in Europe - AMBCrypto - January 10th, 2020
- 4 Signs the Cryptocurrency Altcoin Market May Have Finally Bottomed - Cointelegraph - January 10th, 2020
- All 4 Past Januaries Started A Different Altcoin Trend, Will January 2020 Ignite a New Altcoin Season? - CryptoPotato - January 10th, 2020
- Dead Crypto Projects Declined in 2019, Are Altcoins Reviving? - Bitcoinist - January 10th, 2020
- Stellar jumps 8% as Bitcoin taps $8,000; what will push XLM even higher? - CryptoSlate - January 10th, 2020
- Chainlink and Loopring Are Now "Partners in Crime" - Business Partnerships - Altcoin Buzz - January 10th, 2020
- Upbit Exchange to Re-Open XRP, LTC and EOS Trading - Bitcoinist - January 10th, 2020
- Altcoin Explorer: Tether, The Worlds First Successful Stablecoin - BTCMANAGER - January 10th, 2020
- Heres What Altcoins Rally Means for Where the Crypto Markets are Heading Next - newsBTC - January 5th, 2020
- Momentum Within Altcoin Market Could Spark Massive XRP Rally, But Will it Be Sustainable? - newsBTC - January 5th, 2020
- This Small-Cap Altcoin Is Quietly up Over 50% in the Last 2 Days - SludgeFeed - January 5th, 2020
- ElectraPay is Another Altcoin Payment Solution no one Really Needs - The Merkle Hash - January 5th, 2020
- Ethereum [ETH/USD] Technical Analysis: Price Remains Unmoved as Users clamor for Altcoin Revolution ... - TWJ Crypto - January 5th, 2020
- 2019: Alt-Season has comeand gone - Where is altcoin heading in 2020? - FXStreet - December 30th, 2019
- Ethereum, XRP, and BCH: Why Traders are Optimistic on Altcoin Market - newsBTC - December 30th, 2019
- Altcoin Apocalypse: Which Crypto Assets Will Survive Another Year - newsBTC - December 30th, 2019
- XRP, Bitcoin are the most bought coins on Coinbase - AMBCrypto - December 30th, 2019
- Heres Why XRP Price Could Soon Burst 60% Higher - Ethereum World News - December 30th, 2019
- 2019 in review: Which altcoins performed the best vs Bitcoin? - Coin Rivet - December 27th, 2019
- Privacy-Focused and Privacy Centric Blockchains - Altcoin Buzz - December 27th, 2019
- NULS Hacked. $480 Worth of NULS Token Stolen - Cryptocurrency Regulation - Altcoin Buzz - December 27th, 2019
- 2019 in review: Which altcoins performed the best vs Bitcoin? - Yahoo Finance - December 24th, 2019
- Altcoins bubble on the way, crypto market cap may reach $11 trillion by 2023 - FXStreet - December 24th, 2019
- Litecoin price prediction 2020: can it become the best-performing altcoin of the coming decade? - Capital.com - December 24th, 2019
- 2019: The Year in Altcoins, and the Year Ahead - Finance Magnates - December 24th, 2019
- XRP is Down 95% from Its 2018 Peak; Whats Next for the Embattled Crypto? - newsBTC - December 22nd, 2019
- BitGo Will Comply with FATF - Cryptocurrency Regulation - Altcoin Buzz - December 22nd, 2019
- Why Have Altcoins Slumped Back to Crypto Winter Levels? - newsBTC - December 21st, 2019
- Bitcoin Price Diary: Long BTC From $6.5K and Back in Altcoin Positions - Cointelegraph - December 21st, 2019
- LTC, XTZ, TRX, and XLM Crypto Price Prediction: Will Altcoins Test Key Resistance Levels? - U.Today - December 21st, 2019
- Can Ethereum (ETH) And Other Altcoins Still See A Rise In Dominance? - Crypto Daily - December 21st, 2019
- Orchid Launches on Coinbase and Sees 200%+ Gain - Altcoin Buzz - December 21st, 2019
- Ripple Raises $200M, Calls 2019 Its Strongest Year of Growth - Cointelegraph - December 21st, 2019
- Pionex and Dash are Now Partners - Business Partnerships - Altcoin Buzz - December 21st, 2019
- Ether Price Targets $160 as Altcoins Rally and BTC Trades Sideways - Cointelegraph - December 13th, 2019
- Ether Eyes $160 As BTC Oscillates And Altcoins Rally - - CryptoVibes - December 13th, 2019
- Whats the outlook for Litecoin in 2020? - Coin Rivet - December 13th, 2019
- Ethereum Classic is the Top Altcoin in Daily Active Addresses, Heres Why - Coingape - December 13th, 2019
- Nike Shoes and Ethereum? Why Not - Altcoin Buzz - December 13th, 2019
- Top 3 price prediction Bitcoin, Ethereum, Ripple: Altcoin auto-MATIC carnage - FXStreet - December 11th, 2019
- Altcoin Meltdown Intensifies as Tezos, Ravencoin, VeChain Take the Plunge - CCN.com - December 11th, 2019
- Altcoins: Could This Be the End of Tokens? - CoinCodex - December 11th, 2019
- Latest Litecoin price and analysis (LTC to USD) - Coin Rivet - December 11th, 2019
- Bitrefill and Bitfinex Are Now "Partners in Crime" - Business Partnerships - Altcoin Buzz - December 6th, 2019
- Altcoin apocalypse XRP, Bitcoin Cash and ZEC over 90% removed from ATH - Born2Invest - December 5th, 2019
- Which Major Altcoins Will Still Be Top Ranking Long Term? A Historical Review of the Altcoin Market's Past Perhaps Provides Clues Crypto.IQ | Bitcoin... - December 4th, 2019
- XRP Added to Japanese Altcoin Market by BitFlyer - The Coin Republic - December 4th, 2019
- The Worst Is Yet To Come For Altcoin Market Cap - newsBTC - December 2nd, 2019
- Altcoin Apocalypse: The Number of Dying Crypto Currencies Is Rising - newsBTC - December 2nd, 2019
- Altcoin Dominance Steadily Increases While Bitcoin Takes a Dive - BeInCrypto - December 2nd, 2019
- Learn The Basics of Masternode Investments: An Exclusive Interview with Iakov Trevor Levin of Midas - Coinfomania - December 2nd, 2019
- How to Beat Bitcoin With Altcoins (Using the BMJ Crypto Portfolio Optimization Tool) - Bitcoin Market Journal - December 2nd, 2019
- Massively Successful: That is What Electroneum Wants To Be - Spotlight - Altcoin Buzz - November 23rd, 2019
- Google a Threat to Bitcoin? Community Disagrees - Finance and Funding - Altcoin Buzz - November 23rd, 2019
- Heres How Much of Each Major Altcoin Is Owned by Whales - BeInCrypto - November 21st, 2019
- Altcoin Volatility Rising, But Alt Season Wont Arrive Until Bitcoin Volume Returns - newsBTC - November 21st, 2019
- What will it take for a Litecoin bull run in 2020? - Yahoo Finance - November 21st, 2019
- Crypto Analyst: Ethereum, XRP and Altcoins Poised for Major Rally As Bitcoin (BTC) Dominance Drops - The Daily Hodl - November 18th, 2019
- Bye-Bye Bitcoin? Why the Altcoin Bottom is In - newsBTC - November 18th, 2019
- Proof of Stake Creator: Bitcoin Unlikely to Dominate Altcoins in Long Run - Ethereum World News - November 18th, 2019
- Best Bitcoin/Altcoin Wallets For iPhone [2019 Edition] - October 1st, 2019
- Crypto Conundrum: Bullish Bitcoin Price Action Halts Altcoin ... - April 24th, 2019
- Altcoin Season 2019 Thrives: Everex (EVX) Leading Binance ... - April 21st, 2019
- What is an Altcoin? - CCN - February 9th, 2019
- Altcoin Trader South Africa - ice3x Altcoin Exchange ... - February 2nd, 2019
- Altcointrader.co.za Review - Altcoin Trader, Login ... - January 27th, 2019
- Bitcoin History Part 5: A Wild Altcoin Appears - Bitcoin News - January 9th, 2019
- Latest News on Altcoin | Altcoin Breaking News | DC Forecasts - January 9th, 2019
- Altcoin Daily Preview: Tron (TRX) Could Bounce back ... - January 9th, 2019
- Most promising Altcoins and ... - Captain Altcoin - January 8th, 2019
- Altcoin - Investopedia - December 12th, 2018