For 10 months I have been maintaining the Java BCH library, bitcoincashj. Here's what has changed!

10 651
Avatar for pokkst
Written by
  64
2 months ago

I like Java for programming. For me, it's easy to develop quick prototypes for. It's also the language used for Android apps. Because of this, I liked using bitcoinj when developing BTC applications back in the day.

In March of 2019 I switched to Bitcoin Cash. You can read about that here: https://pokkst.xyz/bch/

Since I wanted to port my existing apps over to Bitcoin Cash, I needed an active bitcoinj library for Bitcoin Cash. I looked at http://bitcoinj.cash but by the time I moved to Bitcoin Cash, the maintainer for this fork moved to BSV.

It had what I needed, but there were a few issues with it. It did not support the latest upgrades to the protocol. It also had some outdated DNS seeds as seen here: https://github.com/bitcoinj-cash/bitcoinj/blob/cash-0.14/core/src/main/java/org/bitcoinj/params/MainNetParams.java#L76

Due to a protocol upgrade after the previous maintainer stopped supporting BCH, SPV wallets built on top of bitcoincashj had some issues at times due to CTOR.

So, I and another dude by the name of ProtocolCash began work on a CTOR-compatible fork of bitcoinj.cash. He did most of the work, but later I found more issues with his implementation, so I tweaked his algorithm a bit and implemented it into more places within the bitcoincashj system, and now it's working flawlessly (as far as I know).

During this time, I began work on getting other portions up-to-date. Originally, bitcoinj.cash (and bitcoinj) used derivation path m/0'. This is not the current standard for coin derivation paths, so I began work on changing this to the standard BCH derivation path m/44'/145'/0' (https://github.com/pokkst/bitcoincashj/commit/a07d9e9d6a904bc1e33a5c78ac7e4bca59c8278c, ignore the file perm fuckup)

Next, I implemented Cash Account sending support in SendRequest.java. This allows for any app built on top of bitcoincashj to be able to natively send to Cash Account users.

Later on, I implemented the up-to-date checkpoint list (at the time) and implemented native Cash Account registration. (https://github.com/pokkst/bitcoincashj/commit/d84b25c954aaaf6e949ceb370788f6c8aa726d87). I then simplified it and fixed an issue with the OP_RETURN (https://github.com/pokkst/bitcoincashj/commit/df1b032607898552087d92616a018fca205bb634).

I then added UTXO management in SendRequest so wallets can specify which of their UTXOs to spend! (https://github.com/pokkst/bitcoincashj/commit/e148c9549e3288ddf94e699b9d9926c4e9bed548)

Then here is the fun part and the most recent feature to be implemented into bitcoincashj: the Simple Ledger Protocol! The initial commit is here: https://github.com/pokkst/bitcoincashj/commit/df5cec966db3968ab896f637208a9e1169de904d

You can read an in-depth explanation of how I got SLP working in bitcoincashj here: https://read.cash/@pokkst/bitcoincashj-and-slp-integration-3f7803a0

With all of these changes, my version of bitcoincashj has:

  • CTOR support

  • 32MB block support

  • Native Cash Account integration (trustless registration and sending)

  • SLP tokens

  • Standard BIP44 derivation (m/44'/145'/0' for BCH, m/44'/245'/0' for SLP)

  • UTXO management when sending coins using SendRequest.utxos

  • Up-to-date hardfork checkpoints

I do not intend to stop maintaining this fork, but it is very tiring work to make sure it stays up-to-date, so I've added an address to the README.md that you can donate to help me keep going:

bitcoincash:qptnypuugy29lttleggl7l0vpls0vg295q9nsavw6g

I hope you enjoyed reading this,

pokkst

$ 302.76
$ 150.00 from @molecular
$ 50.00 from @im_uname
$ 37.00 from @MarcDeMesel
+ 21
Avatar for pokkst
Written by
  64
2 months ago
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.

Comments

Good evening friend, your post has been selected to be translated to the community in Spanish. Congratulations

https://read.cash/@Spanish-translator-community/durante-10-meses-he-mantenido-la-biblioteca-java-bch-bitcoincashj-by-at-pokkst-b818e1c0

$ 0.00
2 months ago

thanks for your work bro

$ 0.00
2 months ago

thanks a lot! you are great!

why not publish the full donation address here?

edit: I can't find donation address in readme.md. am I being blind?

$ 0.00
2 months ago

"why not publish the full donation address here?"

I did :P

"edit: I can't find donation address in readme.md. am I being blind?"

At the bottom.

$ 0.00
2 months ago

I did :P

Ah, it was shortened on my phone with "..." added.

k, thanks

$ 0.00
2 months ago

Yeah, on mobile it for some reason cuts off the address. On desktop the address is fully visible. Not sure if mentions work here but @Read.Cash you might want to take a look.

$ 0.00
2 months ago

Thank you for your work pokkst, it's much appreciated!

$ 0.00
2 months ago

Do you believe that the funding for this work should come from holders, miners or people using this library? If all three then in which order?

$ 0.05
2 months ago

Voluntarily from anyone.

$ 6.00
2 months ago

Thanks for everything

$ 0.00
2 months ago
About us Rules What is Bitcoin Cash? Roadmap Affiliate program Get sponsored Self-host
hello@read.cash (PGP key) Reddit