自宅フルノードからOP_RETURN送信

Screenshot of blockchair.com

自分でOP_RETURNつきのトランザクションを作成し、自分で送信する。

一般的でないことは分かっておりますが、意外に簡単に送信できてしまいましたので、やり方を書いておきます。今回は、トランザクションの作成&署名も自宅PCのローカルSSD内のjavascriptで行いましたし、送信も自宅PCのフルノードbitcoind から直接行いましたので、「自分の手で直接ビットコインのブロックチェーンに文字列を刻み付けた」という感じが致します。厳密にいうとcoinb.inを使っているので外部コンピューターも利用していることにはなりますが、自力でやってる感覚は味わえます。

報酬が15satoshi/vbyte、総額2000satoshi、約120円なので承認されるまで数日掛かるとは思います。

用意するもの:

インターネット接続=うちはフレッツ光、HGWはPR-S300NEです。IPV6のフィルタを外してビットコインで使うポート番号8333を開放しておきます。

ウインドウズPC=普通のウインドウズ10です。ウインドウズ用のビットコインコアをインストールしておきます。設定画面で、「システムの起動時にbitcoincoreを起動する」を選択し、「ブロックの保存容量を次の値まで剪定する」で1GBに削減するのがお勧めです。インストール直後からIBDと言ってブロックチェーンの検証およびダウンロードを行いますが、通常1週間以内に終了します。

coinb.in=https://github.com/OutCast3k/coinbin/archive/master.zipをダウンロードして適当なフォルダに展開しておく。

やりかた:

  1. SSDに保存したcoinb.in のフォルダを開き、index.html をクリックすると、ブラウザが起動する。
  2. SSD内のcoinb.in を使ってトランザクションを作成して署名する。署名済みのトランザクションを保存する。
  3. ビットコインコアを開いて、ノードウインドウのコンソールから、sendrawtransaction “signedhex”と入力してエンターキーを押す。コマンドラインであれば、bitcoin-cli sendrawtransaction “signedhex”となります。signedhex は上記2で取得した署名済みトランザクションです。

引用:bitcoin-cli help sendrawtransaction

sendrawtransaction “hexstring” ( maxfeerate )

Submit a raw transaction (serialized, hex-encoded) to local node and network.

Note that the transaction will be sent unconditionally to all peers, so using this for manual rebroadcast may degrade privacy by leaking the transaction’s origin, as nodes will normally not rebroadcast non-wallet transactions already in their mempool.

Also see createrawtransaction and signrawtransactionwithkey calls.

Arguments:
1. hexstring (string, required) The hex string of the raw transaction
2. maxfeerate (numeric or string, optional, default=0.10) Reject transactions whose fee rate is higher than the specified value, expressed in BTC/kB.
Set to 0 to accept any fee rate.

Result:
“hex” (string) The transaction hash in hex

Examples:

Create a transaction
> bitcoin-cli createrawtransaction “[{\”txid\” : \”mytxid\”,\”vout\”:0}]” “{\”myaddress\”:0.01}”
Sign the transaction, and get back the hex
> bitcoin-cli signrawtransactionwithwallet “myhex”

Send the transaction (signed hex)
> bitcoin-cli sendrawtransaction “signedhex”

As a JSON-RPC call
> curl –user myusername –data-binary ‘{“jsonrpc”: “1.0”, “id”: “curltest”, “method”: “sendrawtransaction”, “params”: [“signedhex”]}’ -H ‘content-type: text/plain;’ http://127.0.0.1:8332/

感想:

ビットコインネットワークに自力で直接書き込みできたことはちょっと感動です。Decentralized_computingと言いますが、実際にやってみると、本当にどこのサーバーにも接続することなく、データを保存できていることになります。しいて言えば自分のPCが巨大なサーバーの一部として稼働したことになります。そのようにしてビットコインネットワークは動いているのだなあと実感できました。


投稿日

カテゴリー:

投稿者:

タグ:

コメント

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です