搜尋套件、儲存庫與 APP 分類

套件詳情v3.1.3

dartsv

用於與比特幣網絡互動的Dart程式庫。此程式庫特別適合用於開發Flutter應用程式。

AndroidiOSmacOSWindowsLinux
近 30 天下載
1150
喜歡數
11
Pub 分數
120

安裝套件

flutter pub add dartsv

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

DartSV 是一個專為與比特幣網路互動而設計的 Dart 庫,為開發者提供建構比特幣應用的工具。它針對 Flutter 專案進行優化,可無縫整合至 Android、iOS、macOS、Windows 和 Linux 平台。該庫支援核心比特幣操作,如位址產生、交易建立和加密功能,非常適合區塊鏈應用開發。憑藉其輕量級設計及對跨平台相容性的關注,DartSV 簡化了比特幣整合,無需使用原生程式碼。其開源性質鼓勵社群貢獻並確保透明度。

適用情境

  • 建構比特幣錢包
  • 創建區塊鏈瀏覽器
  • 整合比特幣支付
  • 開發去中心化應用
  • 處理比特幣交易

主要特色

  • 比特幣位址產生
  • 交易簽名與序列化
  • 加密工具
  • 跨平台支援
  • 開源且持續維護

適合對象

  • Flutter 開發者
  • Web3 應用開發者
  • 專注於加密貨幣的行動應用程式
  • 區塊鏈初學者
  • 比特幣協議愛好者

使用建議

  • 需要理解比特幣基礎知識
  • 僅限比特幣特定功能
  • 依賴外部比特幣節點以實現完整功能
  • 不適用於高頻交易
  • 最佳搭配安全金鑰管理實務使用

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Introduction

Dart CI

Overview

TwoStack WalletSDK is a Bitcoin library for the Dart Language ( dartlang.org ), loosely based on the Moneybutton/BSV Javascript library. This library has been built in line with the ideals espoused by BitcoinSV, i.e. massive on-chain scaling, protocol stability and original-bitcoin-protocol implementation. It is intended for use in building multi-platform applications using the Flutter framework, or server-side bitcoin applications using frameworks like Serverpod

A note about Version 2.x (August 2023)

Version 2.x of the library is a major refactor and breaks backwards compatibility with several previous library APIs.

  • A new TransactionBuilder class for composing Transactions
  • Removal of the old Builder interface which was directly attached to the Transaction class
  • A complete re-implementation of the Script Interpreter
  • The Sighash class now exposes the SigHash Pre-Image; useful when creating OP_PUSH_TX spending scripts.
  • A new ScriptBuilder class to make it easy to create custom locking/unlocking scripts.
  • Merged contributed code to have better Flutter Web support.

Generally Supported features are :

  • Custom-Script Builder Interface to support novel locking/spending conditions within Script
  • Pre-built library code to support "standard" locking/unlocking scripts
    • P2PKH Transactions
    • P2SH Transactions
    • P2MS Transactions (naked multisig)
    • P2PK Transactions
    • Data-only Transactions (locked with OP_FALSE OP_RETURN)
    • Spendable data-carrier Transactions (locked with PUSH_DATA [your_data] OP_DROP [P2PKH locking code])
  • 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 utxo = txWithUTXO.outputs[0]; 
    var outpoint = TransactionOutpoint(txWithUTXO.id, 0, utxo.satoshis, utxo.script);
    var signer = TransactionSigner(SighashType.SIGHASH_FORKID.value | SighashType.SIGHASH_ALL.value, privateKey);

    var unlocker = P2PKHUnlockBuilder(privateKey.publicKey);
    
    var transaction = TransactionBuilder()
        .spendFromOutpointWithSigner(signer, outpoint, TransactionInput.MAX_SEQ_NUMBER, unlocker)
        .spendToPKH(recipientAddress, BigInt.from(50000000)) //spend half of a bitcoin 
        .sendChangeToPKH(changeAddress) // spend change to a different address
        .withFeePerKb(50) //set a fee of 50 satoshis per kilobyte
        .build(false); //build the transaction, disabling checks

    //at this point you have a fully signed transaction ready to be broadcast

    try {
      transaction.verify(); //perform a pre-broadcast sanity check on the transaction
    } on VerificationException catch (ex){
      print("Transaction failed verification - ${ex.cause}");  
    }

Installation

This library was built using version 3.0.7 of the Dart SDK( https://dart.dev/tools/sdk ).
As of Version 1.0.0 this library supports Dart Null Safety. Current minimum Dart SDK version required is version 2.17.0.

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

Acknowledgement

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.

Contact

You can reach the author at :

  • @twostack_org on Twitter
  • beardpappa@handcash.io (PayMail to buy me a beer)
  • stephan@twostack.org (drop me an email. GPG supported. )

所屬分類

依賴

依賴清單 8 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。