In this article I'm going to go over recent updates to the Bitcoin Cash Java library bitcoincashj. There's been a lot of exciting updates to it since I last talked about it!
First off, I have fixed a bug with SLP transaction building. There was a bug for a short while where no outputs were created in a transaction besides the OP_RETURN. The cause of this bug was due to the addOutput calls being commented out during the major refactor of bitcoincashj where I pulled upstream fixes/changes from bitcoinj into bitcoincashj and had to rewrite a lot of stuff.
I guess that leads me to the next change: There has been a MAJOR refactor of bitcoincashj. Previously, it had not fetched upstream for fixes/changes in bitcoinj in nearly two years. Now it is mostly up-to-date with bitcoinj in terms of security improvements, bug fixes, and general improvements.
Another big addition is the Simple Ledger Payment Protocol, also known as BIP70 SLP. This was added in so Crescent Cash would be able to pay invoices on tipbitcoin.cash, since tipbitcoin.cash now uses BIP70 for both BCH and SLP. The only other wallet to support this at the moment is Badger Wallet, but there is an update coming out soon to Electron Cash SLP that adds BIP70 SLP support.
Download Crescent Cash and try out tipping on tipbitcoin.cash!
And finally, bitcoincashj now has support for OP_CHECKDATASIG and OP_REVERSEBYTES.
The OP_CHECKDATASIG code was not written by me, however. There existed another fork of bitcoincashj that a couple other people had started, but it quickly died out. They added OP_CHECKDATASIG support, so I merged their changes into my fork of bitcoincashj. The original fork that had OP_CHECKDATASIG is https://github.com/blocksy-net/bitcoincashj
I recently added support for the new OP_REVERSEBYTES opcode. You can see tests here: https://github.com/pokkst/bitcoincashj/blob/master/core/src/test/java/org/bitcoinj/script/ScriptReverseBytesTest.java
This is a very simple opcode. It takes the bytes of the previous item in the stack and... reverses them. The example tests scripts are OP_DUP OP_REVERSEBYTES OP_EQUAL, to see if the test string is the same both backwards and forwards.
This is also the same script Tobias Ruck used in his example OP_REVERSEBYTES P2SH address. (bitcoincash:prh3syz7kke338qvr7gutjwps2ka6uczrqcmup4p2m)
An example spend transaction is also in the ScriptReverseBytesTest.java linked above. Here is a transaction spending from that P2SH address, using the test from above: 4dc3bbcc00fe2a453389e9e0b38fc803b2a2e6e17d60915c92ba1dfffee7b9e1
This about concludes all the recent updates to bitcoincashj. There are some minor bug fixes here and there, but those aren't really worth mentioning since they're minor.
Thank you for reading!