Miami Bitcoin Hackathonで優勝した"OpiDoki"について(1/3)
はじめに
1/9〜1/11にMiami Bitcoin Hackathonが開催され、Counterparty を利用したWebアプリ"OpiDoki"を作成したChrisとArianのチームが優勝しました。今回は"OpiDoki"について書きます。
目次
OpiDokiとは
Chris(CounterpartyのCommunity Director)の説明によると、OpiDokiは"truth"をブロードキャストすることによる"Oracle Programming Interface"とのことです... よく分かりませんが、Smart ContractsまたはCounterpatyのbettingに近いものを想像します。動画がありますので貼ります。
どういう問題を解決するアプリなのか。なぜJavascriptを添付する必要があるのか。疑問がたくさんですがgithubにあるソースコードを読んでみます。
OpiDoki内で使っているCounterpartyd API
使われているCounterpartyd APIとBitcoind APIを見ることで、アプリの機能がだいたい見えてきます。
Gemfileを見るとCounterpatydとの連携に前回記事にした"counterparty_ruby"が利用されています。
gem 'counterparty_ruby', :git => 'https://github.com/brighton36/counterparty_ruby'
使用しているCounterpartydのAPIは"Broadcast"のOPENとCloseのみです。
pubkey = bitcoin_client.validateaddress(self.btc_public_address)['pubkey'] self.btc_open_txid = Counterparty::Broadcast.new( source: self.btc_public_address, value: Counterparty::Broadcast::OPEN_BROADCAST, timestamp: Time.now.to_i, text: self.short_label, fee_fraction: 0.00, pubkey: pubkey, allow_unconfirmed_inputs: true ).save!
pubkey = bitcoin_client.validateaddress(self.btc_public_address)['pubkey'] self.btc_close_txid = Counterparty::Broadcast.new( source: self.btc_public_address, value: self.execution_return, timestamp: Time.now.to_i, fee_fraction: 0.00, text: self.short_label, pubkey: pubkey, allow_unconfirmed_inputs: true ).save!
OpiDoki内で使っているBitcoind API
Bitcoind APIは以下3種類使用されています。
// 受け取ったビットコインの残高 def getreceivedbyaddress(addr, confirmations) request 'getreceivedbyaddress', addr, confirmations end // 新規ビットコインアドレス作成 def getnewaddress request 'getnewaddress' end // pubkey取得 def validateaddress(address) request 'validateaddress', address end
まとめ
今回は"OpiDoki"をざっくり見ましたが、次回は実際にRailsアプリケーションを起動してより深く調べてみます。
それにしても..マイアミ行きたい.. WWDC、Google I/O、CES and Bitcoin Foundation主催のカンファレンス。行きたい場所がたくさんある。
参考
http://miamibitcoinhackathon.com/
Counterparty Community Update, Jan 14: Hackathon Win, Counterwallet FAQ, Dev Updates & More
ビットコインアプリのハッカソン開催! ニューヨークでの別のハッカソンです。
Bitcoin App Hackathon @ LUXSTACK 表参道で1/21に開催予定。参加したいけど...