Introduction

Welcome to Coinazer's API documentation! Coinazer is a simple, mostly RESTful JSON API for interacting with blockchains, accessed over HTTP or HTTPS from the api.coinazer.com domain. Currently, coinazer supports Bitcoin, Ethereum, Litecoin, Dash, Dogecoin, Bitcoin Testnet3, and coinazer's Test Chain (more about coinazer's Test Chain below).

coinazer's API provides a superset of the endpoints you'd find in reference implementations, in addition to some special features that make coinazer uniquely powerful, like our unconfirmed transaction Confidence Factor, dependable WebHook or WebSockets-based Events, and Address Forwarding.

Consequently, if you're familiar with a blockchain's reference implementation, you'll feel at home using coinazer, but without worrying about scaling or implementation challenges. And if you're not familiar---with the reference implementations or blockchains in general---coinazer's API is a great way to dip your toes into blockchain development, without a lengthy setup process. In either case, coinazer has 99.99% up-time, and maintains an expressive, logical API that you'll love.

          
 !(function (e) {
    var n =
   ("object" == typeof window && window) || ("object" == typeof self && self);
    "undefined" == typeof exports || exports.nodeType
     ? n &&
     ((n.hljs = e({})),
    "function" == typeof define &&
      define.amd &&
         define([], function () {
             return n.hljs;
                    }))
                : e(exports);
            })
          
        

Documentation Structure

In these docs you'll find everything you need to leverage coinazer for your applications. For all officially supported languages, you'll see code samples, in addition to basic cURL requests/responses for every endpoint. You can switch between cURL/language samples via the selector in the upper right. We're working on supporting more languages, but if you're working on your own language library, definitely let us know: we'd love to add more community supported libraries here.

Section Summaries

  • Objects: An overview of all the objects in the API, alongside detailed descriptions of every field.
  • Blockchain API: Endpoints to query general information about a blockchain and its blocks.
  • Address API: Query information about addresses, generate addresses, and generate multisig addresses from public keys.
  • Wallet API: Build and modify multiple-address-watching and hierarchical deterministic (HD) wallets, usable throughout the coinazer API.
  • Transaction API: Information about transactions, how to generate/send your own, and how to embed data into the blockchain.
  • Confidence Factor: Get an accurate measure of the likelihood of a successful double-spend against your unconfirmed transactions.
  • Metadata API: Store both public and private key-value pairs against addresses, transactions, and blocks.
  • Assets API: Create and manage your own assets---embedded on a public blockchain---via the Open Assets standard.
  • Address Forwarding: Create one-time addresses that will automatically forward to an address of your choosing, while optionally adding processing fees.
  • Events and Hooks: Reliable notifications system for a wide variety of events on blockchains, available through WebHooks or WebSockets.Reliable notifications system for a wide variety of events on blockchains, available through WebHooks or WebSockets.
  • Updates: Reliable notifications system for a wide variety of events on blockchains, available through WebHooks or WebSockets.Reliable notifications system for a wide variety of events on blockchains, available through WebHooks or WebSockets.
  •           
      // JavaScript examples use JQuery and can be run directly in your browser
      // console (ctrl+shift+i or cmd+shift+i).
      // Porting them to node.js should be trivial, replacing JQuery methods with
      // request.js for example.
      
     console.log('Welcome to Coinazer);
              
            

    API Versions

    All API calls are versioned, and the current coinazer API is v1. We will never introduce any breaking changes within v1, but we may add new, non-breaking features from time to time.

    RESTful Resources

    Almost all resources exist under a given blockchain, and follow this pattern:

    https://api.coinazer.com/
    $API_VERSION/$COIN/$CHAIN/

    Currently, there's only one version of the API (v1). Thus, here's an exhaustive list of blockchains and their corresponding resources:

    coin chain resource
    Bitcoin main api.coinazer.com/v1/btc/main
    Bitcoin testnet3 api.coinazer.com/v1/btc/test3
    dash main api.coinazer.com/v1/dash/main
    dogecoin main api.coinazer.com/v1/doge/main
    litecoin main api.coinazer.com/v1/ltc/main
    litecoin test api.coinazer.com/v1/bcy/test
              
      // JavaScript examples use JQuery and can be run directly in your browser
      $.get('https://api.coinazer.com/v1/btc/main').then(function(d) {console.log(d)});
       {
         "name": "BTC.main",
         "height": 355578,
         "hash": "00000000000000000a0b253f20709b0c77d8a56aa8db632ecbdc7381816504cd",
         "time": "2015-05-08T23:12:55.243311146Z",
         "latest_url": "https://api.coinazer.com/v1/btc/main/blocks/00000000000000000a0b253f20709b0c77d8a56aa8db632ecbdc7381816504cd",
         "previous_hash": "00000000000000000acef50ef89494493b4a08a8419588e1e3e20cd73bc85a6b",
         "previous_url": "https://api.coinazer.com/v1/btc/main/blocks/00000000000000000acef50ef89494493b4a08a8419588e1e3e20cd73bc85a6b",
         "peer_count": 250,
         "unconfirmed_count": 637,
         "high_fee_per_kb": 45768,
         "medium_fee_per_kb": 29415,
         "low_fee_per_kb": 12045
       }
      
              
            

    Rate Limits and Tokens

    We want everyone to try coinazer with as little friction as possible, which is why you don't need a token for any read-only GET calls. Please register for a user token if you want to use POST and DELETE calls. Once you have your token, you can append it to all your requests like any other URL parameter if you're using cURL, or through the appropriate method in the language SDK you're using.

    We do rate-limit our free tier, with or without a token (though tokens are required for Confidence lookups, WebHooks/Sockets, Payments, and any POST or DELETE calls):

  • Classic requests, up to 3 requests/sec and 200 requests/hr
  • WebHooks and WebSockets, up to 200 requests sent to your servers/hr
  • WebHooks, up to 200 stored on our servers
  • Confidence lookups, up to 15 requests/hour
  • The hourly rate limits reset on the top of the hour UTC. For example, if you're under the free tier, and you have used 200 regular requests by 03:58 UTC, you'll hit a rate limit until it resets at 04:00 UTC.

    If you exceed these limits, your requests will return an HTTP Status Code 429!

    On the accounts page, you'll find paid plans starting at $75 a month (with a 10% discount if you pay with Bitcoin). To request higher limits or SLAs beyond what's offered on the accounts page, please email us.

    You can check your current limits and usage via a GET on the following endpoint, outside of our normal coin/chain pattern:

    Within that return object, you'll also find hits_history array, which shows your token's last 48 hours of usage, while hits shows the current hour's usage.

    You can even see information about your remaining limits by checking the X-Ratelimit-Remaining attribute in the HTTP header in normal API calls. Keep in mind the X-Ratelimit-Remaining attribute corresponds to the hourly rate limit associated with the endpoint you call (e.g., if it's from a WebHook, that corresponds to the Hooks/Hour; if it's a normal call, the number corresponds to the normal Requests/Hour limit).

              
     // Adding your token as URL parameter
    const TOKEN = 'YOUR_TOKEN';
     $.get('https://api.coinazer.com/v1/btc/main?token='+TOKEN);
              
            

    Bacthing

    All endpoints that can retrieve a single Object can be batched to return multiple objects. If you're cURLing the API directly, batching simply requires appending each identifier to the previous one using a semicolon (check the code pane for an example). The results are aggregated in a JSON array. The other supported client SDKs batch differently, but each idiomatic to their respective language (check the code pane examples in each library).

    The maximum number of elements that can be batched in a single call is 100.

              
                // Batching blocks 5, 6, and 7
    
                $.get('https://api.coinazer.com/v1/btc/main/blocks/5;6;7')
                  .then(function(d) {console.log(d);});
      [{
     "hash": "000000003031a0e73735690c5a1ff2a4be82553b2a12b776fbd3a215dc8f778d",
     "height": 6,
     "chain": "BTC.main",
     "total": 0,
     "fees": 0,
     "ver": 1,
     "time": "2009-01-09T03:29:49Z",
     ...,
     },
     {
     "hash": "000000009b7262315dbf071787ad3656097b892abffd1f95a1a022f896f533fc",
     "height": 5,
     "chain": "BTC.main",
     "total": 0,
     "fees": 0,
     "ver": 1,
     "time": "2009-01-09T03:23:48Z",
     ...,
     }]
              
            

    Testing

    We offer an automated faucets for coinazer's Test Chain. We recommend using coinazer's Test Chain for a variety of reasons:

  • It's nearly identical in characteristics to Bitcoin Main, with a few differences listed below.
  • The prefix for standard addreses is 'B' or 'C' (0x1B). The prefix for multisig addresses is 'D' (0x1F). This is also known as the "address version byte.
  • The chain is private (no data is broadcasted, only coinazer mines the transactions), making it much more predictable than the Bitcoin's testnet (which is frequently under attack).
  • New blocks get built every minute, confirming the transactions that have been created using our transaction API.
  • Test Faucets

    To help facilitate automated testing in your applications, a faucet endpoint is available on coinazer's Test Chain. Calling the faucet endpoint, along with passing a valid address, will automatically create---and propagate---a new transaction funding the address with the amount you provide.

    This example shows how to leverage the faucet to programmatically fund addresses, to test your applications.

    You need a token to use test faucets.
              
                // Batching blocks 5, 6, and 7
    
                $.get('https://api.coinazer.com/v1/btc/main/blocks/5;6;7')
                  .then(function(d) {console.log(d);});
      [{
     "hash": "000000003031a0e73735690c5a1ff2a4be82553b2a12b776fbd3a215dc8f778d",
     "height": 6,
     "chain": "BTC.main",
     "total": 0,
     "fees": 0,
     "ver": 1,
     "time": "2009-01-09T03:29:49Z",
     ...,
     },
     {
     "hash": "000000009b7262315dbf071787ad3656097b892abffd1f95a1a022f896f533fc",
     "height": 5,
     "chain": "BTC.main",
     "total": 0,
     "fees": 0,
     "ver": 1,
     "time": "2009-01-09T03:23:48Z",
     ...,
     }]
              
            

    Blockchain API

    The first component---and highest level---of the coinazer API allows you to query general information about blockchain and blocks based on the coin/chain resource you've selected for your endpoints.

    If you're new to blockchains, you can think of the blockchain itself as an immutable, distributed ledger. Each block in the blockchain is like a "page" in the ledger containing information about transactions between parties. A great place to start understanding the mechanics behind blockchains is the original Bitcoin whitepaper.

    Chain Endpoint

    General information about a blockchain is available by GET-ing the base resource.

    resource method return object
    / GET blockchain

    The returned object contains a litany of information about the blockchain, including its height, the time/hash of the latest block, and more.

    For more detailed information about the data returned, check the Blockchain object.

              
                $.get('https://api.coinazer.com/v1/btc/main').then(function(d) {console.log(d)});
     {
        "name": "BTC.main",
        "height": 355578,
        "hash": "00000000000000000a0b253f20709b0c77d8a56aa8db632ecbdc7381816504cd",
        "time": "2015-05-08T23:12:55.243311146Z",
        "latest_url": "https://api.coinazer.com/v1/btc/main/blocks/00000000000000000a0b253f20709b0c77d8a56aa8db632ecbdc7381816504cd",
        "previous_hash": "00000000000000000acef50ef89494493b4a08a8419588e1e3e20cd73bc85a6b",
        "previous_url": "https://api.coinazer.com/v1/btc/main/blocks/00000000000000000acef50ef89494493b4a08a8419588e1e3e20cd73bc85a6b",
        "peer_count": 250,
        "unconfirmed_count": 637,
        "high_fee_per_kb": 45768,
        "medium_fee_per_kb": 29415,
        "low_fee_per_kb": 12045
      }
              
            

    Block Hash Endpoint

    If you want more data on a particular block, you can use the Block Hash endpoint.

    resource method return object
    /blocks/$BLOCK_HASH GET block

    The returned object contains a litany of information about the blockchain, including its height, the time/hash of the latest block, and more.

    For more detailed information about the data returned, check the Blockchain object.

    resouflagrce type effect
    txstart integer Filters response to only include transaction hashes after txstart in the block.
    limit integer Filters response to only include a maximum of limit transactions hashes in the block. Maximum value allowed is 500.

    BLOCK_HASH is a string representing the hash of the block you're interested in querying, for example:

    0000000000000000189bba3564a63772107b

    The returned object contains information about the block, including its height, the total amount of satoshis transacted within it, the number of transactions in it, transaction hashes listed in the canonical order in which they appear in the block, and more. For more detail on the data returned, check the Block object.

              
                $.get('https://api.coinazer.com/v1/btc/main').then(function(d) {console.log(d)});
                $.get('https://api.coinazer.com/v1/btc/main/blocks/00000000000000000003dc20b868d17121303308f6bba329302e75913f0790db')
                .then(function(d) {console.log(d)});
              >{
               "hash": "00000000000000000003dc20b868d17121303308f6bba329302e75913f0790db",
               "height": 671142,
               "chain": "BTC.main",
               "total": 2928942845838,
               "fees": 135268918,
               "size": 1448143,
               "vsize": 998941,
               "ver": 1073725440,
               "time": "2021-02-18T16:01:12Z",
               "received_time": "2021-02-18T16:02:17.341Z",
               "coinbase_addr": "",
               "relayed_by": "68.168.176.51:8333",
               "bits": 386736569,
               "nonce": 3270005482,
               "n_tx": 2025,
               "prev_block": "00000000000000000001245ac74971793689be7924cd0b031302661e806deb0d",
               "mrkl_root": "5283c26fb8d64d2284ffda76af6cd584292b76f265932cd121ac16fb475d7a8a",
               "txids": [
                 "39dec39382157569b809446037c6d5658d490e38907060112c16d8de49aeab0b",
                 "ce0a8256a459ba14feb48931a2344ff7af3af4f9aa2b5acb795a1b0b9fd8806e",
                 "2d11ef988d9960a12f94d76525cc0001cf56bb9d3c7d47d405e8a40a008da653",
                 "17648e06bdb4a126b8ebdf763e21107a5e54b548c266b056dfcb4aae3343253e",
                 "7fbb8ce7ab5aba798eca6eab0076af2f5c621576d90a1cb471da62f4fca61df3",
                 "acf6a8781c6df77a437daa70fa2d51acf4b2fc70dc60cb3890b74901173ad125",
                 "cab8f38c42d82524767ad1c3443bf4c00cb6a4f9f5b19eb1c57e6c13123c2d67",
                 "dfb6dcce198a2d6415d3e322a0c3b6957d5a35e7cbdffeac209ed71cac9dd3f5",
                 "786c4e4bd5f456bf2c42eef8374cf41b5a4e6ccccda3043ea2612840a2523fc4",
                 "f28339e0247323e59c0d49d2480b8abb48fba4190e8f83bc37d1f095e29dd958",
                 "f7133abcf74884575296c1e2c3545080f88aa753f9542c88bffb79cdb34a4aa5",
                 "5db89c67ccaaa248028989c52bfa952eafc171d3e48fd15ba5dd0dfd368e1c06",
                 "dc4cc5acf9edb14cd9b8659d4a2405eae5d425867d861607f89826ffcb0f5459",
                 "fec4304054685c4a25f56b057ae3bab421fa998ca91812ad849c2518b3969288",
                 "e8441b85cc6036e40f745de4fd909b98507656d7e3a5762578ec50a03219099a",
                 "023c1577f21a7fdd428cc514726483c10039bd65afdf2f3da2b890f74350a073",
                 "389a04bfa0b809c33b147f24104d4a60581578da644282931abfff8d5a248679",
                 "ea31698b76076d4a2fef47d1c0dbc9df4539abf072e8bd29cefbf65daddaa6c5",
                 "1d52fbf97eaf19935edf21543f27455b7102290edc1d1f143fcb7b235196ddd3",
                 "60e5282257e1ebd742589a7122ff52aa7d78ef1821027301e84335e71ac19790"
               ],
               "depth": 5,
               "prev_block_url": "https://api.coinazer.com/v1/btc/main/blocks/00000000000000000001245ac74971793689be7924cd0b031302661e806deb0d",
               "tx_url": "https://api.coinazer.com/v1/btc/main/txs/",
               "next_txids": "https://api.coinazer.com/v1/btc/main/blocks/00000000000000000003dc20b868d17121303308f6bba329302e75913f0790db?txstart=20\u0026limit=20"
              }
              
            

    Block Height Endpoint

    You can also query for information on a block using its height, using the same resource but with a different variable type.

    resource method return object
    /blocks/$BLOCK_HEIGHT GET block
    flag type effect
    txstart integer Filters response to only include transaction hashes after txstart in the block.
    limit integer Filters response to only include a maximum of limit transactions hashes in the block. Maximum value allowed is 500.

    BLOCK_HEIGHT is an integer representing the height of the block you're interested in querying, for example:

    294322

    As above, the returned object contains information about the block, including its hash, the total amount of satoshis transacted within it, the number of transactions in it, transaction hashes listed in the canonical order in which they appear in the block, and more. For more detail on the data returned, check the Block object.

    With recent blocks, $BLOCK_HEIGHT is not always a unique identifier, due to the possibility of soft forks and the nature of the consensus model with blockchains. If you're querying blocks with depth above 10 (i.e., there are more than 10 blocks ahead of your target) the height should be a safe identifier.

              
    $.get('https://api.coinazer.com/v1/btc/main/blocks/671142?txstart=1&limit=1')
    .then(function(d) {console.log(d)});
    {
     "hash": "00000000000000000003dc20b868d17121303308f6bba329302e75913f0790db",
     "height": 671142,
     "chain": "BTC.main",
     "total": 2928942845838,
     "fees": 135268918,
     "size": 1448143,
     "vsize": 998941,
     "ver": 1073725440,
     "time": "2021-02-18T16:01:12Z",
     "received_time": "2021-02-18T16:02:17.341Z",
     "coinbase_addr": "",
     "relayed_by": "68.168.176.51:8333",
     "bits": 386736569,
     "nonce": 3270005482,
     "n_tx": 2025,
     "prev_block": "00000000000000000001245ac74971793689be7924cd0b031302661e806deb0d",
     "mrkl_root": "5283c26fb8d64d2284ffda76af6cd584292b76f265932cd121ac16fb475d7a8a",
     "txids": [
       "39dec39382157569b809446037c6d5658d490e38907060112c16d8de49aeab0b"
     ],
     "depth": 5,
     "prev_block_url": "https://api.coinazer.com/v1/btc/main/blocks/00000000000000000001245ac74971793689be7924cd0b031302661e806deb0d",
     "tx_url": "https://api.coinazer.com/v1/btc/main/txs/",
     "next_txids": "https://api.coinazer.com/v1/btc/main/blocks/00000000000000000003dc20b868d17121303308f6bba329302e75913f0790db?txstart=20\u0026limit=20"
    }
              
            

    Feature Endpoint

    resource method
    /feature/$NAME GET

    If you're curious about the adoption of upgrade features on a blockchain, you can use this endpoint to get some information about its state on the network. For example, for bip65 on bitcoin, you could check its state via this URL: https://api.coinazer.com/v1/btc Generally speaking, for bitcoin, this will follow the form of tracking bipXX (where XX = a number), but the list of features we're tracking is always changing.

    Address API

    coinazer's Address API allows you to look up information about public addresses on the blockchain, generate single-use, low-value key pairs with corresponding addresses, help generate multisig addresses, and collect multiple addresses into a single shortcut for address viewing, all based on the coin/chain resource you've selected for your endpoints.

    If you're new to blockchains, you can think of public addresses as similar to bank account numbers in a traditional ledger. The biggest differences:

  • Anyone can generate a public address themselves (through ECDSA in Bitcoin). No single authority is needed to generate new addresses; it's just public-private key cryptography.
  • Public addresses are significantly more lightweight. Consequently, and unlike traditional bank accounts, you can (and should!) generate new addresses for every transaction.
  • Addresses can also leverage pay-to-script-hash, which means they can represent exotic things beyond a single private-public key pair; the most prominent example being multi-signature addresses that require n-of-m signatures to spend.
  • Address Balance Endpoint

    The Address Balance Endpoint is the simplest---and fastest---method to get a subset of information on a public address.

    resource method address
    /addrs/$ADDRESS/balance GET address
    flag type effect
    omitWalletAddresses bool If omitWalletAddresses is true and you're querying a Wallet or HDWallet, the response will omit address information (useful to speed up the API call for larger wallets).

    ADDRESS is a string representing the public address (or wallet/HD wallet name) you're interested in querying, for example:

    1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD

    The returned object contains information about the address, including its balance in satoshis and the number of transactions associated with it. The endpoint omits any detailed transaction information, but if that isn't required by your application, then it's the fastest and preferred way to get public address information.

              
    $.get('https://api.coinazer.com/v1/btc/main/addrs/1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD/balance')
    .then(function(d) {console.log(d)});
     {
       "address": "1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD",
       "total_received": 4433416,
       "total_sent": 0,
       "balance": 4433416,
       "unconfirmed_balance": 0,
       "final_balance": 4433416,
       "n_tx": 7,
       "unconfirmed_n_tx": 0,
       "final_n_tx": 7
     }
              
            

    Address Endpoint

    The default Address Endpoint strikes a balance between speed of response and data on Addresses. It returns more information about an address' transactions than the Address Balance Endpoint but doesn't return full transaction information (like the Address Full Endpoint).

    resource method address
    /addrs/$ADDRESS GET address
    flag type effect
    unspentOnly bool If unspentOnly is true, filters response to only include unspent transaction outputs (UTXOs).
    includeScript bool If includeScript is true, includes raw script of input or output within returned TXRefs.
    includeConfidence bool If true, includes the confidence attribute (useful for unconfirmed transactions) within returned TXRefs. For more info about this figure, check the Confidence Factor documentation.
    before integer Filters response to only include transactions below before height in the blockchain.
    after integer Filters response to only include transactions above after height in the blockchain.
    limit integer limit sets the minimum number of returned TXRefs; there can be less if there are less than limit TXRefs associated with this address, but there can be more in the rare case of more TXRefs in the block at the bottom of your call. This ensures paging by block height never misses TXRefs. Defaults to 200, maximum is 2000.
    confirmations integer If set, only returns the balance and TXRefs that have at least this number of confirmations.
    confidence integer Filters response to only include TXRefs above confidence in percent; e.g., if this is set to 99, will only return TXRefs with 99% confidence or above (including all confirmed TXRefs). For more detail on confidence, check the Confidence Factor documentation.
    omitWalletAddresses bool If omitWalletAddresses is true and you're querying a Wallet or HDWallet, the response will omit address information (useful to speed up the API call for larger wallets).

    ADDRESS is a string representing the public address (or wallet/HD wallet name) you're interested in querying, for example:

    1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD

    The returned object contains information about the address, including its balance in satoshis, the number of transactions associated with it, and transaction inputs/outputs in descending order by block height---and if multiple transaction inputs/outputs associated with this address exist within the same block, by descending block index (position in block).

              
    $.get('https://api.coinazer.com/v1/btc/main/addrs/1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD')
    .then(function(d) {console.log(d)});
     {
     "address": "1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD",
     "total_received": 4433416,
     "total_sent": 0,
     "balance": 4433416,
     "unconfirmed_balance": 0,
     "final_balance": 4433416,
     "n_tx": 7,
     "unconfirmed_n_tx": 0,
     "final_n_tx": 7,
     "txrefs": [
       {
       "tx_hash": "14b1052855bbf6561bc4db8aa501762...",
       "block_height": 302013,
       "tx_input_n": -1,
       "tx_output_n": 0,
       "value": 20213,
       "ref_balance": 4433416,
       "spent": false,
       "confirmations": 55061,
       "confirmed": "2014-05-22T03:46:25Z",
       "double_spend": false
       },
       {
       "tx_hash": "4cff011ec53022f2ae47197d1a2fd4a6...",
       "block_height": 302002,
       "tx_input_n": -1,
       "tx_output_n": 0,
       "value": 40596,
       "ref_balance": 4413203,
       "spent": false,
       "confirmations": 55072,
       "confirmed": "2014-05-22T02:56:08Z",
       "double_spend": false
       },
     ...
     ],
     "tx_url": "https://api.coinazer.com/v1/btc/main/txs/"
     }
              
            

    Address Full Endpoint

    The Address Full Endpoint returns all information available about a particular address, including an array of complete transactions instead of just transaction inputs and outputs. Unfortunately, because of the amount of data returned, it is the slowest of the address endpoints, but it returns the most detailed data record.

    resource method address
    /addrs/$ADDRESS/full GET address
    flag type effect
    before integer If unspentOnly is true, filters response to only include unspent transaction outputs (UTXOs).
    includeScript bool Filters response to only include transactions below before height in the blockchain.
    after integer Filters response to only include transactions above after height in the blockchain.
    limit integer Filters response to only include transactions below before height in the blockchain.
    after integer limit sets the minimum number of returned TXs; there can be less if there are less than limit TXs associated with this address, but there can also be more in the rare case of more TXs in the block at the bottom of your call. This ensures paging by block height never misses TXs. Defaults to 10, maximum is 50.
    txlimit integer This filters the TXInputs/TXOutputs within the returned TXs to include a maximum of txlimit items.
    confirmations integer If set, only returns the balance and TXRefs that have at least this number of confirmations.
    confidence integer Filters response to only include TXs above confidence in percent; e.g., if this is set to 99, will only return TXs with 99% confidence or above (including all confirmed TXs). For more detail on confidence, check the Confidence Factor documentation.
    legacyaddrs bool Litecoin Only. Replaces P2SH prefix with legacy 3 instead of M. Disabled by default.
    includeHex bool If true, includes hex-encoded raw transaction for each TX; false by default.
    includeConfidence bool If true, includes the confidence attribute (useful for unconfirmed transactions) within returned TXs. For more info about this figure, check the Confidence Factor documentation.
    omitWalletAddresses bool If omitWalletAddresses is true and you're querying a Wallet or HDWallet, the response will omit address information (useful to speed up the API call for larger wallets).

    ADDRESS is a string representing the public address (or wallet/HD wallet name) you're interested in querying, for example:

    1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD

    The returned object contains information about the address, including its balance in satoshis, the number of transactions associated with it, and transaction inputs/outputs in descending order by block height---and if multiple transaction inputs/outputs associated with this address exist within the same block, by descending block index (position in block).

              
    $.get('https://api.coinazer.com/v1/btc/main/addrs/1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD/full?before=300000')
    .then(function(d) {console.log(d)});
     {
     "address": "1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD",
     "total_received": 4433416,
     "total_sent": 0,
     "balance": 4433416,
     "unconfirmed_balance": 0,
     "final_balance": 4433416,
     "n_tx": 7,
     "unconfirmed_n_tx": 0,
     "final_n_tx": 7,
     "txs": [
       {
       "block_hash": "0000000000000000af64802c79...",
       "block_height": 292586,
       "hash": "b4735a0690dab16b8789fceaf81c511f...",
       "addresses": [
         "18KXZzuC3xvz6upUMQpsZzXrBwNPWZjdSa",
         "1AAuRETEcHDqL4VM3R97aZHP8DSUHxpkFV",
         "1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD",
         "1VxsEDjo6ZLMT99dpcLu4RQonMDVEQQTG"
       ],
       "total": 3537488,
       "fees": 20000,
       "size": 438,
       "preference": "medium",
       "relayed_by": "",
       "confirmed": "2014-03-26T17:08:04Z",
       "received": "2014-03-26T17:08:04Z",
       "ver": 1,
       "lock_time": 0,
       "double_spend": false,
       "vin_sz": 2,
       "vout_sz": 2,
       "confirmations": 64492,
       "confidence": 1,
       "inputs": [
         {
         "prev_hash": "729f6469b59fea5da7...",
         "output_index": 0,
         "script": "483045022100d06cdad1a...",
         "output_value": 3500000,
         "sequence": 4294967295,
         "addresses": [
           "1VxsEDjo6ZLMT99dpcLu4RQonMDVEQQTG"
         ],
         "script_type": "pay-to-pubkey-hash"
         },
         ...
       ],
       "outputs": [
         {
         "value": 3500000,
         "script": "76a9148629647bd642a237...",
         "addresses": [
           "1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD"
         ],
         "script_type": "pay-to-pubkey-hash"
         },
         {
         "value": 37488,
         "script": "76a9145049e2ad94ed9c68...",
         "spent_by": "3ebe4bb294beaed58aca83...",
         "addresses": [
           "18KXZzuC3xvz6upUMQpsZzXrBwNPWZjdSa"
         ],
         "script_type": "pay-to-pubkey-hash"
         }
       ]
       },
       ...,
     ]
     }
              
            

    Generate Address Endpoint

    The Generate Address endpoint allows you to generate private-public key-pairs along with an associated public address. No information is required with this POST request.

    The private key returned is immediately discarded by our servers, but we advise that these keys should not be used for any high-value---or long-term storage---addresses.

    Always use HTTPS for Address Generation requests. Otherwise, your generated private keys will be sent over insecure channels and could be MITM'd.

    resource method Request Object Return Object
    /addrs POST nil addressKeychain
    flag Type effect
    bech32 bool Whether or not to generate a p2wpkh bech32 address. Default is false.

    The returned object contains a private key in hex-encoded and wif-encoded format, a public key, and a public address.

              
    $.post('https://api.coinazer.com/v1/btc/test3/addrs')
    .then(function(d) {console.log(d)});
     {
     "private": "81ee75559d37cbe4b7cbbfb9931ab1ba32172c5cdfc3ac2d020259b4c1104198",
     "public": "0231ff9ec76820cb36b69061f6ffb125db3793b4aced468a1261b0680e1ef4883a",
     "address": "mvpW7fMSi1nbZhJJDySNS2PUau8ppnu4kY",
     "wif": "cRwGhRjCuuNtPgLcoYd1CuAqjFXCV5YNCQ1LB8RsFCvu61VfSsgR"
     }
              
            

    Generate Multisig Address Endpoint

    The Generate Multisig Address Endpoint is a convenience method to help you generate multisig addresses from multiple public keys. After supplying a partially filled-out AddressKeychain object (including only an array of hex-encoded public keys and the script type), the returned object includes the computed public address.

    This endpoint is the same resource as the Generate Address Endpoint, but with data in the request body.

    resource method Request Object Return Object
    /addrs POST addressKeychain addressKeychain
              
    var data = {
      "pubkeys": [
        "02c716d071a76cbf0d29c29cacfec76e0ef8116b37389fb7a3e76d6d32cf59f4d3",
        "033ef4d5165637d99b673bcdbb7ead359cee6afd7aaf78d3da9d2392ee4102c8ea",
        "022b8934cc41e76cb4286b9f3ed57e2d27798395b04dd23711981a77dc216df8ca"
      ],
      "script_type": "multisig-2-of-3"
    };
    $.post('https://api.coinazer.com/v1/btc/test3/addrs', JSON.stringify(data))
      .then(function(d) {console.log(d)});
       {
       "private": "",
       "public": "",
       "address": "3BF1M1PnTge94QewuWh3B8mRVw8U4SVnb4",
       "wif": "",
       "pubkeys": [
         "02c716d071a76cbf0d29c29cacfec76e0ef8116b37389fb7a3e76d6d32cf59f4d3",
         "033ef4d5165637d99b673bcdbb7ead359cee6afd7aaf78d3da9d2392ee4102c8ea",
         "022b8934cc41e76cb4286b9f3ed57e2d27798395b04dd23711981a77dc216df8ca"
       ],
       "script_type": "multisig-2-of-3"
       }
              
            

    transaction API

    coinazer's Transaction API allows you to look up information about unconfirmed transactions, query transactions based on hash, create and propagate your own transactions, including multisignature transactions, and embed data on the blockchain---all based on the coin/chain resource you've selected for your endpoints.

    If you're new to blockchains, the idea of transactions is relatively self-explanatory. Here's what's going on underneath the hood: a transaction takes previous "unspent transaction outputs" (also known as UTXOs) as "transaction inputs" and creates new "locking scripts" on those inputs such that they are "sent" to new addresses (to become new UTXOs). While most of these public addresses are reference points for single private keys that can "unlock" the newly created UTXOs, occasionally they are sent to more exotic addresses through pay-to-script-hash, typically multisignature addresses.

    Generally speaking, UTXOs are generated from previous transactions (except for Coinbase inputs).

    Even if you don't use the API to assist in creating transactions, we highly recommend using coinazer to push your raw transactions. coinazer maintains connections to 20% of all nodes on all blockchains it supports, which means we can propagate transactions faster than almost anyone else. Given our speed and reliability, this is especially powerful when used in concert with our Confidence Factor.

    Transaction Hash Endpoint

    The Transaction Hash Endpoint returns detailed information about a given transaction based on its hash.

    resource method return object
    /txs/$TXHASH GET TX
    flag type effect
    limit integer Filters TXInputs/TXOutputs, if unset, default is 20.
    instart integer Filters TX to only include TXInputs from this input index and above.
    outstart integer Filters TX to only include TXOutputs from this output index and above.
    legacyaddrs bool Litecoin Only. Replaces P2SH prefix with legacy 3 instead of M. Disabled by default.
    includeHex bool If true , includes hex-encoded raw transaction; false by default.
    includeConfidence bool If true , includes the confidence attribute (useful for unconfirmed transactions). For more info about this figure, check the Confidence Factor documentation.

    TXHASH is a string representing the hex-encoded transaction hash you're interested in querying, for example:

    f854aebae95150b379cc1187d848d58225f3

    The returned object contains detailed information about the transaction, including the value transfered, date received, and a full listing of inputs and outputs.

              $.get('https://api.coinazer.com/v1/btc/main/txs/f854aebae95150b379cc1187d848d58225f3c4157fe992bcd166f58bd5063449').then(function(d) {console.log(d)});
     {
     "block_hash": "0000000000000000c504bdea36e5...",
     "block_height": 293000,
     "hash": "f854aebae95150b379cc1187d848d58225f...",
     "addresses": [
       "13XXaBufpMvqRqLkyDty1AXqueZHVe6iyy",
       "19YtzZdcfs1V2ZCgyRWo8i2wLT8ND1Tu4L",
       "1BNiazBzCxJacAKo2yL83Wq1VJ18AYzNHy",
       "1GbMfYui17L5m6sAy3L3WXAtf1P32bxJXq",
       "1N2f642sbgCMbNtXFajz9XDACDFnFzdXzV"
     ],
     "total": 70320221545,
     "fees": 0,
     "size": 636,
     "vsize": 636,
     "preference": "low",
     "relayed_by": "",
     "confirmed": "2014-03-29T01:29:19Z",
     "received": "2014-03-29T01:29:19Z",
     "ver": 1,
     "lock_time": 0,
     "double_spend": false,
     "vin_sz": 4,
     "vout_sz": 1,
     "confirmations": 64373,
     "inputs": [
       {
       "prev_hash": "583910b7bf90ab802e22e5c25a89b59...",
       "output_index": 1,
       "script": "4830450220504b1ccfddf508422bdd8b0f...",
       "output_value": 16450000,
       "sequence": 4294967295,
       "addresses": [
         "1GbMfYui17L5m6sAy3L3WXAtf1P32bxJXq"
       ],
       "script_type": "pay-to-pubkey-hash"
       },
       ...
     ],
     "outputs": [
       {
       "value": 70320221545,
       "script": "76a914e6aad9d712c419ea8febf009a3f3...",
       "spent_by": "35832d6c70b98b54e9a53ab2d51176eb...",
       "addresses": [
         "1N2f642sbgCMbNtXFajz9XDACDFnFzdXzV"
       ],
       "script_type": "pay-to-pubkey-hash"
       }
     ]
     }
              
            

    Unconfirmed Transactions Endpoint

    The Unconfirmed Transactions Endpoint returns an array of the latest transactions relayed by nodes in a blockchain that haven't been included in any blocks.

    resource method return object
    /txs GET Array[TX]
    flag type effect
    limit integer Maximum number of transactions returned, if unset, default is 10. Maximum is 100.
    minValue integer Filter transactions that transfer a total above the minimal value provided (in satoshis).

    The returned object is an array of transactions that haven't been included in blocks, arranged in reverse chronological order (latest is first, then older transactions follow).

    Due to transaction malleability it can be difficult to deal with transaction hashes before they've been confirmed in blocks. Use caution, and consider applying our Confidence Factor to mitigate potential issues.

              
    $.get('https://api.coinazer.com/v1/btc/main/txs').then(function(d) {console.log(d)});
       [
         {
         "block_height": -1,
         "hash": "7f3af38d988e479f651520b13b85...",
         "addresses": [
           "19ZZonTmBD3VBhgFSWrtNis6Wo4aNRyjAV",
           "1GD2Gnt3Vk51FpUhZWrFpSa24KE2ZGPaWG",
           "1HEJiW8jxvUvVQ5cuButRmFj6ZzKzM9Fp6"
         ],
         "total": 46977000,
         "fees": 10000,
         "size": 225,
         "vsize": 225,
         "preference": "medium",
         "relayed_by": "54.209.56.58:8333",
         ...
         },
         {
         "block_height": -1,
         "hash": "7e2d8b4e95c8246e81f297539409...",
         "addresses": [
           "12u8EFJR6QJpNYbuQcYt2iMsAtPdnCFwQb",
           "1MUbYoqSadRSEipwcmKnH37NaKakDCmgwW"
         ],
         "total": 1070000,
         "fees": 10000,
         "size": 225,
         "vsize": 225,
         "preference": "medium",
         "relayed_by": "52.1.229.213:8333",
         "received": "2015-05-21T05:44:13.878Z",
         ...
         },
       ...
       ]
              
            

    Creating Transactions

    Using coinazer's API, you can push transactions to blockchains one of two ways:

  • Use a third party library to create your transactions and push raw transactions
  • Use our two-endpoint process outlined below, wherein we generate a TXSkeleton based on your input address, output address, and value to transfer.
  • In either case, for security reasons, we never take possession of your private keys.

    Always use HTTPS for creating and pushing transactions.

    New Transaction Endpoint

    pTo use coinazer's two-endpoint transaction creation tool, first you need to provide the input address(es), output address, and value to transfer (in satoshis). Provide this in a partially-filled out TX request object.
    resource method request object return object
    /txs/new POST TX TXSkeleton
    flag type effect
    includeToSignTx bool If true, includes tosign_tx array in TXSkeleton, useful for validating data to sign; false by default.

    As you can see from the code example, you only need to provide a single public address within the addresses array of both the input and output of your TX request object. You also need to fill in the value with the amount you'd like to transfer from one address to another.

    If you'd like, you can even use a Wallet instead of addresses as your input. You just need to use two non-standard fields (your wallet_name and wallet_token ) within the inputs array in your transaction, instead of addresses :

    While this particular usage will differ between client libraries, the result is the same: the addresses within your wallet will be used as the inputs, as if all of them had been placed within the addresses array.

    As a return object, you'll receive a TXSkeleton containing a slightly-more complete TX alongside data you need to sign in the tosign array. You'll need this object for the next steps of the transaction creation process.

    The TXSkeleton returned by this endpoint may contain some data that's temporary or incomplete, like the hash, size, and the inputs' script fields. This is by design, as the final TX can only be computed once signed data has been added. Do not rely on these fields until they are returned and sent to the network via the Send Transaction Endpoint outlined below.

    Validating the Data to Sign

    For the extra cautious, you can protect yourself from a potential malicious attack on coinazer by validating the data we're asking you to sign. Unfortunately, it's impossible to do so directly, as pre-signed signature data is hashed twice using SHA256. To get around this, set the includeToSignTx URL flag to true. The optional tosign_tx array will be returned within the TXSkeleton, which you can use in the following way:

  • Hashing the hex-encoded string twice using SHA256 should give you back the corresponding tosign data.
  • Decoding the hex-encoded string using our /txs/decode endpoint (or an independent, client-side source) should give you the output addresses and amounts that match your work-in-progress transaction.
  • If you want to automatically empty your input address(es) without knowing their exact value, your TX request object's value can be set to -1 to sweep all value from your input address(es) to your output address. Please be advised that this only works with a single output address.

    If you are using a bech32 address (starting with bc1) be sure to add 01 (SIGHASH_ALL) at the end of the signature.

    Locally Sign Your Transaction

    With your TXSkeleton returned from the New Transaction Endpoint, you now need to use your private key(s) to sign the data provided in the tosign array.

    Digital signing can be a difficult process, and is where the majority of issues arise when dealing with cryptocurrency transactions. We are working on integrating client-side signing solutions into our libraries to make this process easier. You can read more about signing here. In the mean time, if you want to experiment with client-side signing, consider using our signer tool.

    One of the most common errors in the signing process is a data format mismatch. We always return and expect hex-encoded data, but oftentimes, standard signing libraries require byte arrays. Remember to convert your data, and always send hex-encoded signatures to coinazer.

    Send Transaction Endpoint

    Once you've finished signing the tosign array locally, put that (hex-encoded) data into the signatures array of the TXSkeleton. You also need to include the corresponding (hex-encoded) public key(s) in the pubkeys array, in the order of the addresses/inputs provided. Signature and public key order matters, so make sure they are returned in the same order as the inputs you provided.

    resource method request object return object
    /txs/send POST TXSkeleton TXSkeleton

    If the transaction was successful, you'll receive a TXSkeleton with the completed TX (which contains its final hash) and an HTTP Status Code 201

    Dealing with errors

    Signing and creating transactions can be one of the trickiest parts of using blockchains in your applications. Consequently, when an error is encountered when Creating Transactions, we send back an HTTP Status Code 400 alongside a descriptive array of errors within the TXSkeleton.

    One of the most common errors we see are users who use uncompressed public keys when compressed public keys were used to generate the address; remember to be careful to use the right keys!

                
      var newtx = {
        inputs: [{addresses: ['CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9']}],
        outputs: [{addresses: ['C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn'], value: 100000}]
      };
      $.post('https://api.coinazer.com/v1/bcy/test/txs/new', JSON.stringify(newtx))
        .then(function(d) {console.log(d)});
         {
           "tx": {
             "block_height": -1,
             "hash": "c2b350b273b3bf04791d8e59fc9c021fd91fa423c50c29473dc079150f5a778a",
             "addresses": [
               "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9",
               "C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn"
             ],
             "total": 4988000,
             "fees": 12000,
             "size": 119,
             "vsize": 119,
             "preference": "high",
             "relayed_by": "208.71.159.84",
             "received": "2015-05-21T19:04:14.492743867Z",
             "ver": 1,
             "lock_time": 0,
             "double_spend": false,
             "vin_sz": 1,
             "vout_sz": 2,
             "confirmations": 0,
             "inputs": [
               {
                 "prev_hash": "c8ea8b221580ebb2f1cabc8b40797bffec742b97c82a329df96d93121db43519",
                 "output_index": 0,
                 "script": "",
                 "output_value": 5000000,
                 "sequence": 4294967295,
                 "addresses": [
                   "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9"
                 ],
                 "script_type": "",
                 "age": 4
               }
             ],
             "outputs": [
               {
                 "value": 1000000,
                 "script": "76a9145fb1af31edd2aa5a2bbaa24f6043d6ec31f7e63288ac",
                 "addresses": [
                   "C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn"
                 ],
                 "script_type": "pay-to-pubkey-hash"
               },
               {
                 "value": 3988000,
                 "script": "76a914efec6de6c253e657a9d5506a78ee48d89762fb3188ac",
                 "addresses": [
                   "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9"
                 ],
                 "script_type": "pay-to-pubkey-hash"
               }
             ]
           },
           "tosign": [
             "32b5ea64c253b6b466366647458cfd60de9cd29d7dc542293aa0b8b7300cd827"
           ]
         }
                
              
                
      // next, you sign the data returned in the tosign array locally
      // here we're using bitcoinjs built to expose bigi, buffer, and require
      // you can get bitcoin.js here:
      // http://bitcoinjs.org/
      
      var bitcoin = require("bitcoinjs-lib");
      
      const keyBuffer = Buffer.from(my_hex_private_key, 'hex')
      var keys = bitcoin.ECPair.fromPrivateKey(keyBuffer)
      
      var newtx = {
        inputs: [{addresses: ['CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9']}],
        outputs: [{addresses: ['C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn'], value: 100000}]
      };
      // calling the new endpoint, same as above
      $.post('https://api.coinazer.com/v1/bcy/test/txs/new', JSON.stringify(newtx))
        .then(function(tmptx) {
          // signing each of the hex-encoded string required to finalize the transaction
          tmptx.pubkeys = [];
          tmptx.signatures = tmptx.tosign.map(function (tosign, n) {
            tmptx.pubkeys.push(keys.publicKey.toString('hex'));
            return bitcoin.script.signature.encode(
              keys.sign(Buffer.from(tosign, "hex")),
              0x01,
            ).toString("hex").slice(0, -2);
          });
          // sending back the transaction with all the signatures to broadcast
          $.post('https://api.coinazer.com/v1/bcy/test/txs/send', JSON.stringify(tmptx))
            .done(function (finaltx) {
              console.log(finaltx);
            })
            .fail(function (xhr) {
              console.log(xhr.responseText);
            });
        });
                
              
                
      // this shows just the last step of sending your transaction, see the signing section
      // for the fully integrated sample
      // the request body is truncated because it's huge, but it's the same as the returned
      // object from calling the new endpoint plus the signatures and public keys added in the
      // signing section
      var sendtx = {
        tx: {...},
        tosign: [
          "32b5ea64c253b6b466366647458cfd60de9cd29d7dc542293aa0b8b7300cd827"
        ],
        signatures: [
          "3045022100921fc36b911094280f07d8504a80fbab9b823a25f102e2bc69b14bcd369dfc7902200d07067d47f040e724b556e5bc3061af132d5a47bd96e901429d53c41e0f8cca"
        ],
        pubkeys: [
          "02152e2bb5b273561ece7bbe8b1df51a4c44f5ab0bc940c105045e2cc77e618044"
        ]
      };
      $.post('https://api.coinazer.com/v1/bcy/test/txs/send', JSON.stringify(sendtx))
        .then(function(d) {console.log(d)});
         {
           "tx": {
             "block_height": -1,
             "hash": "4e6dfb1415b4fba5bd257c129847c70fbd4e45e41828079c4a282680528f3a50",
             "addresses": [
               "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9",
               "C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn"
             ],
             "total": 4988000,
             "fees": 12000,
             "size": 226,
             "vsize": 226,
             "preference": "high",
             "relayed_by": "73.162.198.68",
             "received": "2015-05-22T04:38:57.470017042Z",
             "ver": 1,
             "lock_time": 0,
             "double_spend": false,
             "vin_sz": 1,
             "vout_sz": 2,
             "confirmations": 0,
             "inputs": [
               {
                 "prev_hash": "c8ea8b221580ebb2f1cabc8b40797bffec742b97c82a329df96d93121db43519",
                 "output_index": 0,
                 "script": "483045022100921fc36b911094280f07d8504a80fbab9b823a25f102e2bc69b14bcd369dfc7902200d07067d47f040e724b556e5bc3061af132d5a47bd96e901429d53c41e0f8cca012102152e2bb5b273561ece7bbe8b1df51a4c44f5ab0bc940c105045e2cc77e618044",
                 "output_value": 5000000,
                 "sequence": 4294967295,
                 "addresses": [
                   "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9"
                 ],
                 "script_type": "pay-to-pubkey-hash",
                 "age": 546
               }
             ],
             "outputs": [
               {
                 "value": 1000000,
                 "script": "76a9145fb1af31edd2aa5a2bbaa24f6043d6ec31f7e63288ac",
                 "addresses": [
                   "C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn"
                 ],
                 "script_type": "pay-to-pubkey-hash"
               },
               {
                 "value": 3988000,
                 "script": "76a914efec6de6c253e657a9d5506a78ee48d89762fb3188ac",
                 "addresses": [
                   "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9"
                 ],
                 "script_type": "pay-to-pubkey-hash"
               }
             ]
           },
           "tosign": [
             ""
           ]
         }
                
              

    Customizing Transaction Requests

    While we demonstrated the simplest use of our two-endpoint process to create transactions, you can have finer-grain control by modifying the TX request object before sending to /txs/new.

    By default, we allow unconfirmed UTXOs as inputs when creating transactions. If you only want to allow confirmed UTXOs, set the confirmations value in your TX request object to 1.

    Instead of providing addresses, you can use prev_hash and output_index within the inputs array of your request object, in which case, we'll use the inputs as provided and not attempt to generate them from a list of addresses. We will compute change and fees the same way.

    coinazer will set the change address to the first transaction input/address listed in the transaction. To redirect this default behavior, you can set an optional change_address field within the TX request object.

    Fees in cryptocurrencies can be complex. We provide 2 different ways for you to control the fees included in your transactions:

  • Set the preference property in your TX request object to "high", "medium", or "low". This will calculate and include appropriate fees for your transaction to be included in the next 1-2 blocks, 3-6 blocks or 7 or more blocks respectively. You can see the explicit estimates per kilobyte for these high, medium, and low ranges by calling your base resource through the Chain Endpoint. The default fee calculation is based on a "high" preference. A preference set to "zero" will set no fee.
  • Manually set the fee to a desired amount by setting the fees property in your TX request object. Note that a fee too low may result in an error for some transactions that would require it.
  • For even more control, you can also change the script_type in the outputs of your partially filled TX. You'll notice this used to powerful effect in the section on Multisig Transactions. These are the possible script types:

  • pay-to-pubkey-hash (most common transaction transferring to a public key hash, and the default behavior if no out)
  • pay-to-multi-pubkey-hash (multi-signatures transaction, now actually less used than pay-to-script-hash for this purpose)
  • pay-to-pubkey (used for mining transactions)
  • pay-to-script-hash (used for transactions relying on arbitrary scripts, now used primarily for multi-sig transactions)
  • multisig-m-of-n (not present in blockchain, but used by coinazer to construct P2SH multisig transactions; see Multisig Transactions for more info)
  • null-data (sometimes called op-return; used to embed small chunks of data in the blockchain)
  • mpty (no script present, mostly used for mining transaction inputs)
  • unknown (non-standard script)
  • Due to safety checks within the API's transaction creation process, the user-set value field of an output may never be 0, except when using a null-data script-type, where it must be 0.

    Push Raw Transaction Endpoint

    If you'd prefer to use your own transaction library instead of the recommended path of our two-endpoint transaction generation we're still happy to help you propagate your raw transactions. Simply send your raw hex-encoded transaction to this endpoint and we'll leverage our huge network of nodes to propagate your transaction faster than anywhere else.

    resource method return object request object
    /txs/push POST {"tx":$TXHEX} TX

    $TXHEX is a hex-encoded raw representation of your transaction, for example:

    If it succeeds, you'll receive a decoded TX object and an HTTP Status Code 201. If you'd like, you can use the decoded transaction hash alongside an Event to track its progress in the network.

              
      var pushtx = {
        tx: "01000000011935b41d12936df99d322ac8972b74ecff7b79408bbccaf1b2eb8015228beac8000000006b483045022100921fc36b911094280f07d8504a80fbab9b823a25f102e2bc69b14bcd369dfc7902200d07067d47f040e724b556e5bc3061af132d5a47bd96e901429d53c41e0f8cca012102152e2bb5b273561ece7bbe8b1df51a4c44f5ab0bc940c105045e2cc77e618044ffffffff0240420f00000000001976a9145fb1af31edd2aa5a2bbaa24f6043d6ec31f7e63288ac20da3c00000000001976a914efec6de6c253e657a9d5506a78ee48d89762fb3188ac00000000"
      };
      $.post('https://api.coinazer.com/v1/bcy/test/txs/push', JSON.stringify(pushtx))
        .then(function(d) {console.log(d)});
         {
           "block_height": -1,
           "hash": "4e6dfb1415b4fba5bd257c129847c70fbd4e45e41828079c4a282680528f3a50",
           "addresses": [
             "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9",
             "C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn"
           ],
           "total": 4988000,
           "fees": 12000,
           "size": 226,
           "vsize": 226,
           "preference": "high",
           "relayed_by": "73.162.198.68",
           "received": "2015-05-22T05:10:00.305308666Z",
           "ver": 1,
           "lock_time": 0,
           "double_spend": false,
           "vin_sz": 1,
           "vout_sz": 2,
           "confirmations": 0,
           "inputs": [
             {
               "prev_hash": "c8ea8b221580ebb2f1cabc8b40797bffec742b97c82a329df96d93121db43519",
               "output_index": 0,
               "script": "483045022100921fc36b911094280f07d8504a80fbab9b823a25f102e2bc69b14bcd369dfc7902200d07067d47f040e724b556e5bc3061af132d5a47bd96e901429d53c41e0f8cca012102152e2bb5b273561ece7bbe8b1df51a4c44f5ab0bc940c105045e2cc77e618044",
               "output_value": 5000000,
               "sequence": 4294967295,
               "addresses": [
                 "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9"
               ],
               "script_type": "pay-to-pubkey-hash",
               "age": 576
             }
           ],
           "outputs": [
             {
               "value": 1000000,
               "script": "76a9145fb1af31edd2aa5a2bbaa24f6043d6ec31f7e63288ac",
               "addresses": [
                 "C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn"
               ],
               "script_type": "pay-to-pubkey-hash"
             },
             {
               "value": 3988000,
               "script": "76a914efec6de6c253e657a9d5506a78ee48d89762fb3188ac",
               "addresses": [
                 "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9"
               ],
               "script_type": "pay-to-pubkey-hash"
             }
           ]
         }
              
            

    Decode Raw Transaction Endpoint

    We also offer the ability to decode raw transactions without sending propagating them to the network; perhaps you want to double-check another client library or confirm that another service is sending proper transactions.

    resource method return object request object
    /txs/decode POST {"tx":$TXHEX} TX

    $TXHEX is a hex-encoded raw representation of your transaction, for example:

    If it succeeds, you'll receive a decoded TX object and an HTTP Status Code 201. If you'd like, you can use the decoded transaction hash alongside an Event to track its progress in the network.

              
      var pushtx = {
        tx: "01000000011935b41d12936df99d322ac8972b74ecff7b79408bbccaf1b2eb8015228beac8000000006b483045022100921fc36b911094280f07d8504a80fbab9b823a25f102e2bc69b14bcd369dfc7902200d07067d47f040e724b556e5bc3061af132d5a47bd96e901429d53c41e0f8cca012102152e2bb5b273561ece7bbe8b1df51a4c44f5ab0bc940c105045e2cc77e618044ffffffff0240420f00000000001976a9145fb1af31edd2aa5a2bbaa24f6043d6ec31f7e63288ac20da3c00000000001976a914efec6de6c253e657a9d5506a78ee48d89762fb3188ac00000000"
      };
      $.post('https://api.coinazer.com/v1/bcy/test/txs/push', JSON.stringify(pushtx))
        .then(function(d) {console.log(d)});
         {
           "block_height": -1,
           "hash": "4e6dfb1415b4fba5bd257c129847c70fbd4e45e41828079c4a282680528f3a50",
           "addresses": [
             "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9",
             "C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn"
           ],
           "total": 4988000,
           "fees": 12000,
           "size": 226,
           "vsize": 226,
           "preference": "high",
           "relayed_by": "73.162.198.68",
           "received": "2015-05-22T05:10:00.305308666Z",
           "ver": 1,
           "lock_time": 0,
           "double_spend": false,
           "vin_sz": 1,
           "vout_sz": 2,
           "confirmations": 0,
           "inputs": [
             {
               "prev_hash": "c8ea8b221580ebb2f1cabc8b40797bffec742b97c82a329df96d93121db43519",
               "output_index": 0,
               "script": "483045022100921fc36b911094280f07d8504a80fbab9b823a25f102e2bc69b14bcd369dfc7902200d07067d47f040e724b556e5bc3061af132d5a47bd96e901429d53c41e0f8cca012102152e2bb5b273561ece7bbe8b1df51a4c44f5ab0bc940c105045e2cc77e618044",
               "output_value": 5000000,
               "sequence": 4294967295,
               "addresses": [
                 "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9"
               ],
               "script_type": "pay-to-pubkey-hash",
               "age": 576
             }
           ],
           "outputs": [
             {
               "value": 1000000,
               "script": "76a9145fb1af31edd2aa5a2bbaa24f6043d6ec31f7e63288ac",
               "addresses": [
                 "C1rGdt7QEPGiwPMFhNKNhHmyoWpa5X92pn"
               ],
               "script_type": "pay-to-pubkey-hash"
             },
             {
               "value": 3988000,
               "script": "76a914efec6de6c253e657a9d5506a78ee48d89762fb3188ac",
               "addresses": [
                 "CEztKBAYNoUEEaPYbkyFeXC5v8Jz9RoZH9"
               ],
               "script_type": "pay-to-pubkey-hash"
             }
           ]
         }
              
            

    Decode Transaction Witness To Sign Endpoint

    This endpoint allows you to decode the tosign_tx only in the case of the spending of a native segwit input (P2WPKH). This allows you to double check the which input you are spending and the value transfered.

    resource method request object return object
    /txs/decodeWitnessToSign POST {"witness_tosign_tx":$WITNESSTOSIGNTXHEX} WitnessToSignTx

    $TXHEX is a hex-encoded raw representation of your transaction, for example:

    If it succeeds, you'll receive a decoded TX object and an HTTP Status Code 201. If you'd like, you can use the decoded transaction hash alongside an Event to track its progress in the network.

              
    var decodewitnesstosigntx = {
      witness_tosign_tx: "01000000d0fe2d3feb5f3a5b6a99c244f21924b0249e2bc65c5745bdb618b1799066a80a3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e706650448b3658589c258fb4b44180f158ae73d4dbaaf26d64c43a97a5cd78d9577f786d010000001976a9141b80a938a784abe7cdee8fdaf95f5f7e0b8cd0b988ac40420f0000000000ffffffff5fa4537c4c565583f8d32a36c3510808d38acc0ad18cc7e637be6523ebb39ff30000000001000000"
    };
    $.post('https://api.coinazer.com/v1/bcy/test/txs/decodeWitnessToSign', JSON.stringify(decodewitnesstosigntx))
      .then(function(d) {console.log(d)});
       {
         "version": 1,
         "hash_prevouts": "0aa8669079b118b6bd45575cc62b9e24b02419f244c2996a5b3a5feb3f2dfed0",
         "hash_sequence": "445066705e799022b7095f7ceca255149f43acfc47e7f59e551f7bce2930b13b",
         "outpoint": "6d787f57d978cda5973ac4646df2aadbd473ae58f18041b4b48f259c5858368b",
         "outpoint_index": 1,
         "script_code": "76a9141b80a938a784abe7cdee8fdaf95f5f7e0b8cd0b988ac",
         "value": 1000000,
         "sequence": 4294967295,
         "hash_outputs": "f39fb3eb2365be37e6c78cd10acc8ad3080851c3362ad3f88355564c7c53a45f",
         "lock_time": 0,
         "sighash_type": 1
       }
              
            

    Multisig Transactions

    Multisignature transactions are made simple by the method described in the Creating Transactions section, but they deserve special mention. In order to use them, you first need to fund a multisignature address. You use the /txs/new endpoint as before, but instead of the outputs addresses array containing public addresses, it instead contains the public keys associated with the new address. In addition, you must select a script_type of mutlisig-n-of-m, where n and m are numbers (e.g., multisig-2-of-3). The code example demonstrates how the partially filled TX request object would appear.

    After you've set up your request object, you send to /txs/new and receive a partially filled TXSkeleton as before, but with data to sign from the source address. Sign this data and include the public key(s) of the source address---as demonstrated in the Creating Transactions---then send along to the /txs/send endpoint. If it returns with an HTTP Status Code 201, then your multisignature address (via a pay-to-script-hash address) is funded.

    If you only need a pay-to-script-hash address corresponding to N-of-M multisig and don't want---or need---to fund it immediately, you should use the comparatively easier Generate Multisig Address Endpoint.

              
     {
       "inputs": [{"addresses": [sourceAddr]}],
       "outputs": [{
         "addresses"   : [pubkey1, pubkey2, pubkey3],
         "script_type" : "multisig-2-of-3",
         "value"       : 250000
       }]
     }
              
            

    Transaction Propagation Endpoint

    By operating a well-connected node, we collect a lot of information about how transactions propagate; for example, our Confidence Factor relies on this connectivity. With this endpoint, you can leverage our connectivity to get an approximation of a transaction's location of origin.

    resource method return object
    /txs/$TXHASH/propagation GET Described Below

    TXHASH is a string representing the hex-encoded transaction hash you're interested in querying for propagation information. The return object is described below:

    attribute type description
    transaction string The hash of the transaction you queried.
    first_location object An object containing latitude and longitude floats representing the first location to broadcast this transaction to coinazer.
    first_city string Optional The name of the city closest to the first_location. If no nearby city can be found, this is not returned.
    first_country string The name of the country containing the first_location.
    aggregated_origin object AAn object containing latitude and longitude floats representing coinazer's best guess of likely origin of this transaction, based on the radius of the smallest circle containing the first peer from which we detect this transaction, the average of the first five peers, and the average of the first ten peers.
    aggregated_origin_radius integer The radius (in meters) of the smallest circle containing the first peer from which we detect this transaction, the average of the first five peers, and the average of the first ten peers. In a general sense, this represents an approximate confidence interval in our calculated aggregated_origin; the smaller the radius, the more confidence in our aggregated_origin assessment.
    first_received time The timestamp when coinazer first received this transaction.

    The returned object is an array of transactions that haven't been included in blocks, arranged in reverse chronological order (latest is first, then older transactions follow).

    Due to transaction malleability it can be difficult to deal with transaction hashes before they've been confirmed in blocks. Use caution, and consider applying our Confidence Factor to mitigate potential issues.

              
    $.get('https://api.coinazer.com/v1/btc/main/txs').then(function(d) {console.log(d)});
       [
         {
         "block_height": -1,
         "hash": "7f3af38d988e479f651520b13b85...",
         "addresses": [
           "19ZZonTmBD3VBhgFSWrtNis6Wo4aNRyjAV",
           "1GD2Gnt3Vk51FpUhZWrFpSa24KE2ZGPaWG",
           "1HEJiW8jxvUvVQ5cuButRmFj6ZzKzM9Fp6"
         ],
         "total": 46977000,
         "fees": 10000,
         "size": 225,
         "vsize": 225,
         "preference": "medium",
         "relayed_by": "54.209.56.58:8333",
         ...
         },
         {
         "block_height": -1,
         "hash": "7e2d8b4e95c8246e81f297539409...",
         "addresses": [
           "12u8EFJR6QJpNYbuQcYt2iMsAtPdnCFwQb",
           "1MUbYoqSadRSEipwcmKnH37NaKakDCmgwW"
         ],
         "total": 1070000,
         "fees": 10000,
         "size": 225,
         "vsize": 225,
         "preference": "medium",
         "relayed_by": "52.1.229.213:8333",
         "received": "2015-05-21T05:44:13.878Z",
         ...
         },
       ...
       ]
              
            

    Metadata API

    Cryptocurrency addresses, transactions, and blocks are extremely powerful, but the labels they employ can be...cryptic. That's why we have a Metadata API, allowing both public and private key-value storage against addresses, transactions, and blocks.

    Private vs Public Metadata

    The Metadata API supports both public and private key-value storage. In both cases, setting metadata requires use of a token (if you haven't already, you can register for one here). Public metadata is immutable; once set, it cannot be modified or deleted. If you accidentally set public metadata and need it deleted, contact us. Also, as implied by the name, it's openly accessible to the whole world---regardless of whether they have a token or not. Consequently, private metadata is associated and only accessible with your user token. The methods for interacting with metadata are outlined below.

    Get Metadata Endpoint

    resource method return object
    /addrs/$ADDRESS/meta GET {"$KEY":"$VALUE",...}
    /txs/$TXHASH/meta GET {"$KEY":"$VALUE",...}
    /blocks/$BLOCKHASH/meta GET {"$KEY":"$VALUE",...}
    private
    flag type effect
    bool If private is true, it will return privately stored metadata under your token. Otherwise, returns public metadata. If not set, it defaults to false, returning public data.

    This endpoint retrieves metadata associated with a given $ADDRESS, $TXHASH, or $BLOCKHASH.

    Remember to set the private flag if you're querying private metadata underneath your token.

              
                //todo: JS examples
              
            

    Put Metadata Endpoint

    resource method request object return object
    /addrs/$ADDRESS/meta GET {"$KEY":"$VALUE",...} nil
    /txs/$TXHASH/meta GET {"$KEY":"$VALUE",...} { nil /td>
    /blocks/$BLOCKHASH/meta GET {"$KEY":"$VALUE",...} { nil /td>
    flag type effect
    private bool If private is true, it will return privately stored metadata under your token. Otherwise, returns public metadata. If not set, it defaults to false, returning public data.

    This endpoint sets or updates metadata (of the form {"$KEY1:$VALUE1,$KEY2:$VALUE2,...}") associated with a given $ADDRESS, $TXHASH, or $BLOCKHASH. If another key with the same name already exists under your private metadata store, supplying a new value will replace it. New key-value pairs will be added without replacing prexisting key-value pairs. If successful, it will return an HTTP Status Code 204 with no return object.

    If you set public metadata, you cannot modify or delete it. It's set there forever, and viewable to the world. If you accidentally set public metadata and need it deleted, contact us .

              
                //todo: JS examples
              
            

    delete Metadata Endpoint

    resource method return object
    /addrs/$ADDRESS/meta DELETE nil
    /txs/$TXHASH/meta DELETE { nil /td>
    /blocks/$BLOCKHASH/meta DELETE { nil /td>
    This endpoint deletes all private metadata associated with a given $ADDRESS, $TXHASH, or $BLOCKHASH and your token.

    If you set public metadata, you cannot modify or delete it. It's set there forever, and viewable to the world. If you accidentally set public metadata and need it deleted, contact us .

              
                //todo: JS examples
              
            

    Address Forwarding

    One of the well-known benefits of cryptocurrency is the ability to allow users to partake in online commerce without necessarily requiring extensive setup barriers, like registering new accounts. In that spirit, our Address Forwarding API is the easiest way to accept---and consolidate---payments securely without forcing your users to create accounts and jump through unnecessary loops. It's also a generic way to automatically transfer value from one address to another. While there are many possible use cases, the two we hear most about are:

  • A way to generate payment-specific addresses for which funds will automatically transfer to a main merchant address. Great for automatic merchandise (whether physical or virtual) processing.
  • A method to easily fund a multisignature address from any wallet by providing a classic address that will automatically transfer to the multisignature/pay-to-script-hash address.
  • We do not take a fee on address forwarding, other than the required miner fee which depends on network conditions; forwards are free. However, as part of your own services, you can include a fee (either fixed or a percentage) that will also be automatically transfered to your own address in the same transaction. Fee-based business models are thus easily achieved, and moreover, easily auditable via the blockchain.

    Address forwarding is only available for paid plans with an active token, you can't create a address forwarding request without one. You can register for a token and pay for a plan here.

    Note that mining fees are deducted from any user-set processing fees . This can often lead to lower processing fees than expected.

    By default, all forwards will be debited with a mining fee that depends on current network fee levels. The amount of the fee is configurable, and if a processing fee is set, it will be deducted from that fee. But for very small forwards, if the amount sent is even lower than the mining and user-set processing fees (or if the processing fees cannot cover the mining fee), the forward will fail.

    Create Forward Endpoint

    First, to create an address forwarding address, you need to POST a partially filled AddressForward object to the payment creation endpoint. You need to include at least a destination address and your token; optionally, you can add a callback_url, processing fees (either percent or fixed) and a process_fee_address, and a few other options. You can see more details about these options in the AddressForward object details.

    resource method request object return object
    /forwards POST AddressForward AddressForward

    In return, you'll get a more complete AddressForward object, including an input_address and id.

    If you decide to have a callback_url, you'll receive a payload at that url whenever a payment is made to the input_address. The payload will come in the form of a AddressForwardCallback object.

              
      var payment = {
        "destination":"15qx9ug952GWGTNn7Uiv6vode4RcGrRemh",
        "callback_url": "https://my.domain.com/callbacks/new-pay"
      }
      var url = 'https://api.coinazer.com/v1/btc/main/forwards?token='+TOKEN;
      $.post(url, JSON.stringify(payment))
        .then(function(d) {console.log(d)});
      {
      "input_address": "16uKw7GsQSzfMaVTcT7tpFQkd7Rh9qcXWX",
      "destination": "15qx9ug952GWGTNn7Uiv6vode4RcGrRemh",
      "callback_url": "https://my.domain.com/callbacks/forwards",
      "id": "399d0923-e920-48ee-8928-2051cbfbc369",
      "token": "YOURTOKEN"
      }
              
            

    List Payments Endpoint

    To list your currently active address forwarding addresses, you can use this endpoint.

    resource method return object
    /forwards GET Array[AddressForward]
    flag type effect
    start integer Returns list of address forwards starting at the start index; useful for paging beyond the limit of 200 address forwards.

    This returns the full array of your currently active address forwarding addresses, based on your token. By default, this endpoint only returns the first 200 address forwards. If you have more, you can page through them using the optional start parameter.

            
     $.get('https://api.coinazer.com/v1/btc/main/forwards?token='+TOKEN)
     .then(function(d) {console.log(d)});
    [
       {
       "input_address": "16uKw7GsQSzfMaVTcT7tpFQkd7Rh9qcXWX",
       "destination": "15qx9ug952GWGTNn7Uiv6vode4RcGrRemh",
       "callback_url": "https://my.domain.com/callbacks/forwards",
       "id": "399d0923-e920-48ee-8928-2051cbfbc369",
       "token": "YOURTOKEN"
       }
    ]
            
          

    Delete Payment Endpoint

    When you're done with an address forwarding address, you can delete it via its id.

    resource method return object
    /forwards/$PAYID DELETE nil

    PAYID is a string representing the address forwarding request you want to delete, for example:

    399d0923-e920-48ee-8928-2051cbfbc369

    This will return no object, but will return an HTTP Status Code 204 if the request was successfully deleted.

            
      var url = "https://api.coinazer.com/v1/btc/main/forwards/399d0923-e920-48ee-8928-2051cbfbc369?token="+TOKEN
      $.ajax({
        url: url,
        method: "DELETE"
      });