https://api.chain.com/v1/payments
{
"block_chain": "bitcoin",
"destination_address": "1dk2l...",
"webhook_url": "http://coinsafe.com/chain/random_id_here/",
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Bitcoin API - Chain</title> | |
<link rel='shortcut icon' type='image/x-icon' href='/chain32x32.ico' /> | |
<link rel='shortcut icon' type='image/x-icon' href='/chain16x16.ico' /> | |
<meta name="description" content="Chain is a powerful block chain API that makes it easy to build Bitcoin applications."> | |
<!--facebook meta tags--> |
https://api.chain.com/v1/payments
{
"block_chain": "bitcoin",
"destination_address": "1dk2l...",
"webhook_url": "http://coinsafe.com/chain/random_id_here/",
Verifying that +charley is my Bitcoin username. You can send me #bitcoin here: https://onename.io/charley |
class HomeController < ApplicationController | |
def callback | |
puts request.body.read | |
respond_to do |format| | |
format.all { render text: request.body.read } | |
end | |
end | |
end |
class HomeController < ApplicationController | |
skip_before_filter :verify_authenticity_token, only: [:callback] | |
def register_callback | |
register_url = 'https://api.chain.com/v1/webhooks?key=GUEST-TOKEN' | |
callback_url = 'http://chain-hooks.herokuapp.com/callback' | |
callback_alias = 'charley' | |
response = HTTParty.post(register_url, | |
body: { url: callback_url, |
{ | |
"hash": "1Bj5UVzWQ84iBCUiy5eQ1NEfWfJ4a3yKG1", | |
"balance": 31330001, | |
"received": 1032680001, | |
"sent": 1001350000, | |
"unconfirmed_received": 13600000, | |
"unconfirmed_sent": 13630000, | |
"unconfirmed_balance": -30000 | |
} |
require 'chain' | |
response = Chain.get_transaction_op_return('8bae12b5f4c088d940733dcd1455efc6a3a69cf9340e17a981286d3778615684') | |
p response['text'] | |
=> "charley loves heidi" |
require 'open-uri' | |
require 'JSON' | |
require 'digest/sha2' | |
require 'bigdecimal' | |
require 'bitcoin' | |
SATOSHI_PER_BITCOIN = BigDecimal.new("100000000") | |
#################### |
require 'uri' | |
require 'net/http' | |
# Request: My API (http://api.chain.com/v1/bitcoin/addresses/1CbC9CrmxoZAzHu16ccQsBGMNZbCZ3xAUc/transactions?limit=50) | |
uri = URI.parse("http://api.chain.com/v1/bitcoin/addresses/1CbC9CrmxoZAzHu16ccQsBGMNZbCZ3xAUc/transactions?limit=50") | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.read_timeout = 30 | |
request = Net::HTTP::Get.new(uri.request_uri) |
### Keybase proof | |
I hereby claim: | |
* I am charleyhine on github. | |
* I am charley (https://keybase.io/charley) on keybase. | |
* I have a public key whose fingerprint is BB73 60F9 53BB D92E 48F9 AFEA 03E8 8F10 5CCC FCB4 | |
To claim this, I am signing this object: |