Skip to content

Instantly share code, notes, and snippets.

@charleyhine
Created June 19, 2014 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charleyhine/0dd1a7504c00b121de74 to your computer and use it in GitHub Desktop.
Save charleyhine/0dd1a7504c00b121de74 to your computer and use it in GitHub Desktop.
Chain | Address Transactions (Ruby)
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)
# Headers
request.basic_auth("GUEST-TOKEN", "")
# Send synchronously
response = http.request(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment