dartsv: ^0.4.2 copied to clipboard
Dart Library for interacting with the Bitcoin network. This library is especially well-suited for use in developing Flutter applications.
This library therefore lacks , and will not implement :
- Segregated Witness (Segwit) Transaction support
- Schnorr Signature support
- Check Datasig (OP_CHECKDATASIG)
Current Supported features are :
- P2PKH Transactions
- P2SH Transactions
- P2MS Transactions (naked multisig)
- P2PK Transactions
- Custom-Script Builder Interface to support novel locking/spending conditions within Script
- Data-only Transactions
- HD Key Derivation (BIP32)
- Original Bitcoin Address format
- Bitcoin Signed Messages
- Mnemonic Seed Support (BIP39)
- A built-in Bitcoin Script Interpreter
- ECIES Encryption / Decryption (Supports Electrum ECIES / BIE1 )
Sample of the Transaction API:
var unlockBuilder = P2PKHUnlockBuilder(privateKey.publicKey); var transaction = new Transaction() .spendFromOutput(utxo, Transaction.NLOCKTIME_MAX_VALUE, scriptBuilder: unlockBuilder) .spendTo(recipientAddress, BigInt.from(50000000), scriptBuilder: P2PKHLockBuilder(recipientAddress)) .sendChangeTo(changeAddress, scriptBuilder: P2PKHLockBuilder(changeAddress)) .withFeePerKb(1000); //Sign the Transaction Input transaction.signInput(0, privateKey, sighashType: SighashType.SIGHASH_ALL | SighashType.SIGHASH_FORKID);
This library was built using version (2.8.2) of the Dart SDK https://dart.dev/tools/sdk, but should work with Dart SDK 2.1.x onwards.
Therefore, as a pre-requisite ensure that you have at least that version of the Dart SDK installed before proceeding.
Navigate to the root folder of this project, and pull the required supported Dart libraries using the
pub package manager.
> pub get
Running the Tests #
In the root folder of this project, run the command:
> pub run test
A debt of gratitude is owed to the developers acknowledged in the LICENSE file. Without the hard work of individuals working on earlier library and node implementations like Bitcoin Core, Bitcoin Cash, MoneyButton/BSV, BitcoinJ and many more, this library would likely not have come to fruition. Thank you.
You can reach the author at :
- @beardpappa on Twitter
- email@example.com (PayMail to buy me a beer)