etherapis

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2016 License: GPL-3.0

README

Gopher Gala - Ether APIs - etherapis.io

With the advent of cloud computing, everyone is trying to create some sort of online service that you can access and interact with via an online API. As the popular iOS slogan goes "there's an app for that", in the API world it's a similar mantra: "there's an API for that", irrelevant what you're trying to build: machine translation, mapping service, email sending, video rendering and streaming, etc., you'll find a large or small company that does exactly that, and the only thing you need to do is to hook into their system.

However, the online service and API ecosystem has a less attractive side, a problem yet unsolved, which leads to a high barrier of entry for small projects: trust. New and geographically remote projects are inherently untrusted, which makes payment for said services very problematic.

Pain point

There are two main types of API providers: large corporations and small to medium scale projects, the two of which have very different offers when it comes to paid APIs.

  • Large corporations (e.g Google, Amazon) require a consumer to only have a credit card on file, and whenever the user consumes some API, it is measured and counted against the user's quota. At the end of the payment cycle, the client is charged with the outstanding amount. This however has the drawbacks that I need to provide all my personal and payment information to the API provider, as well as there's a risk that I consume more than I would like (e.g. forgot to turn off the dang test VMs), causing a huge charge that I have to pay nonetheless.
  • Small and medium companies on the other hand do not have the necessary resources to "lend" API capacity for an entire month and only afterwards get their own costs covered. Additionally, they do not have the means to force clients with bad payment information to actually come through. These two monetary shortcomings force the smaller API providers into a pre-paid subscription model, where an API consumer needs to pay a potentially hefty sum up front, which also expires at the end of the payment cycle. Opposed to large corporations (which can be somewhat trusted), a user is not comfortable with giving away personal infos to unknown API providers from far away countries, neither is he comfortable with paying a lot of money up front, just to realize the API is unreliable, or worst the provider a scammer.

A prominent solution currently available is offered by mashape: an API marketplace, broker and payment gateway acting as an escrow service between providers and consumers. Providers register their API endpoints into mashape's centralized brokerage service (configuring an associated pricing model), which on the other hand exposes those hidden APIs to the general public via their own servers. As all API invocations pass through them, those can be individually authorized, accounted for and charged at the end of the payment cycle. The value mashape brings to the API ecosystem is a payment escrow service, where API providers and consumers don't have to trust each other, but rather they all trust mashape itself to do the right thing. In exchange, mashape charges a 20% flat fee on all transactions that go through its brokarage service.

The problem with the current API ecosystem is that it requires blind trust in one or both of the API participants and true pay-per-use can only be achieved by the big players in the industry. All the existing solutions to these problems take the shape of centralization, which again requires a mutually trusted party, but also introduce a potential point of failure, a potential bottleneck and last but not least, significant privacy concerns.

Solution

The proposed solution that we're pushing for is the re-decentralization of online services and APIs (like they originally were meant to be), but in a fully trustless way, where neither of the API participants has to know the other party or even trust it with funds (pre-lent or pre-paid).

By binding the financial contracts to the Ethereum blockchain, the API consumer and provider can remain in charge or their communication and the payment execution is enforced and secured by the censorship resistant Ethereum blockchain. Payment is made on a per-call basis, resurrecting the dream of a "pay for what you use": an API consumer only pays for what he actually uses, at the exact moment when he uses it; whereas an API provider can at any point redeem the payments made to his service, without the consumer being able to refuse the already authorized payments.

Payments are done over a secure, on the Ethereum blockchain, payment channel. The payment channel work in such a way that you won't burden the network with micro payments or yourself with unecassary fees. Signing of micropayments happen client side, off chain, by the consumer and are included in the authorisation header of each API call. The signed transaction can then be verified using the Ethereum state by the service provider (off chain). Once a micropayment has been signed by the consumer it can no longer be undone, this is great since both parties can't hold one another for ransom or extort the other party by not holding up their end. Payments can be verified using the following algorithm. Given that H is the hashed output of (consumer || provider || nonce || amount) and S being the signature of H using standard ECDSA with the secp256k1 curve, one can derive the sender (and therefor the proof) and verify that a payment channel is 1. owned by said signer; and 2. contains enough funds. Using S one can redeem a cheque and collect their reward for their provided service. This works great since we don't have to burden the network with useless transaction as we can make use a sliding window technique where we keep increasing amount provided for H. Once a cheque has been collected we increase the nonce invalidating any other transaction with the given nonce provided in H, this is to say that a particular signed cheque can only be claimed once, ever; it is therefore wise to obviously redeem the cheque with the highest possible amount.

Use cases

So, what could this decentralized and trustless API ecosystem support:

  • Stateless APIs: each call authorizes payment for its own data processing requirement
    • E.g. machine translation, geolocation, image rendering
  • Streaming APIs: payment is authorized for some amount of future processing, renewed until both parties desire
    • E.g. music streaming services, video rendering services
  • Private APIs: the system can handle the payment for privately negotaited and executed calls
    • E.g. business to business private API execution

Value proposition

So why is this project better that anything out there?

  • Decentralized: there isn't a single point of failure, single point of bottleneck, or single point of trust
  • Trustless: nethier the API provider or consumer needs trust, everything is enforced by the blockchain
  • Private: interacting peers are anonymous, communication is direct between them, no middleman
  • Secure: Ethereum ensures all transactions are final, inalterable and non censurable

How much does such a setup cost?

  • Registering a new API, subscribing to an API, charging all accumulated payments is ~$0.0015 (blockchain fees)
  • Searching for APIs and making payments for API calls is completely free (done off chain)
  • Payment contract charges a service fee of 1% (opposed to the 20% of existing competitors)

Directories

Path Synopsis
demos
Godeps/_workspace/src/github.com/codegangsta/cli
Package cli provides a minimal framework for creating and organizing command line Go applications.
Package cli provides a minimal framework for creating and organizing command line Go applications.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/accounts
Package implements a private key management facility.
Package implements a private key management facility.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/accounts/abi
Package abi implements the Ethereum ABI (Application Binary Interface).
Package abi implements the Ethereum ABI (Application Binary Interface).
Godeps/_workspace/src/github.com/ethereum/go-ethereum/cmd/utils
Package utils contains internal helper functions for go-ethereum commands.
Package utils contains internal helper functions for go-ethereum commands.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/common
Package common contains various helper functions.
Package common contains various helper functions.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/core
Package core implements the Ethereum consensus protocol.
Package core implements the Ethereum consensus protocol.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/core/state
Package state provides a caching layer atop the Ethereum state trie.
Package state provides a caching layer atop the Ethereum state trie.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/core/types
Package types contains data types related to Ethereum consensus.
Package types contains data types related to Ethereum consensus.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/core/vm
Package vm implements the Ethereum Virtual Machine.
Package vm implements the Ethereum Virtual Machine.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/core/vm/runtime
Package runtime provides a basic execution model for executing EVM code.
Package runtime provides a basic execution model for executing EVM code.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/crypto/sha3
Package sha3 implements the SHA3 hash algorithm (formerly called Keccak) chosen by NIST in 2012.
Package sha3 implements the SHA3 hash algorithm (formerly called Keccak) chosen by NIST in 2012.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/eth
Package eth implements the Ethereum protocol.
Package eth implements the Ethereum protocol.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/eth/downloader
Package downloader contains the manual full chain synchronisation.
Package downloader contains the manual full chain synchronisation.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/eth/fetcher
Package fetcher contains the block announcement based synchonisation.
Package fetcher contains the block announcement based synchonisation.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/eth/filters
package filters implements an ethereum filtering system for block, transactions and log events.
package filters implements an ethereum filtering system for block, transactions and log events.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/event
Package event implements an event multiplexer.
Package event implements an event multiplexer.
Package filter implements event filters.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/jsre
Package jsre provides execution environment for JavaScript.
Package jsre provides execution environment for JavaScript.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/logger
Package logger implements a multi-output leveled logger.
Package logger implements a multi-output leveled logger.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/logger/glog
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics
Package metrics provides general system and process level metrics collection.
Package metrics provides general system and process level metrics collection.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/miner
Package miner implements Ethereum block creation and mining.
Package miner implements Ethereum block creation and mining.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/node
Package node represents the Ethereum protocol stack container.
Package node represents the Ethereum protocol stack container.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/p2p
Package p2p implements the Ethereum p2p network protocols.
Package p2p implements the Ethereum p2p network protocols.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/p2p/discover
Package discover implements the Node Discovery Protocol.
Package discover implements the Node Discovery Protocol.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat
Package nat provides access to common network port mapping protocols.
Package nat provides access to common network port mapping protocols.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/rlp
Package rlp implements the RLP serialization format.
Package rlp implements the RLP serialization format.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/rpc
Package rpc provides access to the exported methods of an object across a network or other I/O connection.
Package rpc provides access to the exported methods of an object across a network or other I/O connection.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/trie
Package trie implements Merkle Patricia Tries.
Package trie implements Merkle Patricia Tries.
Godeps/_workspace/src/github.com/ethereum/go-ethereum/whisper
Package whisper implements the Whisper PoC-1.
Package whisper implements the Whisper PoC-1.
Godeps/_workspace/src/github.com/fatih/color
Package color is an ANSI color package to output colorized or SGR defined output to the standard output.
Package color is an ANSI color package to output colorized or SGR defined output to the standard output.
Godeps/_workspace/src/github.com/hashicorp/golang-lru
This package provides a simple LRU cache.
This package provides a simple LRU cache.
Godeps/_workspace/src/github.com/huin/goupnp
goupnp is an implementation of a client for various UPnP services.
goupnp is an implementation of a client for various UPnP services.
Godeps/_workspace/src/github.com/huin/goupnp/dcps/av1
Client for UPnP Device Control Protocol MediaServer v1 and MediaRenderer v1.
Client for UPnP Device Control Protocol MediaServer v1 and MediaRenderer v1.
Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway1
Client for UPnP Device Control Protocol Internet Gateway Device v1.
Client for UPnP Device Control Protocol Internet Gateway Device v1.
Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway2
Client for UPnP Device Control Protocol Internet Gateway Device v2.
Client for UPnP Device Control Protocol Internet Gateway Device v2.
Godeps/_workspace/src/github.com/huin/goupnp/example
Serves as examples of using the goupnp library.
Serves as examples of using the goupnp library.
Godeps/_workspace/src/github.com/mattn/go-isatty
Package isatty implements interface to isatty
Package isatty implements interface to isatty
Godeps/_workspace/src/github.com/pborman/uuid
The uuid package generates and inspects UUIDs.
The uuid package generates and inspects UUIDs.
Godeps/_workspace/src/github.com/peterh/liner
Package liner implements a simple command line editor, inspired by linenoise (https://github.com/antirez/linenoise/).
Package liner implements a simple command line editor, inspired by linenoise (https://github.com/antirez/linenoise/).
Godeps/_workspace/src/github.com/rcrowley/go-metrics
Go port of Coda Hale's Metrics library <https://github.com/rcrowley/go-metrics> Coda Hale's original work: <https://github.com/codahale/metrics>
Go port of Coda Hale's Metrics library <https://github.com/rcrowley/go-metrics> Coda Hale's original work: <https://github.com/codahale/metrics>
Metrics output to StatHat.
Godeps/_workspace/src/github.com/robertkrimen/otto
Package otto is a JavaScript parser and interpreter written natively in Go.
Package otto is a JavaScript parser and interpreter written natively in Go.
Godeps/_workspace/src/github.com/robertkrimen/otto/ast
Package ast declares types representing a JavaScript AST.
Package ast declares types representing a JavaScript AST.
Godeps/_workspace/src/github.com/robertkrimen/otto/dbg
Package dbg is a println/printf/log-debugging utility library.
Package dbg is a println/printf/log-debugging utility library.
Godeps/_workspace/src/github.com/robertkrimen/otto/file
Package file encapsulates the file abstractions used by the ast & parser.
Package file encapsulates the file abstractions used by the ast & parser.
Godeps/_workspace/src/github.com/robertkrimen/otto/parser
Package parser implements a parser for JavaScript.
Package parser implements a parser for JavaScript.
Godeps/_workspace/src/github.com/robertkrimen/otto/registry
Package registry is an expirmental package to facillitate altering the otto runtime via import.
Package registry is an expirmental package to facillitate altering the otto runtime via import.
Godeps/_workspace/src/github.com/robertkrimen/otto/terst
Package terst is a terse (terst = test + terse), easy-to-use testing library for Go.
Package terst is a terse (terst = test + terse), easy-to-use testing library for Go.
Godeps/_workspace/src/github.com/robertkrimen/otto/token
Package token defines constants representing the lexical tokens of JavaScript (ECMA5).
Package token defines constants representing the lexical tokens of JavaScript (ECMA5).
Godeps/_workspace/src/github.com/robertkrimen/otto/underscore
Package underscore contains the source for the JavaScript utility-belt library.
Package underscore contains the source for the JavaScript utility-belt library.
Godeps/_workspace/src/github.com/shiena/ansicolor
Package ansicolor provides color console in Windows as ANSICON.
Package ansicolor provides color console in Windows as ANSICON.
Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor
The ansicolor command colors a console text by ANSI escape sequence like wac.
The ansicolor command colors a console text by ANSI escape sequence like wac.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb
Package leveldb provides implementation of LevelDB key/value database.
Package leveldb provides implementation of LevelDB key/value database.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/cache
Package cache provides interface and implementation of a cache algorithms.
Package cache provides interface and implementation of a cache algorithms.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer
Package comparer provides interface and implementation for ordering sets of data.
Package comparer provides interface and implementation for ordering sets of data.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/errors
Package errors provides common error types used throughout leveldb.
Package errors provides common error types used throughout leveldb.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter
Package filter provides interface and implementation of probabilistic data structure.
Package filter provides interface and implementation of probabilistic data structure.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator
Package iterator provides interface and implementation to traverse over contents of a database.
Package iterator provides interface and implementation to traverse over contents of a database.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/journal
Package journal reads and writes sequences of journals.
Package journal reads and writes sequences of journals.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/memdb
Package memdb provides in-memory key/value database implementation.
Package memdb provides in-memory key/value database implementation.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/opt
Package opt provides sets of options used by LevelDB.
Package opt provides sets of options used by LevelDB.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage
Package storage provides storage abstraction for LevelDB.
Package storage provides storage abstraction for LevelDB.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table
Package table allows read and write sorted key/value.
Package table allows read and write sorted key/value.
Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util
Package util provides utilities used throughout leveldb.
Package util provides utilities used throughout leveldb.
Godeps/_workspace/src/github.com/syndtr/gosnappy/snappy
Package snappy implements the snappy block-based compression format.
Package snappy implements the snappy block-based compression format.
Godeps/_workspace/src/golang.org/x/crypto/pbkdf2
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
Godeps/_workspace/src/golang.org/x/crypto/ripemd160
Package ripemd160 implements the RIPEMD-160 hash algorithm.
Package ripemd160 implements the RIPEMD-160 hash algorithm.
Godeps/_workspace/src/golang.org/x/crypto/scrypt
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf).
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf).
Godeps/_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Godeps/_workspace/src/golang.org/x/net/context/ctxhttp
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
Godeps/_workspace/src/golang.org/x/net/html
Package html implements an HTML5-compliant tokenizer and parser.
Package html implements an HTML5-compliant tokenizer and parser.
Godeps/_workspace/src/golang.org/x/net/html/atom
Package atom provides integer codes (also known as atoms) for a fixed set of frequently occurring HTML strings: tag names and attribute keys such as "p" and "id".
Package atom provides integer codes (also known as atoms) for a fixed set of frequently occurring HTML strings: tag names and attribute keys such as "p" and "id".
Godeps/_workspace/src/golang.org/x/net/html/charset
Package charset provides common text encodings for HTML documents.
Package charset provides common text encodings for HTML documents.
Godeps/_workspace/src/golang.org/x/net/websocket
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
Godeps/_workspace/src/golang.org/x/text/encoding
Package encoding defines an interface for character encodings, such as Shift JIS and Windows 1252, that can convert to and from UTF-8.
Package encoding defines an interface for character encodings, such as Shift JIS and Windows 1252, that can convert to and from UTF-8.
Godeps/_workspace/src/golang.org/x/text/encoding/charmap
Package charmap provides simple character encodings such as IBM Code Page 437 and Windows 1252.
Package charmap provides simple character encodings such as IBM Code Page 437 and Windows 1252.
Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex
Package htmlindex maps character set encoding names to Encodings as recommended by the W3C for use in HTML 5.
Package htmlindex maps character set encoding names to Encodings as recommended by the W3C for use in HTML 5.
Godeps/_workspace/src/golang.org/x/text/encoding/ianaindex
Package ianaindex maps names to Encodings as specified by the IANA registry.
Package ianaindex maps names to Encodings as specified by the IANA registry.
Godeps/_workspace/src/golang.org/x/text/encoding/internal
Package internal contains code that is shared among encoding implementations.
Package internal contains code that is shared among encoding implementations.
Godeps/_workspace/src/golang.org/x/text/encoding/internal/identifier
Package identifier defines the contract between implementations of Encoding and Index by defining identifiers that uniquely identify standardized coded character sets (CCS) and character encoding schemes (CES), which we will together refer to as encodings, for which Encoding implementations provide converters to and from UTF-8.
Package identifier defines the contract between implementations of Encoding and Index by defining identifiers that uniquely identify standardized coded character sets (CCS) and character encoding schemes (CES), which we will together refer to as encodings, for which Encoding implementations provide converters to and from UTF-8.
Godeps/_workspace/src/golang.org/x/text/encoding/japanese
Package japanese provides Japanese encodings such as EUC-JP and Shift JIS.
Package japanese provides Japanese encodings such as EUC-JP and Shift JIS.
Godeps/_workspace/src/golang.org/x/text/encoding/korean
Package korean provides Korean encodings such as EUC-KR.
Package korean provides Korean encodings such as EUC-KR.
Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese
Package simplifiedchinese provides Simplified Chinese encodings such as GBK.
Package simplifiedchinese provides Simplified Chinese encodings such as GBK.
Godeps/_workspace/src/golang.org/x/text/encoding/traditionalchinese
Package traditionalchinese provides Traditional Chinese encodings such as Big5.
Package traditionalchinese provides Traditional Chinese encodings such as Big5.
Godeps/_workspace/src/golang.org/x/text/encoding/unicode
Package unicode provides Unicode encodings such as UTF-16.
Package unicode provides Unicode encodings such as UTF-16.
Godeps/_workspace/src/golang.org/x/text/transform
Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
Godeps/_workspace/src/gopkg.in/fatih/set.v0
Package set provides both threadsafe and non-threadsafe implementations of a generic set data structure.
Package set provides both threadsafe and non-threadsafe implementations of a generic set data structure.
Godeps/_workspace/src/gopkg.in/inconshreveable/log15.v2
Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable.
Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable.
Godeps/_workspace/src/gopkg.in/inconshreveable/log15.v2/stack
Package stack implements utilities to capture, manipulate, and format call stacks.
Package stack implements utilities to capture, manipulate, and format call stacks.
Godeps/_workspace/src/gopkg.in/karalabe/cookiejar.v2/collections/prque
Package prque implements a priority queue data structure supporting arbitrary value types and float priorities.
Package prque implements a priority queue data structure supporting arbitrary value types and float priorities.
geth
Package geth implements the wrapper around to go-ethereum client
Package geth implements the wrapper around to go-ethereum client
proxy
Package proxy implements the HTTP payment proxy between a locally exposed endpoint and the public internet.
Package proxy implements the HTTP payment proxy between a locally exposed endpoint and the public internet.
Package faucet implements an Ethereum test network account faucet.
Package faucet implements an Ethereum test network account faucet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL