Skip to content

Instantly share code, notes, and snippets.

@tristanperalta
Last active August 29, 2015 13:56
Show Gist options
  • Save tristanperalta/9168118 to your computer and use it in GitHub Desktop.
Save tristanperalta/9168118 to your computer and use it in GitHub Desktop.
Bitcoin Publisher
require 'eventmachine'
require 'amqp'
require 'bitcoin-client'
txn_id = ARGS[0]
client = Bitcoin::Client.new(blah)
wallet_address = client.get_wallet_address(txn_id)
EM.run do
AMQP.connect(host: 'localhost') do |connection|
channel = connection.channel
exchange = channel.fanout
exchange.publish("bitcoin.#{wallet_address}")
# close EventMachine connection here
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment