Fork me on GitHub
Peddle is an API for your Bitcoin e-wallet with a finagle backend. With it you can create bitcoin accounts, make and receive transactions, and transfer funds all from a centralized server of your choosing. You could even, if you choose, create e-wallets for other people and start your own e-wallet provider. Peddle puts a nicer front-end on bitcoind's built in json-rpc.

API Reference

The Peddle API is built around the REST architectural framework. Deploying Peddle makes available an api endpoint where you can issue GET and POST requests to update your e-wallet. All responses will be JSON-formatted, convential HTTP response codes are used. Currently there is no user authentication.

HTTP Status Codes

200 OK: total success!

400 Bad Request: param missing

401 Unauthorized: insufficient funds in account

404 Not Found: requested uri doesn't exist.

500, 502, 503, 504 Internal Server Error: something wrong server side

Creating a new account

To create a new account you send along an account name. That's it! This returns an echo of the account you created.
id
required string. Name of the account

Definition

POST /accounts

Request

$ curl http://{SERVER_HOST}:{SERVER_PORT}/accounts \ -d "id=oliverj"

Response

{ "account" : "oliverj" }

Get a list of accounts

Retrieves a list of accounts in your wallet plus their current balances (with at least 0 confirmations)

Definition

GET /accounts

Request

$ curl http://{SERVER_HOST}:{SERVER_PORT}/accounts

Response

{ "accounts" : [ "oliverj":1.000000,   "jacoboliver":1.124124 ] }

Get the addresses for an account

Retrieves a list of addresses associated with an account. These addresses are where you receive your bitcoins. You can receive bitcoins outside of Peddle by giving this address to a buyer. The private key stays in your e-wallet (hopefully securely)

Definition

GET /accounts/{ACCOUNT_ID}/addresses

Request

$ curl http://{SERVER_HOST}:{SERVER_PORT}/accounts/oliverj/addresses

Response

{ "addresses" : [ "1FiKgTyvGaCS6KJAigx163sLrNkddDy2Bv",   "12Y7jU7AAREcSVp31HShFAmLTs4kT9nqBc",   "1Djek267TRNr5k56RCzCU7qTHsEsS34F3W" ] }

Get the transactions for an account

Retrieve a list of transactions for an account. A transaction hash can be inspected by an online blockchain explorer

Definition

GET /accounts/{ACCOUNT_ID}/transactions

Request

$ curl http://{SERVER_HOST}:{SERVER_PORT}/accounts/oliverj/transactions

Response

{ "transactions" : [ "0fd8036f156736f427232628528219b3bba6c433a4592b2aee9832386e3d4a1c",   "97c571902483363d30ca6897bd392a3b4fea93b31561fc4d9faacf3e61b63a1f" ] }

Send from an account to a Bitcoin address

Send from an account in this wallet to any bitcoin address. These transactions are non-reversible and can be considered confirmed after 6 blockchain confirmations. An error is returned for insufficient funds.
from
required string. Name of the account
to
required string. Address to send funds too
amount
required double. amount of bitcoins to send

Definition

POST /transactions

Request

$ curl http://{SERVER_HOST}:{SERVER_PORT}/transactions \ -d "from=oliverj" \ -d "to=1Djek267TRNr5k56RCzCU7qTHsEsS34F3W" \ -d "amount=0.004"

Response

{ "transaction" : "0fd8036f156736f427232628528219b3bba6c433a4592b2aee9832386e3d4a1c" }

Get the details of a transaction

You can get the details on a transaction. Details include date of transaction, confirmations, amount, and addresses involved.

Definition

GET /transactions/{TRANSACTION_ID}

Request

$ curl http://{HOST}:{PORT}/transactions/000d5176ac575830b55782ab8eef9e9bd9b92ad289724d5dd5f7e

Response

{ "amount":0.01243,   "confirmations":3,   "txid": "000d5176ac575830b55782ab8eef9e9bd9b92ad289724d5dd5f7e",   "details": {   "account":"oliverj",   "address":"1FiKgTyvGaCS6KJAigx163sLrNkddDy2Bv",   "category":"",   "amount":0.01243,   "fee":0.00001 } }

Transfer between wallet accounts

Send from an account in this wallet to any other account in this wallet. These transactions are immediate and irreversible. An error is returned for insufficient funds or if one of the accounts does not exist. Returns true on success (there is no transaction id for in-wallet balance transfers)
from
required string. Name of the account
to
required string. Account to send funds too
amount
required double. amount of bitcoins to send

Definition

POST /transactions

Request

$ curl http://{SERVER_HOST}:{SERVER_PORT}/transactions \ -d "from=oliverj" \ -d "to=jacoboliver" \ -d "amount=0.004"

Response

{ "result" : true }