You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
480 B
18 lines
480 B
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin;
|
|
import 'package:crypto/crypto.dart';
|
|
|
|
String scriptHash(String address) {
|
|
final outputScript = bitcoin.Address.addressToOutputScript(address);
|
|
final splitted = sha256.convert(outputScript).toString().split('');
|
|
var res = '';
|
|
|
|
for (var i = splitted.length - 1; i >= 0; i--) {
|
|
final char = splitted[i];
|
|
i--;
|
|
final nextChar = splitted[i];
|
|
res += nextChar;
|
|
res += char;
|
|
}
|
|
|
|
return res;
|
|
} |