Skip to content

Cake update v15 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 71 commits into
base: cake-update-v9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
7a82c69
v4.8.0
mrtnetwork Oct 1, 2024
d42a8be
Update network_address.dart
mrtnetwork Oct 10, 2024
9bfdd2f
fix ElectrumEstimateFee
mrtnetwork Oct 10, 2024
a2edece
v4.9.0
mrtnetwork Oct 10, 2024
5c844ae
Adding Omni XEP support
sandrocsimas Oct 14, 2024
3b7db06
4.9.1
mrtnetwork Oct 16, 2024
3f25492
Merge branch 'mrtnetwork:main' into main
sandrocsimas Oct 18, 2024
81082e2
Small improvement
sandrocsimas Oct 18, 2024
eb3b8b6
Merge branch 'main' of github.com:sandrocsimas/bitcoin_base
sandrocsimas Oct 18, 2024
7929af9
fix empty segwit deserialization
mrtnetwork Oct 28, 2024
940518a
remove junk code
mrtnetwork Oct 28, 2024
bedd81e
feat: worker changes
Nov 5, 2024
49db574
chore: deps
Nov 5, 2024
0fab576
feat: new method strings
Nov 6, 2024
94770d9
Merge branch 'cake-update-v9' into cake-update-v15
OmarHatem28 Nov 6, 2024
1cf5abb
feat: ssl, historical mode
Nov 17, 2024
3be1d3c
V4.9.2
mrtnetwork Nov 17, 2024
89caf39
Update dependencies
mrtnetwork Nov 17, 2024
7b202b8
feat: fix disconnect & find unsupported methods
Nov 22, 2024
bff40ed
fix: electrum protocol version
Nov 24, 2024
82306ae
chore: intl dep
Nov 25, 2024
2715f57
Merging upstram into the branch
sandrocsimas Nov 29, 2024
997762f
Small fix in omnixep network description
sandrocsimas Nov 29, 2024
b1c3ebf
Small fix in omnixep network description
sandrocsimas Nov 29, 2024
1e1b0d4
Updating pubspec
sandrocsimas Nov 29, 2024
9e22e51
Support for uncompressed non-SegWit addresses
mrtnetwork Nov 30, 2024
01d915f
cleanup
mrtnetwork Nov 30, 2024
f9b8f24
fix large script serialization
mrtnetwork Dec 1, 2024
1bc4604
update networks
mrtnetwork Dec 2, 2024
0cbdfa0
Support electra protocol main and test net
sandrocsimas Dec 2, 2024
147ed34
Adding more supported addresses to XEP network
sandrocsimas Dec 3, 2024
eeb34b9
Merge branch 'mrtnetwork:main' into main
sandrocsimas Dec 3, 2024
1e0b51d
4.9.2
mrtnetwork Dec 4, 2024
8f13729
Update network.dart
mrtnetwork Dec 4, 2024
e850406
V4.9.3
mrtnetwork Dec 4, 2024
76deefa
update CHANGELOG
mrtnetwork Dec 4, 2024
f451e9c
Merge pull request #11 from sandrocsimas/main
mrtnetwork Dec 4, 2024
7fbb468
Merge branch 'dart_v2_final'
mrtnetwork Dec 4, 2024
5282dee
feat: api config, misc
Dec 20, 2024
5edcb1d
feat: review comment, fee estimation
Dec 26, 2024
ebee34c
refactor: reviews
Dec 27, 2024
f7ba439
chore: misc
Dec 27, 2024
78719a8
V5.0.0
mrtnetwork Jan 2, 2025
b619640
V5.0.0
mrtnetwork Jan 2, 2025
98825f1
refactor: misc, typos, and fix electrum getFees
Jan 8, 2025
7bd166a
merge from mrtnetwork/bitcoin_base
Jan 9, 2025
10bb92c
feat: misc
Jan 14, 2025
161a143
feat: batch requests
Jan 15, 2025
5133561
feat(batch): allow finding params by request id
Jan 16, 2025
dbded1a
feat(util): getKeyNetVersion
Jan 21, 2025
db0856e
feat: support batch subscription
Jan 22, 2025
049a1cc
v5.1.0
mrtnetwork Jan 23, 2025
f205495
update lints
mrtnetwork Jan 23, 2025
c34df96
feat: derivation from address, electrum send error on batch request o…
Jan 24, 2025
5a5db6f
V5.2.0
mrtnetwork Feb 6, 2025
1dc04cd
feat: ltc mweb deriv
Feb 14, 2025
87da254
fix: wrong script type
Feb 14, 2025
941ac9a
V5.3.0
mrtnetwork Feb 18, 2025
a53b3b3
feat: bch derivations
Feb 18, 2025
aaf1bb6
feat: mweb estimate
Mar 10, 2025
eecc27c
fix: missing script cast
Mar 11, 2025
0f4bfb7
Merge remote-tracking branch 'master/main' into cake-update-v15
Mar 12, 2025
5d36e48
V6.0.0
mrtnetwork Mar 25, 2025
2f3b17a
Update README.md
mrtnetwork Mar 25, 2025
47386f2
Update README.md
mrtnetwork Mar 25, 2025
8343c88
remove junks
mrtnetwork Mar 25, 2025
267cd41
V6.1.0
mrtnetwork Mar 28, 2025
4f23c0b
Merge remote-tracking branch 'master/main' into cake-update-v15
Apr 10, 2025
fca9a4b
fix: UtxoWithAddress unnamed constructor
Apr 10, 2025
1a74961
feat: pass network to getDerivationFromType
Apr 18, 2025
2916073
feat: add p2sp to getDerivationFromType
Apr 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ migrate_working_dir/
.packages
build/
*.zip
/example/test
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
## 6.1.0

- Fix der signature validation.

## 6.0.0

- Added support for BIP-327: MuSig2 for BIP340-compatible multi-signatures
- Implemented BIP-174: Partially Signed Bitcoin Transaction (PSBT) format
- Integrated BIP-370: PSBT Version 2 enhancements
- Included BIP-371: Taproot fields for PSBT
- Extended support for BIP-373: MuSig2-related PSBT fields

## 5.3.0

* Update dependencies

## 5.2.0

* Update dependencies

## 5.1.0

* Update dependencies

## 5.0.0

* Update dependencies
* Minimum required Dart SDK version updated to 3.3.

## 4.9.4

* Improved serialization process for large transaction scripts.
* Added support for the Electra network.
* Create and spent from uncompressed public key format.
* Important Notice: This is the final version supporting Dart v2. The next release will require Dart v3.3 or higher.

## 4.9.2

* Update dependencies
* Resolved issue with transaction deserialization (unsigned tx)

## 4.9.1

* Resolved issue with transaction deserialization (Issue #9)

## 4.9.0

* Correct Bitcoin address network configuration.
* Resolve issue with Electrum fee estimation results.


## 4.8.0

* Update dependencies

## 4.7.0

* Update dependencies
Expand Down
39 changes: 28 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ Using this package, you can create a Bitcoin transaction in two ways: either thr

- BitcoinTransactionBuilder: Even with limited prior knowledge, you can utilize this class to send various types of transactions. Below, I've provided an example in which a transaction features 8 distinct input addresses with different types and private keys, as well as 10 different output addresses. Furthermore, additional examples have been prepared, which you can find in the [`example`](https://github.com/mrtnetwork/bitcoin_base/tree/main/example) folder.

### PSBT
Find example implementations [here](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/lib/psbt)

- BIP-0174: Partially Signed Bitcoin Transaction Format
- BIP-0370: PSBT Version 2
- BIP-0371: Taproot Fields for PSBT
- BIP-0373: MuSig2 PSBT Fields

### MuSig2 (BIP-327):
Find example implementations [here](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/lib/musig)

- Sign/Verify: Supports signing and verifying multisignature transactions using MuSig2
- NonceAgg: Aggregates nonces from multiple participants for secure signature generation.
- KeyAgg: Combines multiple public keys into a single aggregated public key for efficient multisignature verification



### Addresses

- P2PKH A P2PKH (Pay-to-Public-Key-Hash) address in Bitcoin represents ownership of a cryptocurrency wallet by encoding a hashed public key
Expand Down Expand Up @@ -217,11 +234,11 @@ We have integrated three APIs—Mempool, BlockCypher, and Electrum—into the pl
Script(script: ["OP_2", public1, public2, "OP_2", "OP_CHECKMULTISIG"]);

/// Generate a P2WSH 3-of-5 address.
final p2wsh3of5Address = P2wshAddress.fromScript(script: newScript);
final p2wsh3of5Address = P2wshAddress.fromRedeemScript(script: newScript);

/// Generate a P2SH 3-of-5 address from the P2WSH address.
final p2sh3Of5 =
P2shAddress.fromScript(script: p2wsh3of5Address.toScriptPubKey());
P2shAddress.fromRedeemScript(script: p2wsh3of5Address.toScriptPubKey());

/// Implemented classes for each network to better manage network-specific addresses.
/// Integrated these classes to eliminate the necessity of using the main class and type for each address.
Expand Down Expand Up @@ -280,7 +297,7 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li
await ElectrumWebSocketService.connect("184....");

/// create provider with service
final provider = ElectrumApiProvider(service);
final provider = ElectrumProvider(service);

/// spender details
final privateKey = ECPrivate.fromHex(
Expand Down Expand Up @@ -310,7 +327,7 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li
for (final i in spenders) {
/// Reads all UTXOs (Unspent Transaction Outputs) associated with the account
final elctrumUtxos = await provider
.request(ElectrumScriptHashListUnspent(scriptHash: i.pubKeyHash()));
.request(ElectrumRequestScriptHashListUnspent(scriptHash: i.pubKeyHash()));

/// Converts all UTXOs to a list of UtxoWithAddress, containing UTXO information along with address details.
/// read spender utxos
Expand Down Expand Up @@ -427,7 +444,7 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li
final raw = transaction.serialize();

/// send to network
await provider.request(ElectrumBroadCastTransaction(transactionRaw: raw));
await provider.request(ElectrumRequestBroadCastTransaction(transactionRaw: raw));

/// Once completed, we verify the status by checking the mempool or using another explorer to review the transaction details.
/// https://mempool.space/testnet/tx/70cf664bba4b5ac9edc6133e9c6891ffaf8a55eaea9d2ac99aceead1c3db8899
Expand All @@ -446,7 +463,7 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li
"wss://chipnet.imaginary.cash:50004");

/// create provider with service
final provider = ElectrumApiProvider(service);
final provider = ElectrumProvider(service);

/// initialize private key
final privateKey = ECPrivate.fromBytes(BytesUtils.fromHexString(
Expand All @@ -470,7 +487,7 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li

/// Reads all UTXOs (Unspent Transaction Outputs) associated with the account.
/// We does not need tokens utxo and we set to false.
final elctrumUtxos = await provider.request(ElectrumScriptHashListUnspent(
final elctrumUtxos = await provider.request(ElectrumRequestScriptHashListUnspent(
scriptHash: p2pkhAddress.baseAddress.pubKeyHash(),
includeTokens: true,
));
Expand Down Expand Up @@ -566,7 +583,7 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li

/// send transaction to network
await provider
.request(ElectrumBroadCastTransaction(transactionRaw: transactionRaw));
.request(ElectrumRequestBroadCastTransaction(transactionRaw: transactionRaw));

/// done! check the transaction in block explorer
/// https://chipnet.imaginary.cash/tx/97030c1236a024de7cad7ceadf8571833029c508e016bcc8173146317e367ae6
Expand Down Expand Up @@ -704,7 +721,7 @@ I haven't implemented any specific HTTP service or socket service within this pl
await ElectrumSSLService.connect("testnet.aranguren.org:51002");

/// create provider with service
final provider = ElectrumApiProvider(service);
final provider = ElectrumProvider(service);

final address = P2trAddress.fromAddress(address: ".....", network: network);

Expand All @@ -714,15 +731,15 @@ I haven't implemented any specific HTTP service or socket service within this pl

/// Return an ordered list of UTXOs sent to a script hash.
final accountUnspend = await provider
.request(ElectrumScriptHashListUnspent(scriptHash: address.pubKeyHash()));
.request(ElectrumRequestScriptHashListUnspent(scriptHash: address.pubKeyHash()));

/// Return the confirmed and unconfirmed history of a script hash.
final accountHistory = await provider
.request(ElectrumScriptHashGetHistory(scriptHash: address.pubKeyHash()));

/// Broadcast a transaction to the network.
final broadcastTransaction = await provider
.request(ElectrumBroadCastTransaction(transactionRaw: "txDigest"));
.request(ElectrumRequestBroadCastTransaction(transactionRaw: "txDigest"));

/// ....
```
Expand Down
56 changes: 54 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,56 @@
# include: package:lints/recommended.yaml
include: package:flutter_lints/flutter.yaml
include: package:lints/recommended.yaml
# include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
# Uncomment the following section to specify additional rules.
linter:
rules:
# - always_declare_return_types
# - annotate_overrides
# - avoid_init_to_null
# - avoid_null_checks_in_equality_operators
# - avoid_relative_lib_imports
# - avoid_return_types_on_setters
# - avoid_shadowing_type_parameters
# - avoid_single_cascade_in_expression_statements
# - avoid_types_as_parameter_names
# - await_only_futures
# - camel_case_extensions
# - curly_braces_in_flow_control_structures
# - empty_catches
# - empty_constructor_bodies
# - library_names
# - library_prefixes
# - no_duplicate_case_values
# - null_closures
# - omit_local_variable_types
# - prefer_adjacent_string_concatenation
# - prefer_collection_literals
# - prefer_conditional_assignment
# - prefer_contains
# - prefer_equal_for_default_values
# - prefer_final_fields
# - prefer_for_elements_to_map_fromIterable
# - prefer_generic_function_type_aliases
# - prefer_if_null_operators
# - prefer_inlined_adds
# - prefer_is_empty
# - prefer_is_not_empty
# - prefer_iterable_whereType
# - prefer_single_quotes
# - prefer_spread_collections
# - recursive_getters
# - slash_for_doc_comments
# - sort_child_properties_last
# - type_init_formals
# - unawaited_futures
# - unnecessary_brace_in_string_interps
# - unnecessary_const
# - unnecessary_getters_setters
# - unnecessary_new
# - unnecessary_null_in_if_null_operators
# - unnecessary_this
# - unrelated_type_equality_checks
# - use_function_type_syntax_for_parameters
# - use_rethrow_when_possible
# - valid_regexps
Loading