hxBitcoin is a new open source Bitcoin and cryptocurrency support library in the Haxe language.
The initial release has these features:
- BIP0038 (encrypted private keys), WIF, private & public keys, addresses, Base58
- scrypt, AES, SHA-1, SHA-256, RIPEMD160
- Elliptic curve arithmetic, secp256k1 & NIST curves
- Modular arithmetic (Fp), Arbitrary-size (big) integer, Unicode 7.0
and supports iOS, Windows, OSX, Flash, and NekoVM targets (additional targets are easy, just ask).
It’s a clean, simple API in pure Haxe with no additional or external dependencies.
Built in Haxe, hxBitcoin has extensive reach to enable applications on desktop, mobile, web, and server platforms, targeting C++, Java, JS, PHP, AS3 and more with a single code base.
It’s also backed by an extensive test suite of
over 22,000 individual tests and vectors to validate correct behavior on all supported platforms.
To start using, simply install the library via haxelib:
haxelib install hxBitcoin
Here’s an example of how to decrypt a BIP0038 private key:
import com.fundoware.engine.bitcoin.FunBitcoinContext;
import com.fundoware.engine.bitcoin.FunBitcoinEncryptedPrivateKey;
import com.fundoware.engine.bitcoin.FunBitcoinPrivateKey;
var context = new FunBitcoinContext();
var encryptedKey = FunBitcoinEncryptedPrivateKey.fromString(
context, "6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg");
var decryptedKey = encryptedKey.decryptString("TestingOneTwoThree");
encryptedKey.clear();
trace("private key (WIF) = " + decryptedKey.toWIF());
var address = decryptedKey.toAddress();
decryptedKey.clear();
trace("address = " + address);
Project website:
http://hxBitcoin.comProject on GitHub:
http://github.com/cbatson/hxBitcoinFeature requests welcome!