Closed willyfromtheblock closed 3 years ago
String reverseString(String input) {
List items = [];
for (var i = 0; i < input.length; i++) {
items.add(input[i]);
}
List itemsReversed = [];
items.asMap().forEach((index, value) {
if (index % 2 == 0) {
itemsReversed.insert(0, items[index + 1]);
itemsReversed.insert(0, value);
}
});
return itemsReversed.join();
}
var script = Address.addressToOutputScript(wallet.address);
var hash = sha256.convert(script).toString();
reversed = reverseString(hash);
et voila, electrumx will be very happy with reversed
Hey,
I saw that this project is inspired by bitcoinjs. Bitcoinjs has toOutputScript and I was wondering if there is an equivalent inside bitcoin_flutter. I didn't find any so far.
What I'm trying to do is basically this:
https://github.com/bitcoinjs/bitcoinjs-lib/issues/990#issuecomment-358701657
I'm working with electrum and I do believe that there is no script hashing possible without this method.
Thanks
Willy