Bitcoin is a money platform with many APIs

If you equate Bitcoin with digital cash, you're missing the bigger picture.

Bitcoin is much more than just a digital currency. It is a protocol, a network, a currency and a transaction language. Most of all, though, it is an application programming interface (API) for money. Nowadays, bathroom scales and fridges have APIs, so why not money?

Traditional money does have APIs, but they are closed. You can program the merchant API of the VISA network if you are a trusted merchant. You can send and receive FIX messages if you are a stockbroker or exchange. Regular people, however, don’t even have APIs into their bank accounts, let alone the broader economy. Bitcoin changes all that by not only offering an API for accounts (wallets) and transactions, but also making that API available to everyone.

In a traditional financial network, trust is achieved through a complex web of regulations, fraud detection, and accreditation — but most of all exclusion. Financial networks remain secure by keeping the APIs closed and inaccessible except to the few who are trusted, and thereby keep out bad actors (at least in theory). Bitcoin shifts the model from “trust by exclusion” to “trust by computation.” Trust is distributed across a large (and ever-growing) network of collaborators who continuously check one another, making it increasingly difficult for any bad actor — or even a set of bad actors — to hijack the network. As a result, there is no need for exclusion or access controls. Anyone can participate in the Bitcoin network and see all the transactions, or rather everyone can access the APIs.

On the Bitcoin network, you can programmatically check your balance, or the balance of any Bitcoin wallet. You can create and consume transactions on a level playing field. You can operate a bank, a stock exchange, a wire transfer service or an escrow service without anyone’s permission or accreditation. The Internet made every blogger able to reach an audience as big as that of the New York Times. Bitcoin makes every node, even that running on your cellphone, equal in capability to Wells Fargo or Bank of America.

Of course, not everyone wants to open a bank or invent a new financial service. Not everyone has the skills or credibility to operate a financial service. Ultimately, the market can decide. Just like the Internet democratized publishing, removing barriers and intermediaries and allowing direct access for both publishers and consumers of media, Bitcoin promises to do the same for money. It empowers users to determine who they will trust for their financial services, just as the Internet empowers users to determine who they will trust for their information.

The Bitcoin network offers three distinct APIs. The first is the transaction scripting language, a Forth-like language for defining transactions. The most commonly used script corresponds to “Transfer X coins from Alice’s wallet to Bob’s wallet.” While almost all transactions look like this, the scripting language is incredibly powerful and allows for innovation at the transaction level. One example of such innovation is the M–of–N signatures script, which is a transaction that can be unlocked if any M of a total N keys are used to sign it. For example, a transaction could require a third-party escrow key — in addition to the recipient’s key — to validate. In a corporate setting, this allows for capital accounts to require two or more signatories to spend, for example the CFO, the treasurer and the auditor. A transaction could be set to unlock with either one of two keys, allowing for example a “joint account,” or a trustee/executor relationship.

Beyond the M–of–N model, the scripting language can specify validation conditions that have nothing to do with keys. For example, a transaction might be payable to anyone guessing a combination of numbers, creating the possibility for a global and verifiable lottery. A transaction could be set to unlock by anyone, but only after a specified time, creating a timelock. Or it could be co-signed (paid) by 10 different people combining their keys to pay for a song they all can share. The possibilities are truly infinite, as this is a language that can be extended over time.

The second API in bitcoin is the P2P network protocol API, that allows nodes to communicate, exchanging transactions, validating new blocks of transactions and newly generated coins. All of these network protocol interactions allow each node to construct a complete and identical local copy of the shared transactions ledger that is the blockchain, at the heart of Bitcoin. The open nature of the Bitcoin ledger enables anyone to offer services that require knowledge of Bitcoin transactions. For example, by telling your tax accountant which of the public Bitcoin wallet addresses belong to you, they can easily find all of the transactions associated with your wallets in the ledger and compute your profits and losses — or even create optimal tax strategies for Bitcoin trading activity.

Finally, the third API is the “northbound” client API that exposes the Bitcoin economy as a set of JSON-RPC services for client applications. This API offers services such as checking the balance in a wallet, the equivalent of a bank account in the Bitcoin world; creating a transaction; creating new wallets; etc. Think of it as an API to online banking services, on steroids.

Of course, Bitcoin’s APIs don’t end there. Bitcoin acts as a platform for higher level services, such as lightweight clients (Stratum API), currency exchanges, notification and alerting services, market data services, econometric services, etc. All of these come with their own APIs.

If Bitcoin is equivalent to IP (Internet Protocol), there are not only APIs and protocols that extend it like TCP, but also layers of protocols above it, providing services like the application layer protocols of the Internet SMTP, HTTP, etc. Using the underlying distributed-ledger foundation, developers have introduced attestation and notarization services that prove the existence of a document at a specified time and even secure messaging services.

Bitcoin turns money and transactions — and therefore trade — into a programmer’s paradise: money-as-a-service, with open, flexible and powerful APIs into an entire economy, all just a JSON request away. If you’re looking at Bitcoin and thinking of digital cash, you’re missing the iceberg below the surface.

tags:
  • http://twitter.com/nik5ter nik5ter

    Finally, a non-sensationalist/non-political, cogent, and informative article on BTC. Wish I could like this twice.

  • The Reeves Law Group

    This is absolutely one of the best BTC articles on the internet. Bitcoin is sooooo much more than just digital cash. And it’s good to hear that other people understand that there is an “iceberg below the surface”. Excellent work. Keep it up.

  • JimboToronto

    Thank you for an informed, informative article.

    It’s a refreshing change from the spamfest of FUD.

    So many people just don’t seem to understand Bitcoin and want to treat it within the parameters of what they’re used to. As the author points out, it’s so much more than just a commodity to be bought and sold like metals, shares of companies, tulip bulbs, or barrels of crude oil.

    It’s more of a service than than it is goods.

  • tuna

    I’m surprised there wasn’t more mention of the use of API’s on exchanges like mt-gox or btc-e. From my years of playing with bitcoin that is generally the kind of API bitcoin holders think about. By using these exchange based API’s users can easily create scripts to automate profit based transactions.
    For example a script could be made to query the exchanges API every 20 seconds to see if the price of bitcoin has gone up, say 2% in the past minute, and is then leveling off. Let’s say the script’s algorithm detects this upward price and then sends an order in to sell the users coins, say 10 btc at $125, leaving the user with $1250. Then the script can be set to execute a buy order at a price lower than what they just sold for; as the script is checking the market price every 20 seconds and detects it is ticking down and starting to bottom out at $120 per btc. The script then puts a buy order in at $120 and their $1250 is now 10.41 btc. A gain of 0.41btc(~$50) may not sound like much but when you consider that by using an exchanges API these gains can be realized in seconds, minutes, or hours then a user with a good algorithm could make 500 transactions with a profit of .01 btc or 100 trans with a profit of 0.25btc in a day. This feedback loop grows more profitable as the user has more to trade and they can leave it run all day, it becomes like a machine that just makes money. And this is just one simple example, algorithms built around these API’s can become quite complex and efficient at arbitrage and trading between digital currencies.
    Anyone that has heard of high frequency trading, “quants” or quantitative analysts should be familiar with the mechanics. But with bitcoin the potential is much greater. Given the price volatility, that the market never closes, you don’t have to have $25k to join(the min SEC requires for day trading), and you don’t need to work for a wall st firm, anyone can look-up a few java/python/etc tutorials and build there own trading platform around bitcoin exchange API’s and feel like the next Gordon Gecko.

    • Andreas M. Antonopoulos

      This is a great topic for a follow up article. The exchange APIs are quite easy to use. A trading strategy like the one suggested can work, but carries substantial risk if it doesn’t include various controls, such as stop-loss orders and such. Unfortunately, the exchanges currently offer only basic market-price buy/sell orders.

      I have dabbled a bit with algorithmic trading using the Mt. Gox APIs, and tried both formulaic approaches (rules/heuristic), and genetic algorithms/neural nets (machine learning).

      One major challenge with the current systems is that fact that on low volatility days there is not much opportunity for profit – the price just rises steadily but slowly. Then on days with a lot of profit opportunity, when volatility is high, the exchange APIs and engines become slow and unresponsive, creating market-data and order-book lags as well as trade execution lag exceeding several minutes. Basically, when you need to trade you can’t and when you can there’s no point. Algorithms are especially sensitive to trade-execution latency, they can find themselves trading on stale information and constantly missing the mark, leading to large incremental losses.

      If you’re not a professional trader, day-trading or algo-trading bitcoin is a sure way to make yourself a million dollars – if you started out with 2 million (ie. lose half of it). It’s a high risk game. Most geeks (me included) wrongly assume that their skills translate into this area of expertise and they do not. The lesson is quickly learned but the “school” is expensive.

      Best way to make bitcoin is to sell a product or service for bitcoin, or to buy small amounts of bitcoin regularly and hold them as part of a well diversified and long-term portfolio.

      • Brian

        so are you saying there is opp to exploit slow processing if you had faster processor?

        • http://www.botsofbitcoin.com/shop-2/ botsofbitcoin

          It’s not the processing that’s slow but the exchanges themselves are slow to respond. So if you say sell at market price, what you think is the current market price may actually be far less (or more) than you were expecting by the time the order executes. If you’ve ever seen the Mt Gox lag figure at places like http://bitcoinity.org/markets/mtgox/USD that’s what this is referring to. There are still opportunities to be had while the lag isn’t too bad but once it starts to build up you can really lose your shirt.

  • David Bailey

    Great article Andreas!

  • Brian

    Where can I learn more about ALL the bitcoin APIs? Echo fab article, best

    • slavix

      You can start here
      bitcoin. it/wiki/Main_Page

  • Paul Murphy

    We have the only bitcoin fund in the world at EXANTE

    My email is pm@exante.eu

  • slavix

    Thank you for this great article. I have been involved with bitcoins for two years and I learned a lot of new and useful information about bitcoin from this article.

  • Steven Moore

    Andreas- you have done a great job here. This is the best article on Bitcoin, and I have curated thousands of them as I am mapping all aspects of the Bitcoin ecosystem so I know.

    “Just like the Internet democratized publishing, removing barriers and intermediaries and allowing direct access for both publishers and consumers of media, Bitcoin promises to do the same for money”

    The Fireworks and the Digital Darwinism that was created was amazing to watch and participate in and the time has come for the most important area of society to open up, the ultimate vehicle for exchange of value and change. Now If we can look back at all the change and understand how to reduce the friction that is coming and get better at evolving we could innovate even faster.

    However, telling those that wear the medals of wars fought and won in the past, and own the keys to the kingdom to gently get out of the way or work together has not happened yet in any technologically driven change….we know these things are coming and yet we handle it so poorly…
    Again great article……..

  • Fellow Traveler

    Excellent article!

  • john

    Exactly. What we need is more quality layers of abstraction on top of it now to help the sweaty masses keep up.

  • chris1776

    Nice article. An application that would be most helpful would be a distributed, peer-to-peer SSL/TLS certificate authority (perhaps tied in to Namecoin) in order to avoid the problem of top level certificate authorities being compromised by anyone thereby compromising all https/SSL traffic online.

  • Koen Swinkels

    Thank you for the great (comprehensive, clear and useful) article. It’s going to be the default article that I recommend to people who want to learn more about what exactly is so great about Bitcoin.