DartSV는 비트코인 네트워크와 상호 작용하기 위해 설계된 Dart 라이브러리로, 개발자가 비트코인 기능을 갖춘 애플리케이션을 구축할 수 있도록 도구를 제공합니다. Flutter 프로젝트에 최적화되어 있으며, 안드로이드, iOS, macOS, Windows 및 리눅스 플랫폼에서 원활한 통합을 가능하게 합니다. 주소 생성, 거래 생성, 암호화 기능과 같은 핵심 비트코인 작업을 지원하여 블록체인 기반 앱 개발에 이상적입니다. 가벼운 설계와 크로스플랫폼 호환성에 중점을 두어 네이티브 코드 없이도 비트코인 통합을 간편하게 만듭니다. 오픈소스 성격은 커뮤니티 기여와 투명성을 장려합니다.
사용 사례
비트코인 지갑 만들기
블록체인 탐색기 만들기
비트코인 결제 통합
탈중앙화 앱 개발
비트코인 거래 처리
주요 기능
비트코인 주소 생성
트랜잭션 서명 및 직렬화
암호화 유틸리티
크로스 플랫폼 지원
오픈소스이며 지속적으로 유지 관리되고 있습니다
적합한 대상
Flutter 개발자
웹3 애플리케이션 제작자
암호화폐 중심 모바일 앱
블록체인 초보자
비트코인 프로토콜 애호가
고려 사항
비트코인 기본 사항을 이해해야 합니다
비트코인 전용 기능에 한정
완전한 기능을 위해 외부 비트코인 노드에 의존합니다
고빈도 거래에 적합하지 않습니다
보안 키 관리 관행과 함께 사용하는 것이 가장 좋습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Introduction
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)
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 broadcasttry {
transaction.verify(); //perform a pre-broadcast sanity check on the transaction
} onVerificationExceptioncatch (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. )