Skip to content

Instantly share code, notes, and snippets.

@jtremback
Last active January 1, 2016 02:09
Show Gist options
  • Save jtremback/8077192 to your computer and use it in GitHub Desktop.
Save jtremback/8077192 to your computer and use it in GitHub Desktop.

The Cryptos Till API allows you to easily create rich apps that handle any cryptocoin. You don't need to build clients, manage load, or worry about security. We handle all of that for you to let you concentrate on building an awesome app.

Your Till account consists of an unlimited number of virtual wallets. These virtual wallets are indetified by a unique string or id, and can hold all of the currencies that we support. We're launching with BTC, LTC, and DOG, but our goal is to support as many coins as possible, as soon as possible. Coins can be transfered between these virtual wallets instantly, and can be sent to any external wallet with one API call.

The foundation of our business is the security of your user's funds, but we also strongly believe that you should have as much control as possible. We only hold as many cryptocoins as are neccesary to handle day-to-day transactions. You hold the rest in cold wallets under your control. We have configurable rules on when we send funds in Till to your cold wallets, and what percentage of your coins we hold at any one time. Large withdrawals will need to be approved and transacted by you.

#Till API Documentation

The Till API stores cryptocoins in buckets. Each bucket has a unique ID and secret. In most cases, one bucket will correspond to one app. Think of it as a simple database for cryptocoins.

A bucket holds an unlimited number of virtual wallets. Each virtual wallet is identified by a unique string (for example, you might use a user's email address or a user id from your database). A virtual wallet can hold any amount of all the cryptocoins we support. You control the virtual wallets with several simple API calls.

##View

view is used to view information about the wallet without making any changes.

GET /api/v1/wallet/view
  ?id
  &secret
  &wallet

curl -X GET https://cryptos.io/api/v1/wallet/view?id=my_bucket&secret=Hwi893ssd3hhei&wallet=wallet123

The call returns a list of all balances and deposit addresses of the wallet.

{
  "status": "OK",
  "data": {
    "wallet": {
      "name": "wallet123",
      "balance": {
        "BTC": 0
      },
      "address": {
        "BTC": "0a9sd..."
      },
    }
  }
}

Response when trying to view an empty wallet

{
  "status": "EMPTY"
}

##Create

create creates a new deposit address for a particular coin in a wallet. If the wallet does not yet exist, it is created. If you are moving coins from another wallet in the same bucket, you can skip this call, as move will create an address if one does not yet exist.

POST /api/v1/wallet/create
  ?id
  &secret
  &wallet
  &coin
  
curl -X POST https://cryptos.io/api/v1/wallet/create?id=my_bucket&secret=Hwi893ssd3hhei&wallet=wallet123&coin=DOG

The response contains a list of all balances and deposit addresses of the affected wallet:

{
  "status": "OK",
  "data": {
    "wallet": {
      "name": "wallet123",
      "balance": {
        "BTC": 0,
        "DOG": 0
      },
      "address": {
        "BTC": "0a9sd...",
        "DOG": "a90sd..."
      },
    }
  }
}

##Move

move is used to move coins between virtual wallets, instantly. You can only use this call to move coins between wallets in the same bucket. To send coins to another bucket, or outside of Till, see withdraw.

POST /api/v1/wallet/move
  ?id
  &secret
  &from_wallet
  &to_wallet
  &coin
  &amount
  
curl -X POST https://cryptos.io/api/v1/wallet/move?id=my_bucket&secret=Hwi893ssd3hhei&from_wallet=wallet456&to_wallet=wallet123&coin=DOG&amount=100

The response contains a list of all balances and deposit addresses both affected wallets:

{
  "status": "OK",
  "data": {
    "from_wallet": {
      "name": "wallet456",
      "balance": {
        "BTC": 20,
        "DOG": 1200
      },
      "address": {
        "BTC": "0a9sd...",
        "DOG": "a90sd..."
      },
    },
    "to_wallet": {
      "name": "wallet",
      "balance": {
        "BTC": 0,
        "DOG": 100
      },
      "address": {
        "BTC": "0a9sd...",
        "DOG": "a90sd..."
      },
    }
  }
}

Response on insufficient balance:

{
  "status": "ERROR",
  "data": {
    "error": "Insufficient coins to complete transaction"
}

##Withdraw

withdraw is used to send coins to a wallet in another bucket, or outside of the system. Withdrawals are naturally limited by how many coins you are storing in Till.

POST /api/v1/wallet/withdraw
  ?id
  &secret
  &from_wallet
  &to_address
  &coin
  &amount
  
curl -X POST https://cryptos.io/api/v1/wallet/withdraw?id=my_bucket&secret=Hwi893ssd3hhei&from_wallet=wallet123&to_address=DRQpm63yg9KpqxiiPgpae9oXNcqJ2ZcoXb&coin=DOG&amount=50

The response contains a list of all balances and deposit addresses of the affected wallet:

response: {
  "status": "OK",
  "data": {
    "wallet": {
      "name": "jehan",
      "balance": {
        "BTC": 0,
        "DOG": 0,
      },
      "address": {
        "BTC": "0a9sd...",
        "DOG": "a90sd...",
      },
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment