Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including cryptoapis.io with all npm packages installed. Try it out:

var cryptoapisIo = require("cryptoapis.io")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cryptoapis.io v4.2.3

Crypto APIs SDK

Previous version of this doc here

JavaScript SDK for CryptoAPIs.io

You can get API key here.

Docs here.

How to install

$ npm install cryptoapis.io

How to use

const CryptoApis = require('cryptoapis.io');

const apiKey = 'your API key';
const caClient = new CryptoApis(apiKey);

// You can use several instances of the client which can coexist in the same environment

// By default the calls are made to the mainnet for each chain.

// The selected network for each chain at any moment can be checked with the <chain>.getSelectedNetwork() method.
caClient.BC.DOGE.getSelectedNetwork();

// To switch to a different network you need to call the <chain>.switchNetwork method.

// The network can be specified via the respective <chain>.NETWORKS.<network>
caClient.BC.ETH.switchNetwork(caClient.BC.ETH.NETWORKS.ROPSTEN);
caClient.BC.BTC.switchNetwork(caClient.BC.BTC.NETWORKS.TESTNET);
caClient.BC.BCH.switchNetwork(caClient.BC.BCH.NETWORKS.TESTNET);
caClient.BC.LTC.switchNetwork(caClient.BC.LTC.NETWORKS.TESTNET);
caClient.BC.DOGE.switchNetwork(caClient.BC.DOGE.NETWORKS.TESTNET);
caClient.BC.DASH.switchNetwork(caClient.BC.DASH.NETWORKS.TESTNET);

// Or by passing a valid network name for the chain
caClient.BC.ETH.switchNetwork('rinkeby');

Examples (for more examples, you can check out the tests)

Generate new address

caClient.BC.ETH.address.generateAddress()
    .then(function(result) {
      console.log(result);
    })
    .catch(function(err) {
      console.error(err);
    });

It will print the following:

{
  "payload": {
    "address": "0xd1b99ca3971c06af48474aa6606ec885e7aff600",
    "privateKey": "31f5d2a8d3f4a816fb498200423461ec52aefe579c13b807a8140c7a7ecc8448",
    "publicKey": "51767e84342ea3d10faf35676997cf1dbd4d2c0168fe46a4a920c4c1f557bc8851445ff17aaba144546e7aac45b1754352d860c617eff441778c4e053178f97b"
  }
}

Blockchain as a Service APIs

List of all methods available

NOTES:

  • XXX - blockchain (BTC / BCH / LTC / DOGE / DASH / ETH / ETC)
  • doc links target BTC / ETH in our documentation to avoid repetition. For other blockchains refer to the corresponding parts in our documentation

BTC / BCH / LTC / DOGE / DASH methods

Blockchain methods

  • caClient.BC.XXX.blockchain.getInfo (docs)
  • caClient.BC.XXX.blockchain.getBlockByHash (docs)
  • caClient.BC.XXX.blockchain.getBlockByHeight (docs)
  • caClient.BC.XXX.blockchain.getLatestBlock (docs)

Addresses methods

  • caClient.BC.XXX.address.getInfo (docs)
  • (BTC / BCH / LTC only) caClient.BC.XXX.address.getInfoMultisig (docs)
  • caClient.BC.XXX.address.generateAddress (docs)
  • caClient.BC.XXX.address.getAddressTransactions (docs)
  • caClient.BC.XXX.address.multipleAddressesInfo (docs)

Wallets methods

  • caClient.BC.XXX.wallet.createWallet (docs)
  • caClient.BC.XXX.wallet.createHDWallet (docs)
  • caClient.BC.XXX.wallet.listWallets (docs)
  • caClient.BC.XXX.wallet.listHDWallets (docs)
  • caClient.BC.XXX.wallet.getWallet (docs)
  • caClient.BC.XXX.wallet.getHDWallet (docs)
  • caClient.BC.XXX.wallet.addAddressToWallet (docs)
  • caClient.BC.XXX.wallet.generateAddressInWallet (docs)
  • caClient.BC.XXX.wallet.generateAddressInHDWallet (docs)
  • caClient.BC.XXX.wallet.removeAddressFromWallet (docs)
  • caClient.BC.XXX.wallet.deleteWallet (docs)
  • caClient.BC.XXX.wallet.deleteHDWallet (docs)
  • caClient.BC.XXX.wallet.createXPub (docs)
  • caClient.BC.XXX.wallet.getXPubChangeAddresses (docs)
  • caClient.BC.XXX.wallet.getXPubReceiveAddresses (docs)
  • caClient.BC.XXX.wallet.importAddressAsWallet (docs)

Transaction methods

  • caClient.BC.XXX.transaction.getTransaction (docs)
  • caClient.BC.XXX.transaction.getTransactionIndexByBlock (docs)
  • caClient.BC.XXX.transaction.getUnconfirmedTransactions (docs)
  • caClient.BC.XXX.transaction.decodeRawTransaction (docs)
  • caClient.BC.XXX.transaction.createTransaction (docs)
  • caClient.BC.XXX.transaction.signTransaction (docs)
  • caClient.BC.XXX.transaction.sendTransaction (docs)
  • caClient.BC.XXX.transaction.newTransaction (docs)
  • caClient.BC.XXX.transaction.createHDWalletTransaction (docs)
  • caClient.BC.XXX.transaction.getTransactionsFee (docs)
  • caClient.BC.XXX.transaction.getTransactionSize (docs)
  • caClient.BC.XXX.transaction.refund (docs)

Payment Forwarding methods

  • caClient.BC.XXX.paymentForwarding.createPaymentForwarding (docs)
  • caClient.BC.XXX.paymentForwarding.listPayments (docs)
  • caClient.BC.XXX.paymentForwarding.listPaymentsHistory (docs)
  • caClient.BC.XXX.paymentForwarding.deletePayment (docs)

Webhook methods

  • caClient.BC.XXX.webhook.createNewBlockWebHook (docs)
  • caClient.BC.XXX.webhook.createConfirmedTransactionWebHook (docs)
  • caClient.BC.XXX.webhook.createAddressTransactionWebHook (docs)
  • caClient.BC.XXX.webhook.createTransactionConfirmationsWebHook (docs)
  • (BTC only) caClient.BC.XXX.webhook.createOmniConfirmedTransactionWebHook (docs)
  • (BTC only) caClient.BC.XXX.webhook.createOmniTransactionConfirmationsWebHook (docs)
  • (BTC only) caClient.BC.XXX.webhook.createOmniTokenWebHook (docs)
  • caClient.BC.XXX.webhook.listAllHooks (docs)
  • caClient.BC.XXX.webhook.deleteWebHook (docs)
  • caClient.BC.XXX.webhook.deleteAllMyWebhooks (docs)

Omni Layer methods

  • (BTC only) caClient.BC.XXX.omniLayer.getNodeInfo (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.getAddress (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.getAddressTransactions (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.createTransactions (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.signTransaction (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.sendTransaction (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.newTransaction (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.createHDWalletTransaction (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.getTransaction (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.getTransactionIndexByBlock (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.getTransactionsPropertyId (docs)
  • (BTC only) caClient.BC.XXX.omniLayer.getUnconfirmedTransactions (docs)

ETH / ETC methods

Blockchain methods

  • caClient.BC.XXX.blockchain.getInfo (docs)
  • caClient.BC.XXX.blockchain.getBlockByHash (docs)
  • caClient.BC.XXX.blockchain.getBlockByHeight (docs)
  • caClient.BC.XXX.blockchain.getLatestBlock (docs)

Addresses methods

  • caClient.BC.XXX.address.getInfo (docs)
  • caClient.BC.XXX.address.getTransactionsByAddress (docs)
  • caClient.BC.XXX.address.generateAddress (docs)
  • caClient.BC.XXX.address.generateAccount (docs)
  • caClient.BC.XXX.address.getAddressNonce (docs)
  • caClient.BC.XXX.address.multipleAddressesInfo (docs)

Transaction methods

  • caClient.BC.XXX.transaction.getTransaction (docs)
  • caClient.BC.XXX.transaction.getTransactionsByBlock (docs)
  • caClient.BC.XXX.transaction.getTransactionByBlockNumber (docs)
  • caClient.BC.XXX.transaction.getTransactionByBlockHash (docs)
  • caClient.BC.XXX.transaction.newTransaction (docs)
  • caClient.BC.XXX.transaction.newAllTransaction (docs)
  • caClient.BC.XXX.transaction.newTransactionWithPrivateKey (docs)
  • caClient.BC.XXX.transaction.newAllTransactionWithPrivateKey (docs)
  • caClient.BC.XXX.transaction.sendTransaction (docs)
  • caClient.BC.XXX.transaction.pushTransaction (docs)
  • caClient.BC.XXX.transaction.getPendingTransactions (docs)
  • caClient.BC.XXX.transaction.getQueuedTransactions (docs)
  • caClient.BC.XXX.transaction.estimateTransactionGas (docs)
  • caClient.BC.XXX.transaction.getTransactionsFee (docs)
  • (ETH only) caClient.BC.XXX.transaction.getInternalTransaction (docs)
  • caClient.BC.XXX.transaction.refund (docs)

Contract methods

  • caClient.BC.XXX.contract.estimateSmartContractGas (docs)
  • caClient.BC.XXX.contract.deploySmartContract (docs)

Tokens methods

  • caClient.BC.XXX.token.getAddressTokenBalance (docs)
  • caClient.BC.XXX.token.transferTokens (docs)
  • (ETH only) caClient.BC.XXX.token.getTokenTransactionsByAddress (docs)
  • (ETH only) caClient.BC.XXX.token.getAddressTokenTransfers (docs)
  • caClient.BC.XXX.token.getTokenTotalSupplyAndDecimals (docs)

Payment Forwarding methods

  • caClient.BC.XXX.paymentForwarding.createPaymentForwarding (docs)
  • caClient.BC.XXX.paymentForwarding.deletePayment (docs)
  • caClient.BC.XXX.paymentForwarding.listPayments (docs)
  • caClient.BC.XXX.paymentForwarding.listPaymentsHistory (docs)

Webhook methods

  • caClient.BC.XXX.webhook.createNewBlockWebHook (docs)
  • caClient.BC.XXX.webhook.createConfirmedTransactionWebHook (docs)
  • caClient.BC.XXX.webhook.createAddressTransactionWebHook (docs)
  • caClient.BC.XXX.webhook.createTransactionConfirmationsWebHook (docs)
  • (ETH only) caClient.BC.XXX.webhook.createTokenWebHook (docs)
  • caClient.BC.XXX.webhook.listAllHooks (docs)
  • caClient.BC.XXX.webhook.deleteWebHook (docs)
  • caClient.BC.XXX.webhook.deleteAllMyWebhooks (docs)

Crypto Market Data APIs

Metadata

  • caClient.CMD.meta.listAllExchanges (docs)
  • caClient.CMD.meta.listExchangesBySupportingAssets (docs)
  • caClient.CMD.meta.listExchangesBySupportingPairs (docs)
  • caClient.CMD.meta.listAllSymbolsSupportedInExchange (docs)
  • caClient.CMD.meta.listAllAssets (docs)
  • caClient.CMD.meta.listAllSymbols (docs)

Base data

  • caClient.CMD.base.listAllExchanges (docs)
  • caClient.CMD.base.getExchangeDetails (docs)
  • caClient.CMD.base.listAllAssets (docs)
  • caClient.CMD.base.getAssetDetails (docs)
  • caClient.CMD.base.getSymbolDetails (docs)

Exchange Rates

  • caClient.CMD.exchangeRates.getSpecificRate (docs)
  • caClient.CMD.exchangeRates.getAllCurrentRates (docs)
  • caClient.CMD.exchangeRates.getSpecificRateInSpecificExchange (docs)
  • caClient.CMD.exchangeRates.getAllCurrentRatesInSpecificExchange (docs)

OHLCV

  • caClient.CMD.OHLCV.listAllPeriods (docs)
  • caClient.CMD.OHLCV.latestData (docs)
  • caClient.CMD.OHLCV.historicalData (docs)

Trades

  • caClient.CMD.trades.getLatestData (docs)
  • caClient.CMD.trades.getLatestDataBySymbol (docs)
  • caClient.CMD.trades.getLatestDataByExchange (docs)
  • caClient.CMD.trades.getLatestDataByAsset (docs)
  • caClient.CMD.trades.getLatestDataByAssetsPair (docs)
  • caClient.CMD.trades.getLatestDataByExchangeAssetsPair (docs)
  • caClient.CMD.trades.tradesGetHistoricalData (docs)
  • caClient.CMD.trades.tradesGetHistoricalDataByExchange (docs)
  • caClient.CMD.trades.tradesGetHistoricalDataByAsset (docs)
  • caClient.CMD.trades.tradesGetHistoricalDataByAssetPair (docs)
  • caClient.CMD.trades.tradesGetHistoricalDataByExchangeAssetPair (docs)

Order Book

  • caClient.CMD.orderBook.getSnapshotBySymbol (docs)

Trading APIs

Exchange Accounts

  • caClient.TR.exchangeAccounts.create (docs)
  • caClient.TR.exchangeAccounts.listAll (docs)
  • caClient.TR.exchangeAccounts.get (docs)
  • caClient.TR.exchangeAccounts.update (docs)
  • caClient.TR.exchangeAccounts.delete (docs)

Private APIs

  • caClient.TR.privateAPIs.listAllExchanges (docs))
  • caClient.TR.privateAPIs.getBalance (docs))
  • caClient.TR.privateAPIs.getDepositAddress (docs))
  • caClient.TR.privateAPIs.getMyTrades (docs))
  • caClient.TR.privateAPIs.getOpenOrders (docs))
  • caClient.TR.privateAPIs.createOrder (docs))
  • caClient.TR.privateAPIs.cancelOrder (docs))
  • caClient.TR.privateAPIs.withdraw (docs))

Arbitrage

  • caClient.TR.arbitrage.listAll (docs)
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free