simple-bitcoin-wallet 0.0.6 supports OP_RETURNs

2019-01-07T22:50:46.000Z Honest Cash

We have just released a new version of the simple-bitcoin-wallet. Honest uses simple-bitcoin-wallet for every interaction with the Bitcoin Cash blockchain. simple-bitcoin-wallet is powered by Bitbox and Bitcoinfiles.

Motivation

The motivation behind the update is to blueprint every upvote transaction on Honest. It will allow the transaction to be traced back to the Honest network and to the post that had been upvoted. It will make the transaction more transparent and easier to follow for others.

It will also allow us to use transactions stored on bitcoin blockchain as a single source of truth for calculating the upvote count for a post. It will be a next step towards decentralization without compromising the user experience.

**Technical notes

**

What is OP_RETURN?

OP_RETURN allows developers to add a nonpayment data to a transaction output. Read more here:

https://developer.bitcoin.com/mastering-bitcoin-cash/4-transactions/#op_return

Sending OP_RETURN with simple-bitcoin-wallet

You can include any OP_RETURN data outputs to your receivers array when sending a transaction. The OP_RETURN data is included using an array of strings. The strings are UTF8 by default, but can be interpreted as hex by prepending the string with '0x'. This allows developers to use other applications with an OP_RETURN protocol, such as memo.cash.

Upvote transactions with OP_RETURNs

We could prefix upvote transactions with "0x48" (capital 'H' in utf8). Next, we should define all operations that we do on-chain, and what metadata we want to include. Some examples below:

| Operation | Prefix | Arguments |
| ------------ | ------ | ------------------------ |
| Upvote | 0x4801 | post id |
| Uncensorable | 0x4802 | post id, bitcoinfiles id |

Other changes

Adjusted UTXO ordering

We firstly select the smallest UTXO for transactions. It will keep the wallet "dust-free" and allow to still spend the biggest outputs (some wallets require confirmations before spending the coins).

Update of bitcoinfiles

We updated to a new bitcoinfiles version that supports custom injections of the BITBOX framework. We created a lightweight version of bitbox with only the necessary functionality for Honest to miminize the size of the application. With this update, we can utilize both libraries in a more efficient way.

Credits

This update has been implemented by Rosco Kalis (rkalis on Honest).

Start developing Bitcoin Cash applications

With simple-bitcoin-wallet, you can start developing directly in your browser without even running a Bitcoin node. Simple-bitcoin-wallet combines BITBOX and bitcoinfiles and gives you high-level functions for creating wallets and sending bitcoin around.

https://www.npmjs.com/package/simple-bitcoin-wallet

If you need any help or would like to give feedback, write us at info@honest.cash.

Responses