NAV Navbar
shell php javascript
  • Introduction
  • Objects
  • Address API
  • Token API
  • Transaction API
  • Order API
  • Market/Fees API
  • System Status API
  • WebSocket and Webhook
  • Introduction SDKs
  • Javascript SDK v1
  • Unity SDK v1
  • Introduction

    API Endpoint
    
    https://api.indiesquare.me/v2/
    
    API Endpoint
    
    https://api.indiesquare.me/v2/
    
    *** We use guzzlehttp library in examples ***
    
    ・composer.json
    
    "require": {
        "guzzlehttp/guzzle": "6.*"
    }
    
    ・index.php
    
    <?php
    
    require 'vendor/autoload.php';
    $client = new GuzzleHttp\Client();
    
    echo $client->get('https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/balances')->getBody();
    
    API Endpoint
    
    https://api.indiesquare.me/v2/
    
    CDN Links
    https://cdn.indiesquare.me/v1/indiesquare.js
    https://cdn.indiesquare.me/v1/indiesquare.min.js
    

    IndieSquare API provides digital token management features. It makes it easy to create your own token on the blockchain or integrate digital token into your applications. Currently, IndieSquare API supports Counterparty as a blockchain platform.

    About the Javascript SDK: see here
    About the Unity SDK: see here

    Schema

    All API access is over HTTPS, and accessed from the https://api.indiesquare.me url. All data is sent and received as JSON.

    Timezones

    All timestamps are returned in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ e.g. 2014-02-27T15:05:06+01:00

    API Key

    Everyone can use IndieSquare API without an API Key however requests may be limited. IndieSquare API will return HTTP 429 response if you exceed the limitation. You can create an API Key on Indieboard.

    GET API Key

    HTTP status code 401 will be returned if the provided API Key is not a valid.

    Request with API Key
    
    curl -H 'X-Api-Key:abcd0efg12hi3j4klm5n678opqrstu9vwxyz' https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/balances
    
    Request with API Key
    
    $client->request('GET', 'https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/balances', [
        'headers' => [
            'X-Api-Key' => 'abcd0efg12hi3j4klm5n678opqrstu9vwxyz'
        ]
    ]);
    

    Objects

    IndieSquare’s API returns these objects below.

    Balance

    Balance Object represents a public address on the blockchain and their balances.

    Attribute Type Description
    token String The token name
    balance Numeric The balance
    unconfirmed_balance double The unconfirmed balance

    Token

    Token Object represents a token's information.

    Attribute Type Description
    token String The token name
    description String The description
    token_image_url String The token image url
    quantity Numeric The total issued quantity
    issuer String The issuer's public address
    divisible Numeric The divisibility of the balance (0 = non-divisible, 1 = divisible)
    locked Numeric Whether the token is locked (0 = unlocked, 1 = locked)
    holder_count Numeric Number of people holding this token
    confirmed Boolean Whether the token is already confirmed. (true = confirmed, false = unconfirmed)

    Token Holder

    Token Holder Object represents token holder information.

    Attribute Type Description
    name String The token holder name
    address String The bitcoin address
    quantity Numeric The holding quantity
    ratio Numeric The holding ratio

    UTXO

    UTXO Object represents the utxos of a public address

    Attribute Type Description
    address String The bitcoin address
    txid String The transaction id
    vout Numeric The index of the output
    script_pub_key String The public key of the script
    amount Numeric The amount of the transaction
    confirmations Numeric The confirmation number
    time Numeric The timestamp of the transaction

    History

    History Object represents the history of a public address

    Attribute Type Description
    type String The type of the transaction
    token String The name of token
    quantity Numeric The quantity of the transaction
    source String The source public address of the transaction
    destination String The destination public address of the transaction
    category String The category of the transaction
    time String The timestamp of the transaction
    block_time Numeric The unix timestamp of the transaction
    tx_index Numeric The Transaction Index

    History Type

    Type Description
    send Send token
    issuance Issuance token
    order Dex order
    dividend Dividend token

    History Category

    Type Description
    send Send token
    receive Receive token

    Order

    Order Object represents the order transaction

    Attribute Type Description
    source String The bitcoin address
    give_token String The token name to give
    get_token String The token name requested in return
    give_quantity Numeric The quantities of the token to give
    get_quantity Numeric The quantities of the token requested in return
    order_amount Numeric
    price Numeric

    Order History

    Order History Object represents the order history of a public address

    Attribute Type Description
    type String The type of the order (buy or sell)
    give_token String The token name to give
    get_token String The token name requested in return
    give_quantity Numeric The quantities of the token to give
    get_quantity Numeric The quantities of the token requested in return
    order_amount Numeric
    price Numeric
    tx_index Numeric The transaction index of the transaction
    tx_hash String The hash of the the order transaction
    block_index Numeric The block height of the transaction
    status String The status of the transaction
    block_time Numeric The unix timestamp of the transaction
    time String The time of the transaction

    Address API

    IndieSquare’s Address API allows you to look up information on a particular token about public addresses on the blockchain.

    Balance

    curl https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/balances
    
    echo $client->get('https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/balances')->getBody();
    
    [
       {
          "token":"BTC",
          "balance":0.0004203,
          "unconfirmed_balance":0
       },
       {
          "token":"XCP",
          "balance":0,
          "unconfirmed_balance":0
       }
    ]
    

    The Address Balance Endpoint is a method to get a subset of information on a public address.

    Resource Method Return Object
    /addresses/:address/balances GET Array[Balance]

    Issued Token

    curl https://api.indiesquare.me/v2/addresses/1965areciqapsuL2hsia2yKkRLfAsH1smG/issuances
    
    echo $client->get('https://api.indiesquare.me/v2/addresses/1965areciqapsuL2hsia2yKkRLfAsH1smG/issuances')->getBody();
    
    [
      {
        "quantity": 1000,
        "token": "YOKAN",
        "description": "res.indiesquare.me/json/YOKAN.json",
        "token_image_url": "https://api.indiesquare.me/v2/tokens/YOKAN/image",
        "issuer": "1965areciqapsuL2hsia2yKkRLfAsH1smG",
        "divisible": 1,
        "locked": 0,
        "holder_count": 0,
        "confirmed": true
      },
      {
        "quantity": 2000,
        "token": "DORAYAKI",
        "description": "res.indiesquare.me/json/DORAYAKI.json",
        "token_image_url": "https://api.indiesquare.me/v2/tokens/DORAYAKI/image",
        "issuer": "1965areciqapsuL2hsia2yKkRLfAsH1smG",
        "divisible": 1,
        "locked": 0,
        "holder_count": 1,
        "confirmed": true
      },
      {
        "quantity": 0,
        "token": "ZONO",
        "description": "res.indiesquare.me/json/ZONO.json",
        "token_image_url": "https://api.indiesquare.me/v2/tokens/ZONO/image",
        "issuer": "1965areciqapsuL2hsia2yKkRLfAsH1smG",
        "divisible": 1,
        "locked": 0,
        "holder_count": 9,
        "confirmed": true
      },
      {
        "quantity": 1000,
        "token": "KARUKAN",
        "description": "res.indiesquare.me/json/KARUKAN.json",
        "token_image_url": "https://api.indiesquare.me/v2/tokens/KARUKAN/image",
        "issuer": "1965areciqapsuL2hsia2yKkRLfAsH1smG",
        "divisible": 1,
        "locked": 0,
        "holder_count": 0,
        "confirmed": true
      }
    ]
    

    The Issued Token Endpoint Endpoint is a method to get issued token information.

    Resource Method Return Object
    /addresses/:address/issuances GET Array[Token]

    UTXO

    curl https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/utxos
    
    echo $client->get('https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/utxos')->getBody();
    
    [
       {
          "address":"17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW",
          "txid":"56af33a1bc4b9fd4b06547bcc8300cacd6ba17b5f741df15ee3e35ad77f6a83d",
          "vout":0,
          "script_pub_key":"76a9144479f825a8038e88d756acbafa6c0c079a79052288ac",
          "amount":0.0002131,
          "confirmations":12198,
          "time":1462241727
       },
       {
          "address":"17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW",
          "txid":"deeaafaa9987839fc734760ae05c82929d51847906878dc09811b4cfbb21626c",
          "vout":0,
          "script_pub_key":"76a9144479f825a8038e88d756acbafa6c0c079a79052288ac",
          "amount":0.0002072,
          "confirmations":12792,
          "time":1461910714
       }
    ]
    

    The Address UTXO Endpoint is a method to get utxos on a public address.

    Resource Method Return Object
    /addresses/:address/utxos GET Array[UTXO]

    History

    curl https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/history
    
    echo $client->get('https://api.indiesquare.me/v2/addresses/17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW/history')->getBody();
    
    [
      {
        "type": "send",
        "quantity": "0.0002131",
        "tx_index": 9999999999,
        "source": "159SrNLB6JmQC6HTXpEZ7rDVQ12idajhrf",
        "destination": "17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW",
        "block_time": 1462241727,
        "category": "Receive",
        "time": "2016-05-03T02:15:27+0000",
        "token": "BTC"
      },
      {
        "type": "send",
        "quantity": "0.0002072",
        "tx_index": 10000000000,
        "source": "159SrNLB6JmQC6HTXpEZ7rDVQ12idajhrf",
        "destination": "17F54d4S9aLpvUEsk7MkYWafmzxJhhb9wW",
        "block_time": 1461910714,
        "category": "Receive",
        "time": "2016-04-29T06:18:34+0000",
        "token": "BTC"
      }
    ]
    

    The History Endpoint is a method to get history of the public address.

    Resource Method Return Object
    /addresses/:address/history GET Array[History]

    Order History

    curl https://api.indiesquare.me/v2/addresses/1H1T5mwiyhbXa9Xn3NVr99fLJSLw5csiwA/orderhistory
    
    echo $client->get('https://api.indiesquare.me/v2/addresses/1H1T5mwiyhbXa9Xn3NVr99fLJSLw5csiwA/orderhistory')->getBody();
    
    [
       {
          "type":"buy",
          "give_token":"XCP",
          "get_token":"ZAIF",
          "give_quantity":25,
          "get_quantity":10000,
          "order_amount":10000,
          "price":0.0025,
          "tx_index":516681,
          "tx_hash":"955fce552ca16c401de15ebeb336449b7231c43693a082b05605806978dbfa63",
          "block_index":422162,
          "status":"open",
          "block_time":1469416918,
          "time":"2016-07-25T03:21:58+0000"
       },
       {
          "type":"sell",
          "give_token":"XCP",
          "get_token":"ZAIF",
          "give_quantity":25,
          "get_quantity":10000,
          "order_amount":25,
          "price":400,
          "tx_index":516681,
          "tx_hash":"955fce552ca16c401de15ebeb336449b7231c43693a082b05605806978dbfa63",
          "block_index":422162,
          "status":"open",
          "block_time":1469416918,
          "time":"2016-07-25T03:21:58+0000"
       }
    ]
    

    The Order History Endpoint is a method to get order history of the public address.

    Resource Method Return Object
    /addresses/:address/orderhistory GET Array[Order History]

    Token API

    IndieSquare’s Token API allows you to look up information about token information.

    curl https://api.indiesquare.me/v2/tokens?name=CNP
    
    echo $client->get('https://api.indiesquare.me/v2/tokens?name=CNP')->getBody();
    
    [
      {
        "token": "CNPCARD",
        "token_image_url": "https://api.indiesquare.me/v2/tokens/CNPCARD/image"
      },
      {
        "token": "CNPCOIN",
        "token_image_url": "https://api.indiesquare.me/v2/tokens/CNPCOIN/image"
      }
    ]
    

    The Token Search Endpoint is a method to search token by name.

    Resource Method Return Object
    /tokens GET Array[Token]
    Parameter Type Description
    name String The name of the token.

    Token

    curl https://api.indiesquare.me/v2/tokens/CNPCOIN
    
    echo $client->get('https://api.indiesquare.me/v2/tokens/CNPCOIN')->getBody();
    
    {
      "token": "CNPCOIN",
      "description": "Currency for Coin and Peace blog ",
      "divisible": 1,
      "issuer": "1Na5Z6ZsKrD6TyhGZNRxsK75caiWqpwTCK",
      "quantity": 21000000,
      "locked": 0,
      "token_image_url": "https://api.indiesquare.me/v2/tokens/CNPCOIN/image"
    }
    

    Token Endpoint is a method to look up the detailed information of a particular token.

    Resource Method Return Object
    /tokens/:token GET Token

    Token Image

    https://api.indiesquare.me/v2/tokens/SARUTOBICARD/image
    
    $client->get('https://api.indiesquare.me/v2/tokens/SARUTOBICARD/image')
    

    Token Image Endpoint is a method to get a token image.

    Resource Method Return Object
    /tokens/:token/image GET Image Data
    Parameter Type Description
    width Numeric The width of the image (1〜1024)
    height Numeric The height of the image (1〜1024)

    Example (SARUTOBICARD)

    https://api.indiesquare.me/v2/tokens/SARUTOBICARD/image

    https://api.indiesquare.me/v2/tokens/SARUTOBICARD/image?width=100

    The height will be a calculated value that maintains the aspect ratio.

    https://api.indiesquare.me/v2/tokens/SARUTOBICARD/image?width=50&height=50

    The width and height of the returned image are exactly the params (width and height). Aspect ratio will not be maintained.

    Token Holders

    curl https://api.indiesquare.me/v2/tokens/KAMON/holders
    
    echo $client->get('https://api.indiesquare.me/v2/tokens/KAMON/holders')->getBody();
    
    [
       {
          "name":"cameong",
          "address":"13GMnzsri7mkNoZraR9NSFAZ8v4P6pRTc4",
          "quantity":999972180,
          "ratio":0.99997218
       },
       {
          "name":"Yuta Hoshino",
          "address":"1FVQopV1jYpTFAfD5RnJkftcbpQxQ7Bbo",
          "quantity":11500.4,
          "ratio":1.15004e-5
       },
       {
          "name":"-",
          "address":"1AVDJcAwKTfoYSLc93H7crbd9WE8CFmfob",
          "quantity":1017.5,
          "ratio":1.0175e-6
       }
    ]
    

    Token Holder Endpoint is a method to show token holder information of a particular token.

    Resource Method Return Object
    /tokens/:token/holders GET [Token Holder]

    Transaction API

    IndieSquare’s Transaction API allows you to create transactions and broadcast transactions.

    Create Send Transaction

    curl -H "Content-Type: application/json" -X POST -d '{"source": "1965areciqapsuL2hsia2yKkRLfAsH1smG", "token": "NETX", "destination": "12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD", "quantity": 1}' https://api.indiesquare.me/v2/transactions/send
    
    echo $client->request('POST', 'https://api.indiesquare.me/v2/transactions/send', [
        'json' => ['source' => '1965areciqapsuL2hsia2yKkRLfAsH1smG', 'destination' => '12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD', 'token' => 'NETX', 'quantity' => 1]
    ])->getBody();
    
    {
       "unsigned_tx":"010000000414ae2264cdbe754b9ae4be18d84bfeb4f578af553b9b9e4f9cb2303d04ee9e45000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffffec15d27b74516fefd921cecbe043ea63124d28a3903aef8fb1682ccc926b1c62000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffff9878f76e1424c1d1eeb6b15d06902dd8f0c78f9bdb61263e4ca3ae68c571a292000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acfffffffffdac7f1c83b01a8924a8965d356b804c2608bc261fc18041116ddb4a143bc499000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffff0336150000000000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88ac00000000000000001e6a1c246698efc5d81b78ceadf3179316b5eb6cc5c2c347c0b7b42121a94e92180000000000001976a91458b6e991b45487df810f4d96d5315da739637f1788ac00000000"
    }
    

    Create Send Transaction Endpoint is a method to create a send transaction and return the unsigned_tx.

    Resource Method Return Object
    /transactions/send POST {unsigned_tx}
    Parameter Type Description
    source String The address that will be sending
    destination String The address to receive the asset
    token String The token name
    quantity Numeric The quantities of the asset to send
    fee Numeric The specific custom miners’ fee (in satoshi, optional)
    fee_per_kb Numeric The fee per kilobyte of transaction data (in satoshi, optional)

    Create Issuance Transaction

    curl -H "Content-Type: application/json" -X POST -d '{"source": "12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD", "quantity": 1000, "token": "NETX", "divisible": true}' https://api.indiesquare.me/v2/transactions/issuance
    
    echo $client->request('POST', 'https://api.indiesquare.me/v2/transactions/issuance', [
        'json' => ['source' => '12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD', 'quantity' => 1000, 'token' => 'NETX', 'divisible' => true]
    ])->getBody();
    
    {
       "unsigned_tx":"0100000003cf04cdee0414cdd88008f3b6d690fc2ac0d6b18a99e693ea3b466a1d0c3c1139010000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88acffffffffb542474ee36c7019a7117862425c0cb34cb92fe175312a0517a6a0a363c38d54020000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88acffffffff1381cc7606abcaa79c187a41c576618fdc7d6fb97b86b75974f008924199e3c2020000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88acffffffff0200000000000000004b6a4999535ee47f76e6f29ebaf0c4645b1c81f4caa606afd34af989476a9f2324ad799c4a32dfd4bf08d8309225f4e0335c8b5c75a408ab9db67b62bf48c9f5f1c8f91b2775c20e48d8465b54290000000000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88ac00000000"
    }
    

    Create Issuance Transaction Endpoint is a method to create an issuance token transaction and return the unsigned_tx.

    Resource Method Return Object
    /transactions/issuance POST {unsigned_tx}
    Parameter Type Description
    source String The address that will be issuer
    token String The token name
    quantity Numeric The quantities of the asset to issue
    divisible Boolean true = divisible, false = indivisible
    description String The description of the asset to issue (optional)
    fee Numeric The specific custom miners’ fee (in satoshi, optional)
    fee_per_kb Numeric The fee per kilobyte of transaction data (in satoshi, optional)

    Create Order Transaction

    curl -H "Content-Type: application/json" -X POST -d '{"source": "12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD", "give_quantity": 10, "give_token": "NETX", "get_quantity": 1, "get_token": "XCP", "expiration": 100}' https://api.indiesquare.me/v2/transactions/order
    
    echo $client->request('POST', 'https://api.indiesquare.me/v2/transactions/order', [
        'json' => ['source' => '12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD', 'give_quantity' => 10, 'give_token' => 'NETX', 'get_quantity' => 1, 'get_token' => 'XCP', 'expiration' => 100]
    ])->getBody();
    
    {
       "unsigned_tx":"0100000003cf04cdee0414cdd88008f3b6d690fc2ac0d6b18a99e693ea3b466a1d0c3c1139010000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88acffffffffb542474ee36c7019a7117862425c0cb34cb92fe175312a0517a6a0a363c38d54020000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88acffffffff1381cc7606abcaa79c187a41c576618fdc7d6fb97b86b75974f008924199e3c2020000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88acffffffff0200000000000000004b6a4999535ee47f76e6f29ebaf0c4645b1c81f4caa606afd34af989476a9f2324ad799c4a32dfd4bf08d8309225f4e0335c8b5c75a408ab9db67b62bf48c9f5f1c8f91b2775c20e48d8465b54290000000000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88ac00000000"
    }
    

    Create Order Transaction Endpoint is a method to create a DEX order and return the unsigned_tx.

    Resource Method Return Object
    /transactions/order POST {unsigned_tx}
    Parameter Type Description
    source String The address that will be issuing the order request
    give_quantity Numeric The quantities of the asset to give
    give_token String The assets to give
    get_quantity Numeric The quantities of the asset requested in return
    get_token String The assets requested in return
    expiration Numeric The number of blocks for which the order should be valid
    fee Numeric The specific custom miners’ fee (in satoshi, optional)
    fee_per_kb Numeric The fee per kilobyte of transaction data (in satoshi, optional)

    Create Cancel Transaction

    curl -H "Content-Type: application/json" -X POST -d '{"source": "1MZUJyKLHsSthHY3z68NxLFPhnrDcsPaDk", "offer_hash": "ea8f9eeb36ed8c3001f4c572796d450514b19f108e3d3f35d8631004c5871fbf"}' https://api.indiesquare.me/v2/transactions/cancel
    
    echo $client->request('POST', 'https://api.indiesquare.me/v2/transactions/cancel', [
        'json' => ['source' => '1MZUJyKLHsSthHY3z68NxLFPhnrDcsPaDk', 'offer_hash' => 'ea8f9eeb36ed8c3001f4c572796d450514b19f108e3d3f35d8631004c5871fbf']
    ])->getBody();
    
    {
       "unsigned_tx":"0100000001bf1f87c5041063d8353f3d8e109fb11405456d7972c5f401308ced36eb9e8fea010000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488acffffffff0200000000000000002e6a2c0b0b8cb664864cdf2ff70668595e63567b9d8ece36b2383513b6eeab7f1c15e70466593f13bb49618b8afe7079e93a00000000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488ac00000000"
    }
    

    Create Order Cancel Transaction Endpoint is a method to create a DEX order cancel transaction and return the unsigned_tx.

    Resource Method Return Object
    /transactions/cancel POST {unsigned_tx}
    Parameter Type Description
    source String The address that will be issuing the order request
    offer_hash String The transaction hash of the order
    fee Numeric The specific custom miners’ fee (in satoshi, optional)
    fee_per_kb Numeric The fee per kilobyte of transaction data (in satoshi, optional)

    Broadcast Transaction

    curl -H "Content-Type: application/json" -X POST -d '{"tx": "0100000001bf1f87c5041063d8353f3d8e109fb11405456d7972c5f401308ced36eb9e8fea010000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488acffffffff0200000000000000002e6a2c0b0b8cb664864cdf2ff70668595e63567b9d8ece36b2383513b6eeab7f1c15e70466593f13bb49618b8afe7079e93a00000000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488ac00000000"}' https://api.indiesquare.me/v2/transactions/broadcast
    
    echo $client->request('POST', 'https://api.indiesquare.me/v2/transactions/broadcast', [
        'json' => ['tx' => '0100000001bf1f87c5041063d8353f3d8e109fb11405456d7972c5f401308ced36eb9e8fea010000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488acffffffff0200000000000000002e6a2c0b0b8cb664864cdf2ff70668595e63567b9d8ece36b2383513b6eeab7f1c15e70466593f13bb49618b8afe7079e93a00000000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488ac00000000']
    ])->getBody();
    
    {
       "txid":"0100000001bf1f87c5041063"
    }
    

    Broadcast Transaction Endpoint is a method to broadcast the signed transaction and return the txid.

    Resource Method Return Object
    /transactions/broadcast POST {txid}
    Parameter Type Description
    tx String The signed transaction

    Decode Transaction

    curl -H "Content-Type: application/json" -X POST -d '{"tx": "010000000414ae2264cdbe754b9ae4be18d84bfeb4f578af553b9b9e4f9cb2303d04ee9e45000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffffec15d27b74516fefd921cecbe043ea63124d28a3903aef8fb1682ccc926b1c62000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffff9878f76e1424c1d1eeb6b15d06902dd8f0c78f9bdb61263e4ca3ae68c571a292000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acfffffffffdac7f1c83b01a8924a8965d356b804c2608bc261fc18041116ddb4a143bc499000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffff0336150000000000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88ac00000000000000001e6a1c246698efc5d81b78ceadf3179316b5eb6cc5c2c347c0b7b42121a94e92180000000000001976a91458b6e991b45487df810f4d96d5315da739637f1788ac00000000"}' https://api.indiesquare.me/v2/transactions/decode
    
    echo $client->request('POST', 'https://api.indiesquare.me/v2/transactions/decode', [
        'json' => ['tx' => '010000000414ae2264cdbe754b9ae4be18d84bfeb4f578af553b9b9e4f9cb2303d04ee9e45000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffffec15d27b74516fefd921cecbe043ea63124d28a3903aef8fb1682ccc926b1c62000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffff9878f76e1424c1d1eeb6b15d06902dd8f0c78f9bdb61263e4ca3ae68c571a292000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acfffffffffdac7f1c83b01a8924a8965d356b804c2608bc261fc18041116ddb4a143bc499000000001976a91458b6e991b45487df810f4d96d5315da739637f1788acffffffff0336150000000000001976a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88ac00000000000000001e6a1c246698efc5d81b78ceadf3179316b5eb6cc5c2c347c0b7b42121a94e92180000000000001976a91458b6e991b45487df810f4d96d5315da739637f1788ac00000000']
    ])->getBody();
    
    {
       "txid":"6c521937d8fa889d71609ebed2e23b694cbca89778c8b8d967167e5a4c9d5b78",
       "version":1,
       "locktime":0,
       "vin":[
          {
             "txid":"459eee043d30b29c4f9e9b3b55af78f5b4fe4bd818bee49a4b75becd6422ae14",
             "vout":0,
             "scriptSig":{
                "asm":"OP_DUP OP_HASH160 58b6e991b45487df810f4d96d5315da739637f17 OP_EQUALVERIFY OP_CHECKSIG",
                "hex":"76a91458b6e991b45487df810f4d96d5315da739637f1788ac"
             },
             "sequence":4294967295
          }
       ],
       "vout":[
          {
             "value":5.43e-5,
             "n":0,
             "scriptPubKey":{
                "asm":"OP_DUP OP_HASH160 1485d9d03b41aaa9dca7d70d7f63ff4a0826100e OP_EQUALVERIFY OP_CHECKSIG",
                "hex":"76a9141485d9d03b41aaa9dca7d70d7f63ff4a0826100e88ac",
                "reqSigs":1,
                "type":"pubkeyhash",
                "addresses":[
                   "12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD"
                ]
             }
          },
          {
             "value":0,
             "n":1,
             "scriptPubKey":{
                "asm":"OP_RETURN 246698efc5d81b78ceadf3179316b5eb6cc5c2c347c0b7b42121a94e",
                "hex":"6a1c246698efc5d81b78ceadf3179316b5eb6cc5c2c347c0b7b42121a94e",
                "type":"nulldata"
             }
          },
          {
             "value":6.29e-5,
             "n":2,
             "scriptPubKey":{
                "asm":"OP_DUP OP_HASH160 58b6e991b45487df810f4d96d5315da739637f17 OP_EQUALVERIFY OP_CHECKSIG",
                "hex":"76a91458b6e991b45487df810f4d96d5315da739637f1788ac",
                "reqSigs":1,
                "type":"pubkeyhash",
                "addresses":[
                   "1965areciqapsuL2hsia2yKkRLfAsH1smG"
                ]
             }
          }
       ]
    }
    

    Decode Transaction Endpoint is a method to decode the hex.

    Resource Method Return Object
    /transactions/decode POST {Decoded Transaction}
    Parameter Type Description
    tx String Transaction Hex

    Order API

    IndieSquare’s Order API allows you to get order transactions.

    Order Book

    curl https://api.indiesquare.me/v2/orders/CNPCOIN/book
    
    echo $client->get('https://api.indiesquare.me/v2/orders/CNPCOIN/book')->getBody();
    
    {
       "bid":[
          {
             "source":"1M6aLABuidphUhj8zEcdj54BzpumwiPaj5",
             "give_token":"XCP",
             "give_quantity":0.96,
             "get_token":"CNPCOIN",
             "order_amount":120,
             "get_quantity":120,
             "price":0.008
          }
       ],
       "ask":[
          {
             "source":"19oiQTQMYedkxH47Xd1UkrL6QePHM7Jud9",
             "give_token":"CNPCOIN",
             "order_amount":1848.61714456,
             "give_quantity":1848.61714456,
             "get_token":"XCP",
             "get_quantity":33.2751086,
             "price":0.017999999998875
          }
       ]
    }
    

    The Order Book Endpoint is a method to get the list of orders on a token

    Resource Method Return Object
    /orders/:token/book GET {"bit":Array[Order], "ask":Array[Order]}

    Order History Book

    curl https://api.indiesquare.me/v2/orders/LTBCOIN/history
    
    echo $client->get('https://api.indiesquare.me/v2/orders/LTBCOIN/history')->getBody();
    
    [
       {
          "type":"buy",
          "give_token":"XCP",
          "give_quantity":0.00056997,
          "get_token":"LTBCOIN",
          "get_quantity":56.94005923,
          "status":"completed",
          "price":1.0010000124828e-5,
          "block_index":421635,
          "block_time":1469064341,
          "time":"2016-07-21T01:25:41+0000"
       },
       {
          "type":"sell",
          "give_token":"LTBCOIN",
          "give_quantity":27.05594406,
          "get_token":"XCP",
          "get_quantity":0.00027083,
          "status":"completed",
          "price":1.0009999998499e-5,
          "block_index":421635,
          "block_time":1469064341,
          "time":"2016-07-21T01:25:41+0000"
       }
    ]
    

    The Order History Endpoint is a method to get the order history on a token

    Resource Method Return Object
    /orders/:token/history GET Array[Order]

    Market/Fees API

    IndieSquare’s Market/Fees API allows you to get market and transaction fee information.

    Ticker

    curl https://api.indiesquare.me/v2/market/ticker
    
    echo $client->get('https://api.indiesquare.me/v2/market/ticker')->getBody();
    
    {
       "AUD":{
          "last":879.8,
          "symbol":"$"
       },
       "CAD":{
          "last":861.89,
          "symbol":"$"
       },
    
       .
       .
       .
    
       "USD":{
          "last":656.75,
          "symbol":"$"
       },
       "XCP":{
          "last":"0.00467149",
          "symbol":"XCP"
       }
    }
    

    Ticker Endpoint is a method to get exchange rates between BTC and some currencies.

    Resource Method Return Object
    /market/ticker GET {Exchange Rate}

    Token Price

    curl https://api.indiesquare.me/v2/market/CNPCOIN/price
    
    echo $client->get('https://api.indiesquare.me/v2/market/CNPCOIN/price')->getBody();
    
    {
       "BTC":{
          "price":0.008
       }
    }
    

    Token Price Endpoint is a method to get exchange rates between BTC and a token.

    Resource Method Return Object
    /market/:token/price GET {Exchange Rate}
    curl https://api.indiesquare.me/v2/fees/recommended
    
    echo $client->get('https://api.indiesquare.me/v2/fees/recommended')->getBody();
    
    {
       "fastestFee":60906,
       "halfHourFee":39059,
       "hourFee":26786,
       "unit":"satoshis_per_kb"
    }
    

    Fee Endpoint is a method to get recommended transaction fees.

    Resource Method Return Object
    /fees/recommended GET {Recommended Transaction Fees}

    System Status API

    IndieSquare’s Status API allows you to get IndieSquare's service status.

    Reorg

    curl https://api.indiesquare.me/v2/status/reorg
    
    echo $client->get('https://api.indiesquare.me/v2/status/reorg')->getBody();
    
    {
       "isReorg":false
    }
    

    Reorg Endpoint is a method to get the reorg status.

    Resource Method Return Object
    /status/reorg GET {Reorg status}

    WebSocket and Webhook

    IndieSquare provides two type of real-time notifications.

    WebSocket

    <html>
      <head>
      <title>IndieSquare WebSocket Test</title>
      <script>
        function init() {
          websocket = new WebSocket("wss://ws.indiesquare.me");
          websocket.onopen = function() { document.getElementById("output").innerHTML += "<p>> CONNECTED</p>"; };
          websocket.onmessage = function(evt) { document.getElementById("output").innerHTML += "<p style='color: blue;'>> RESPONSE: " + evt.data + "</p>"; };
        }
        window.addEventListener("load", init, false);
      </script>
      </head>
      <body>
        <div id="output"></div>
      </body>
    </html>
    
    ---
    
    > CONNECTED
    > RESPONSE:
    {
       "event":"new-tx",
       "transaction":{
          "type":"send",
          "source":"16Huc2gVydUnMMskVQnLTfvmL6eL1nFBEX",
          "destination":"1AeqgtHedfA2yVXH6GiKLS2JGkfWfgyTC6",
          "token":"DATABITS",
          "quantity":10000
       }
    }
    

    wss://ws.indiesquare.me is WebSocket connection URL.

    Webhook

    IndieSquare’s Webhook API allows you to get filtered real-time token transfer data.

    Create WebHook Endpoint

    curl -H 'X-Api-Key:YOUR_API_KEY' -H "Content-Type: application/json" -X POST -d '{"event": "new-block", "url": "http://requestb.in/1jmyngh2"}' https://api.indiesquare.me/v2/webhooks
    
    {
       "event":"new-block",
       "url":"http:\/\/requestb.in\/1jmyngh2",
       "id":"dde8db44513d92f0f7b2ff4e7ac163df"
    }
    

    Create WebHook Endpoint is a method to create a webhook.

    Resource Method Return Object
    /webhooks POST -
    Parameter Type Description
    event String The event type; "new-block", "new-tx"
    url String The webhook url
    type String The type of transaction; "send", "order", "cancel", "issuance"
    token String The token name
    address String The bitcoin address

    List WebHooks Endpoint

    curl -H 'X-Api-Key:YOUR_API_KEY' https://api.indiesquare.me/v2/webhooks
    
    [
       {
          "id":"dde8db44513d92f0f7b2ff4e7ac163df",
          "event":"new-block"
       }
    ]
    

    List WebHooks Endpoint is a method to get your webhook list.

    Resource Method Return Object
    /webhooks GET -

    WebHook ID Endpoint

    curl -H 'X-Api-Key:YOUR_API_KEY' https://api.indiesquare.me/v2/webhooks/dde8db44513d92f0f7b2ff4e7ac163df
    
    {
       "id":"dde8db44513d92f0f7b2ff4e7ac163df",
       "event":"new-block"
    }
    

    WebHook ID Endpoint is a method to get a webhook.

    Resource Method Return Object
    /webhooks/:id GET -

    Delete WebHook Endpoint

    curl -H 'X-Api-Key:YOUR_API_KEY' -X DELETE https://api.indiesquare.me/v2/webhooks/dde8db44513d92f0f7b2ff4e7ac163df
    

    Delete WebHook Endpoint is a method to delete a webhook.

    Resource Method Return Object
    /webhooks/:id DELETE -

    Introduction SDKs

    The IndieSquare Blockchain Platform and SDK makes it easy to implement decentralized applications. The SDK is fully integrated with the IndieSquare service for managing your tokens on blockchain.

    Javascript SDK v1

    Hello world

    <script src="https://cdn.indiesquare.me/v1/indiesquare.js"></script>
    // var IndieSquare = require("indiesquare");  es5
    // import IndieSquare from "indiesquare/src"; es6
    
    // Initiailize
    var indiesquare = new IndieSquare({
        'apikey': 'abcdefghijk1234567890',
        // 'use-server': true,
        // 'port': 8080
    });
    
    // Get balance on source address.
    indiesquare.getBalances({'source': '1JynF1GgD279DBZxQBubJXz4NuHcTy65k3'}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.log('Get balance on source address.');
        console.dir(data);
    });
    
    <script src="https://cdn.indiesquare.me/v1/indiesquare.js"></script>
    
    // Initiailize
    var indiesquare = new IndieSquare({
        'apikey': 'abcdefghijk1234567890',
        // 'use-server': true,
        // 'port': 8080
    });
    
    // Get balance on source address.
    indiesquare.getBalances({'source': '1JynF1GgD279DBZxQBubJXz4NuHcTy65k3'}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.log('Get balance on source address.');
        console.dir(data);
    });
    

    Get Code: CDN

    https://cdn.indiesquare.me/v1/indiesquare.js https://cdn.indiesquare.me/v1/indiesquare.min.js

    Get Code: Node

    npm install indiesquare

    Get Code: Source

    https://github.com/IndieSquare/javascript-sdk

    Get Balance

    indiesquare.getBalances({'source': '1JynF1GgD279DBZxQBubJXz4NuHcTy65k3'}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir(data);
    });
    

    getBalances is a method to get a subset of information on a public address.

    Parameter Type Description
    source String The address to get balances

    Get History

    indiesquare.getHistory({'source': '1JynF1GgD279DBZxQBubJXz4NuHcTy65k3'}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir(data);
    });
    

    getHistory is a method to get history of the public address.

    Parameter Type Description
    source String The address to get history

    Get Token Information

    indiesquare.getTokenInfo({'token': 'INDIESQUARE'}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir(data);
    });
    

    getTokenInfo is a method to look up the detailed information of a particular token.

    Parameter Type Description
    token String The token name to get information

    Get Token Holders

    indiesquare.getTokenHolders({'token': 'INDIESQUARE'}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir(data);
    });
    

    getTokenHolders is a method to show token holder information of a particular token.

    Parameter Type Description
    token String The token name to get holders

    Get Token History

    indiesquare.getTokenHistory({'token': 'INDIESQUARE'}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir(data);
    });
    

    getTokenHistory is a method to get history of token issuances.

    Parameter Type Description
    token String The token name to get history

    Get Token Description

    indiesquare.getTokenHistory({'token': 'INDIESQUARE'}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir(data);
    });
    

    getTokenDescription is a method to get token description from Enhanced Asset Info Json.

    Parameter Type Description
    description String The description of token information. Attempt to acquire from URL if description is URL of Enhanced Asset Info Json.

    Create Send Transaction

    indiesquare.createSend({"source": "1LZp3kBtqiTi1szU1pMWWmVhejBdmHNirm", "token": "CNPCOIN", "destination": "1JynF1GgD279DBZxQBubJXz4NuHcTy65k3", "quantity": 1}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir('unsigned_tx:' + data.unsigned_tx);
    });
    

    createSend is a method to create a send transaction and return the unsigned_tx.

    Parameters are same as Create Send Transaction API

    Create Issuance Transaction

    indiesquare.createIssuance({"source": "12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD", "quantity": 1000, "token": "NETX", "divisible": true}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir('unsigned_tx:' + data.unsigned_tx);
    });
    

    createIssuance is a method to create a issuance transaction and return the unsigned_tx.

    Parameters are same as Create Issuance Transaction API

    Create Order Transaction

    indiesquare.createOrder({"source": "12sWrxRY7E7Nhmuyjbz4TtGE9jRewGqEZD", "give_quantity": 10, "give_token": "NETX", "get_quantity": 1, "get_token": "XCP", "expiration": 100}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir('unsigned_tx:' + data.unsigned_tx);
    });
    

    createOrder is a method to create a order transaction and return the unsigned_tx.

    Parameters are same as Create Order Transaction API

    Create Cancel Transaction

    indiesquare.createCancel({"source": "1MZUJyKLHsSthHY3z68NxLFPhnrDcsPaDk", "offer_hash": "ea8f9eeb36ed8c3001f4c572796d450514b19f108e3d3f35d8631004c5871fbf"}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir('unsigned_tx:' + data.unsigned_tx);
    });
    

    createCancel is a method to create a DEX order cancel transaction and return the unsigned_tx.

    Parameters are same as Create Cancel Transaction API

    Sign Transaction

    <script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/master/qrcode.min.js"></script>
    
    indiesquare.signTransaction({'unsigned_tx': '0100000001bf1f87c5041063d8353f3d8e109fb11405456d7972c5f401308ced36eb9e8fea010000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488acffffffff0200000000000000002e6a2c0b0b8cb664864cdf2ff70668595e63567b9d8ece36b2383513b6eeab7f1c15e70466593f13bb49618b8afe7079e93a00000000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488ac00000000'}, function(url, urlScheme, error){
        if( error ){
            console.error(error);
            return;
        }
        new QRCode(document.getElementById('qrcode'), {
            text: url,
            width: 128, height: 128,
            correctLevel : QRCode.CorrectLevel.L
        });
    }, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.log(data.signed_tx);
    });
    

    signTransaction is a method to sign to the unsigned transaction via IndieSquare wallet and return the signed_tx.

    Format

    signTransaction(params, connect, callback);

    Parameter Type Description
    params Array Unsigned transaction hex.
    (please set into params.unsigned_tx)
    connect Function It is called when a transaction signed with IndieSquare wallet.
    connect(url, urlScheme, error)
    - url (String): The string to linkage with IndieSquare wallet.
    - urlScheme (String): The url scheme string to linking with IndieSquare wallet.
    - error (Object): error message object
    callback Function It is called when a transaction signed with IndieSquare wallet.
    callback(data, error)
    - data (Object): Signature result. You can get signed tx from data.signed_tx.
    - error (Object): error message object

    Broadcast

    indiesquare.broadcast({"tx": "0100000001bf1f87c5041063d8353f3d8e109fb11405456d7972c5f401308ced36eb9e8fea010000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488acffffffff0200000000000000002e6a2c0b0b8cb664864cdf2ff70668595e63567b9d8ece36b2383513b6eeab7f1c15e70466593f13bb49618b8afe7079e93a00000000001976a914e1869fa1cec7741a502e7a5bd938ed8f5e354b5488ac00000000"}, function(data, error){
        if( error ){
            console.error(error);
            return;
        }
        console.dir('txid:' + data.txid);
    });
    

    broadcast is a method to broadcast the signed transaction and return the txid.

    Parameters are same as Broadcast Transaction API

    Get Address from wallet

    indiesquare.getAddress('Test', function(url, urlScheme, error){
        if( error ){
            console.error(error);
            return;
        }
        new QRCode(document.getElementById('qrcode'), {
            text: url,
            width: 128, height: 128,
            correctLevel : QRCode.CorrectLevel.L
        });
    }, function(result, error){
        if( error ){
            console.error(error);
            return;
        }
        console.log(result.address);
    });
    

    getAddress is a method to get address from IndieSquare wallet.

    Format

    getAddress(name, connect, callback);

    Parameter Type Description
    name String Your service name. IndieSquare wallet will ask to the user if they can provide an address for this named service.
    connect Function It is called when preparation for connection with IndieSquare wallet is completed.
    connect(url, urlScheme, error)
    - url (String): The string to linkage with IndieSquare wallet.
    - urlScheme (String): The url scheme string to linking with IndieSquare wallet.
    - error (Object): error message object
    callback Function It is called when a user allowed to provide their address to your service.
    callback(data, error)
    - data (Object): Signature result. You can get address from data.address.
    - error (Object): error message object

    Transition wallet screen

    indiesquare.transition({'screen': 'send', 'token': 'XCP', 'destination': '1JynF1GgD279DBZxQBubJXz4NuHcTy65k3', 'amount': 0.1}, function(url, urlScheme, error){
        if( error ){
            console.error(error);
            return;
        }
        new QRCode(document.getElementById('qrcode'), {
            text: url,
            width: 128, height: 128,
            correctLevel : QRCode.CorrectLevel.L
        });
    });
    

    transition is a method to make screen transition of IndieSquare wallet. Available for the Send screen and to the DEX screen. learn more

    Manual API Call

    indiesquare.callApi('GET', {'url': '/v2/fees/recommended' }, null, function(data, error) {
        if( error ){
            console.error(error);
            return;
        }
        console.log(data); // { fastestFee: 317464, halfHourFee: 287396, hourFee: 216876, lowFee: 7500, unit: 'satoshis_per_kb' }
    });
    
    indiesquare.callApi('POST', {'url': '/v2/transactions/send' }, {"source": "1LZp3kBtqiTi1szU1pMWWmVhejBdmHNirm", "token": "CNPCOIN", "destination": "1JynF1GgD279DBZxQBubJXz4NuHcTy65k3", "quantity": 1}, function(data, error) {
        if( error ){
            console.error(error);
            return;
        }
        console.dir(data); // { unsigned_tx: '01000000013df74697ca8d20ca177df51586a0f1873a1c4abb687ae5e7fa7c7bda1da60786020000001976a914d69ef94a9df9c390b7dc6bc575cc87f95ffb037688acffffffff0336150000000000001976a914c53732a67fb954ef34ed1140522f87f1f8ec06bc88ac00000000000000001e6a1c2b914107492a961bb2931c0b99bb4e1ea8df1c83a1384e025be6551665510000000000001976a914d69ef94a9df9c390b7dc6bc575cc87f95ffb037688ac00000000', fee: 7875 }
    });
    

    callApi is a method for calling the API manually.

    Format

    callApi(method, endpoint, params, callback);

    Parameter Type Description
    method String Method type. basically GET or POST
    endpoint Array Set endpoint to url. SDK will connect to 'https://api.indiesquare.me/v2/fees/recommended' if you set '/v2/fees/recommended'
    params Array You can set parameters for the POST request. For GET, you can set null.
    callback Function callback(data, error)
    - data (Array): result from API.
    - error (Object): error message object

    Unity SDK v1

    This SDK allows you to implement the linkage with IndieSquare wallet in your unity project. You can get unity package and document here!

    GET UNITY SDK