#!/usr/bin/perl # Copyright (c) 2016-2023 The Hush developers # Distributed under the GPLv3 software license, see the accompanying # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html use warnings; use strict; use JSON; # Generates taddrs/scriptpubs for testing the decentralized devtax # all generated taddrs/scriptpubs will be part of existing wallet.dat my $N = shift || 20; my $hush = "./src/hush-cli"; my $getnew = "$hush getnewaddress"; my $validate = "$hush validateaddress"; print "std::string DEVTAX_DATA[DEVTAX_NUM][2] = {\n"; for my $i (1 .. $N) { my $taddr = qx{$getnew}; chomp $taddr; my $j = qx{$validate $taddr}; my $json = decode_json($j); my $scriptpub = $json->{scriptPubKey}; printf qq!{"%s", "%s"},\n!, $taddr, $scriptpub; } print "};\n";