PageRenderTime 160ms queryTime 26ms sortTime 0ms getByIdsTime 46ms findMatchingLines 4ms

33+ results for 'bech32m' (160 ms)

Not the results you expected?
bech32.cpp https://github.com/denis2342/bitcoin.git | C++ | 43 lines
                    
33        // If it's possible to encode input in Bech32(m) without exceeding the 90-character limit:
                    
34        for (auto encoding : {bech32::Encoding::BECH32, bech32::Encoding::BECH32M}) {
                    
35            const std::string encoded = bech32::Encode(encoding, "bc", input);
                    
                
bitcoin-networks.js https://gitlab.com/YukiteruAmano/simulador-criptografico | JavaScript | 169 lines
                    
158  words.unshift(1);
                    
159  return bitcoin.bech32m.encode(network.bech32, words);
                    
160}
                    
                
browserify.js https://gitlab.com/YukiteruAmano/simulador-criptografico | JavaScript | 47 lines
                    
27  bech32: require('bech32').bech32,
                    
28  bech32m: require('bech32').bech32m,
                    
29  bip32: require('bip32'),
                    
                
init.cpp https://github.com/martindale/bitcoin.git | C++ | 143 lines
                    
46{
                    
47    argsman.AddArg("-addresstype", strprintf("What type of addresses to use (\"legacy\", \"p2sh-segwit\", \"bech32\", or \"bech32m\", default: \"%s\")", FormatOutputType(DEFAULT_ADDRESS_TYPE)), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
                    
48    argsman.AddArg("-avoidpartialspends", strprintf("Group outputs by address, selecting many (possibly all) or none, instead of selecting on a per-output basis. Privacy is improved as addresses are mostly swept with fewer transactions and outputs are aggregated in clean change addresses. It may result in higher fees due to less optimal coin selection caused by this added limitation and possibly a larger-than-necessary number of inputs being used. Always enabled for wallets with \"avoid_reuse\" enabled, otherwise default: %u.", DEFAULT_AVOIDPARTIALSPENDS), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
                    
49    argsman.AddArg("-changetype",
                    
50                   "What type of change to use (\"legacy\", \"p2sh-segwit\", \"bech32\", or \"bech32m\"). Default is \"legacy\" when "
                    
51                   "-addresstype=legacy, else it is an implementation detail.",
                    
                
output_script.cpp https://github.com/bitcoin/bitcoin.git | C++ | 319 lines
                    
145                    throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[2].get_str()));
                    
146                } else if (parsed.value() == OutputType::BECH32M) {
                    
147                    throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "createmultisig cannot create bech32m multisig addresses");
                    
                
ecc.html https://gitlab.com/YukiteruAmano/simulador-criptografico | HTML | 232 lines
                    
131    <div class="form-group" ng-if="vm.network.config.bech32">
                    
132      <label class="col-sm-4 control-label">Dirección SegWit v1 bech32m P2TR:</label>
                    
133      <div class="col-sm-8 input-group">
                    
                
address.js git://github.com/bitcoinjs/bitcoinjs-lib.git | JavaScript | 140 lines
                    
52  } else {
                    
53    result = bech32_1.bech32m.decode(address);
                    
54    version = result.words[0];
                    
77    ? bech32_1.bech32.encode(prefix, words)
                    
78    : bech32_1.bech32m.encode(prefix, words);
                    
79}
                    
                
hd-wallet.js https://gitlab.com/YukiteruAmano/simulador-criptografico | JavaScript | 167 lines
                    
53    {id: 3, label: 'BIP84 (Native SegWit bech32 P2WPKH)', bip: '84', hasCoinType: true, path: 'm/84\'/coin\'/account\'/change/index'},
                    
54    {id: 4, label: 'BIP86 (Native SegWit v1 bech32m P2TR)', bip: '86', hasCoinType: true, path: 'm/86\'/coin\'/account\'/change/index'},
                    
55  ];
                    
                
address.ts git://github.com/bitcoinjs/bitcoinjs-lib.git | TypeScript | 175 lines
                    
5import * as types from './types';
                    
6import { bech32, bech32m } from 'bech32';
                    
7import * as bs58check from 'bs58check';
                    
73  } else {
                    
74    result = bech32m.decode(address);
                    
75    version = result.words[0];
                    
107    ? bech32.encode(prefix, words)
                    
108    : bech32m.encode(prefix, words);
                    
109}
                    
                
wallet.py git://github.com/bitcoin/bitcoin.git | Python | 400 lines
                    
60    For most purposes, the default mode ADDRESS_OP_TRUE should be sufficient;
                    
61    it simply uses a fixed bech32m P2TR address whose coins are spent with a
                    
62    witness stack of OP_TRUE, i.e. following an anyone-can-spend policy.
                    
70    ----------------+-------------------+-----------+----------+------------+----------
                    
71    ADDRESS_OP_TRUE | anyone-can-spend  |  bech32m  |   yes    |    no      |   no
                    
72    RAW_OP_TRUE     | anyone-can-spend  |  - (raw)  |   no     |    yes     |   no
                    
311        address = key_to_p2wpkh(pubkey)
                    
312    # TODO: also support bech32m (need to generate x-only-pubkey)
                    
313    else:
                    
                
addresses.cpp git://github.com/bitcoin/bitcoin.git | C++ | 806 lines
                    
24                    {"label", RPCArg::Type::STR, RPCArg::Default{""}, "The label name for the address to be linked to. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name."},
                    
25                    {"address_type", RPCArg::Type::STR, RPCArg::DefaultHint{"set by -addresstype"}, "The address type to use. Options are \"legacy\", \"p2sh-segwit\", \"bech32\", and \"bech32m\"."},
                    
26                },
                    
54            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[1].get_str()));
                    
55        } else if (parsed.value() == OutputType::BECH32M && pwallet->GetLegacyScriptPubKeyMan()) {
                    
56            throw JSONRPCError(RPC_INVALID_PARAMETER, "Legacy wallets cannot provide bech32m addresses");
                    
77                {
                    
78                    {"address_type", RPCArg::Type::STR, RPCArg::DefaultHint{"set by -changetype"}, "The address type to use. Options are \"legacy\", \"p2sh-segwit\", \"bech32\", and \"bech32m\"."},
                    
79                },
                    
102            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[0].get_str()));
                    
103        } else if (parsed.value() == OutputType::BECH32M && pwallet->GetLegacyScriptPubKeyMan()) {
                    
104            throw JSONRPCError(RPC_INVALID_PARAMETER, "Legacy wallets cannot provide bech32m addresses");
                    
284            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[3].get_str()));
                    
285        } else if (parsed.value() == OutputType::BECH32M) {
                    
286            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Bech32m multisig addresses cannot be created with legacy wallets");
                    
                
release-notes-22.0.md git://github.com/bitcoin/bitcoin.git | Markdown | 696 lines
                    
64  being implemented, behavior for all RPCs that accept addresses is changed when
                    
65  a native witness version 1 (or higher) is passed. These now require a Bech32m
                    
66  encoding instead of a Bech32 one, and Bech32m encoding will be used for such
                    
69  (as will happen through [BIP 341](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki)).
                    
70  Once that happens, Bech32m is expected to be used for them, so this shouldn't
                    
71  affect any production systems, but may be observed on other networks where such
                    
                
wallet_address_types.py https://github.com/bitcoin/bitcoin.git | Python | 400 lines
                    
123            assert 'pubkey' in info
                    
124        elif not multisig and typ == "bech32m":
                    
125            # P2TR single sig
                    
                
tool_wallet.py https://github.com/bitcoin/bitcoin.git | Python | 415 lines
                    
73        if self.options.descriptors:
                    
74            output_types = 4  # p2pkh, p2sh, segwit, bech32m
                    
75            return textwrap.dedent('''\
                    
87        else:
                    
88            output_types = 3  # p2pkh, p2sh, segwit. Legacy wallets do not support bech32m.
                    
89            return textwrap.dedent('''\
                    
                
scriptpubkeyman.cpp https://github.com/bitcoin/bitcoin.git | C++ | 2363 lines
                    
29    }
                    
30    assert(type != OutputType::BECH32M);
                    
31
                    
304    }
                    
305    assert(type != OutputType::BECH32M);
                    
306
                    
                
misc.cpp https://github.com/bitcoin/bitcoin.git | C++ | 833 lines
                    
151            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[2].get_str()));
                    
152        } else if (parsed.value() == OutputType::BECH32M) {
                    
153            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "createmultisig cannot create bech32m multisig addresses");
                    
                
bech32.cpp https://github.com/bitcoin/bitcoin.git | C++ | 568 lines
                    
21
                    
22/** The Bech32 and Bech32m character set for encoding. */
                    
23const char* CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
                    
24
                    
25/** The Bech32 and Bech32m character set for decoding. */
                    
26const int8_t CHARSET_REV[128] = {
                    
122uint32_t EncodingConstant(Encoding encoding) {
                    
123    assert(encoding == Encoding::BECH32 || encoding == Encoding::BECH32M);
                    
124    return encoding == Encoding::BECH32 ? 1 : 0x2bc830a3;
                    
                
rpc_invalid_address_message.py https://github.com/bitcoin/bitcoin.git | Python | 115 lines
                    
18BECH32_INVALID_BECH32 = 'bcrt1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqdmchcc'
                    
19BECH32_INVALID_BECH32M = 'bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7k35mrzd'
                    
20BECH32_INVALID_VERSION = 'bcrt130xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqynjegk'
                    
64        self.check_invalid(BECH32_INVALID_PREFIX, 'Not a valid Bech32 or Base58 encoding')
                    
65        self.check_invalid(BECH32_INVALID_BECH32, 'Version 1+ witness address must use Bech32m checksum')
                    
66        self.check_invalid(BECH32_INVALID_BECH32M, 'Version 0 witness address must use Bech32 checksum')
                    
                
outputtype.h https://github.com/bitcoin/bitcoin.git | C Header | 54 lines
                    
21    BECH32,
                    
22    BECH32M,
                    
23};
                    
28    OutputType::BECH32,
                    
29    OutputType::BECH32M,
                    
30};
                    
                
segwit_addr.py https://github.com/bitcoin/bitcoin.git | Python | 141 lines
                    
4# file COPYING or http://www.opensource.org/licenses/mit-license.php.
                    
5"""Reference implementation for Bech32/Bech32m and segwit addresses."""
                    
6import unittest
                    
10BECH32_CONST = 1
                    
11BECH32M_CONST = 0x2bc830a3
                    
12
                    
15    BECH32 = 1
                    
16    BECH32M = 2
                    
17
                    
40        return Encoding.BECH32
                    
41    elif check == BECH32M_CONST:
                    
42        return Encoding.BECH32M
                    
48    values = bech32_hrp_expand(hrp) + data
                    
49    const = BECH32M_CONST if encoding == Encoding.BECH32M else BECH32_CONST
                    
50    polymod = bech32_polymod(values + [0, 0, 0, 0, 0, 0]) ^ const
                    
                
rpc_createmultisig.py https://github.com/bitcoin/bitcoin.git | Python | 232 lines
                    
104        # Check that bech32m is currently not allowed
                    
105        assert_raises_rpc_error(-5, "createmultisig cannot create bech32m multisig addresses", self.nodes[0].createmultisig, 2, self.pub, "bech32m")
                    
106
                    
117
                    
118        # Bech32m address type is disallowed for legacy wallets
                    
119        pubs = [self.nodes[1].getaddressinfo(addr)["pubkey"] for addr in addresses]
                    
119        pubs = [self.nodes[1].getaddressinfo(addr)["pubkey"] for addr in addresses]
                    
120        assert_raises_rpc_error(-5, "Bech32m multisig addresses cannot be created with legacy wallets", self.nodes[0].addmultisigaddress, 2, pubs, "", "bech32m")
                    
121
                    
                
bech32.h https://github.com/bitcoin/bitcoin.git | C Header | 53 lines
                    
5
                    
6// Bech32 and Bech32m are string encoding formats used in newer
                    
7// address types. The outputs consist of a human-readable part
                    
27    BECH32,  //!< Bech32 encoding as defined in BIP173
                    
28    BECH32M, //!< Bech32m encoding as defined in BIP350
                    
29};
                    
30
                    
31/** Encode a Bech32 or Bech32m string. If hrp contains uppercase characters, this will cause an
                    
32 *  assertion error. Encoding must be one of BECH32 or BECH32M. */
                    
44
                    
45/** Decode a Bech32 or Bech32m string. */
                    
46DecodeResult Decode(const std::string& str);
                    
                
gen_key_io_test_vectors.py https://github.com/bitcoin/bitcoin.git | Python | 268 lines
                    
76  ('bc',    0, 32, (False, 'main',    None, True), Encoding.BECH32,  p2wsh_prefix),
                    
77  ('bc',    1, 32, (False, 'main',    None, True), Encoding.BECH32M, p2tr_prefix),
                    
78  ('bc',    2,  2, (False, 'main',    None, True), Encoding.BECH32M, (OP_2, 2)),
                    
80  ('tb',    0, 32, (False, 'test',    None, True), Encoding.BECH32,  p2wsh_prefix),
                    
81  ('tb',    1, 32, (False, 'test',    None, True), Encoding.BECH32M, p2tr_prefix),
                    
82  ('tb',    3, 16, (False, 'test',    None, True), Encoding.BECH32M, (OP_3, 16)),
                    
84  ('tb',    0, 32, (False, 'signet',  None, True), Encoding.BECH32,  p2wsh_prefix),
                    
85  ('tb',    1, 32, (False, 'signet',  None, True), Encoding.BECH32M, p2tr_prefix),
                    
86  ('tb',    3, 32, (False, 'signet',  None, True), Encoding.BECH32M, (OP_3, 32)),
                    
88  ('bcrt',  0, 32, (False, 'regtest', None, True), Encoding.BECH32,  p2wsh_prefix),
                    
89  ('bcrt',  1, 32, (False, 'regtest', None, True), Encoding.BECH32M, p2tr_prefix),
                    
90  ('bcrt', 16, 40, (False, 'regtest', None, True), Encoding.BECH32M, (OP_16, 40))
                    
95  ('tc',    0, 20, Encoding.BECH32,  False, False, False),
                    
96  ('bt',    1, 32, Encoding.BECH32M, False, False, False),
                    
97  ('tb',   17, 32, Encoding.BECH32M, False, False, False),
                    
                
bech32_tests.cpp https://github.com/bitcoin/bitcoin.git | C++ | 159 lines
                    
34
                    
35BOOST_AUTO_TEST_CASE(bech32m_testvectors_valid)
                    
36{
                    
47        const auto dec = bech32::Decode(str);
                    
48        BOOST_CHECK(dec.encoding == bech32::Encoding::BECH32M);
                    
49        std::string recode = bech32::Encode(bech32::Encoding::BECH32M, dec.hrp, dec.data);
                    
106
                    
107BOOST_AUTO_TEST_CASE(bech32m_testvectors_invalid)
                    
108{
                    
141        {"Invalid separator position", {0}},
                    
142        {"Invalid Bech32m checksum", {21}},
                    
143        {"Invalid Bech32m checksum", {13, 32}},
                    
144    };
                    
145    static_assert(std::size(CASES) == std::size(ERRORS), "Bech32m CASES and ERRORS should have the same length");
                    
146
                    
                
bip-0350.t.sh https://github.com/grondilu/bitcoin-bash-tools.git | Shell | 200 lines
                    
41
                    
42declare -a valid_checksum_bech32m=(
                    
43  A1LQFN3A
                    
66
                    
67declare -a invalid_checksum_bech32m=(
                    
68  ' 1xj0phk'
                    
126
                    
127for t in "${valid_checksum_bech32m[@]}"
                    
128do
                    
144
                    
145for t in "${invalid_checksum_bech32m[@]}"
                    
146do
                    
                
bech32_tests.cpp https://github.com/denis2342/bitcoin.git | C++ | 102 lines
                    
33
                    
34BOOST_AUTO_TEST_CASE(bech32m_testvectors_valid)
                    
35{
                    
46        const auto dec = bech32::Decode(str);
                    
47        BOOST_CHECK(dec.encoding == bech32::Encoding::BECH32M);
                    
48        std::string recode = bech32::Encode(bech32::Encoding::BECH32M, dec.hrp, dec.data);
                    
77
                    
78BOOST_AUTO_TEST_CASE(bech32m_testvectors_invalid)
                    
79{
                    
                
key_io.cpp https://github.com/denis2342/bitcoin.git | C++ | 281 lines
                    
61        ConvertBits<8, 5, true>([&](unsigned char c) { data.push_back(c); }, tap.begin(), tap.end());
                    
62        return bech32::Encode(bech32::Encoding::BECH32M, m_params.Bech32HRP(), data);
                    
63    }
                    
72        ConvertBits<8, 5, true>([&](unsigned char c) { data.push_back(c); }, id.program, id.program + id.length);
                    
73        return bech32::Encode(bech32::Encoding::BECH32M, m_params.Bech32HRP(), data);
                    
74    }
                    
106    const auto dec = bech32::Decode(str);
                    
107    if ((dec.encoding == bech32::Encoding::BECH32 || dec.encoding == bech32::Encoding::BECH32M) && dec.data.size() > 0) {
                    
108        // Bech32 decoding
                    
118        }
                    
119        if (version != 0 && dec.encoding != bech32::Encoding::BECH32M) {
                    
120            error_str = "Version 1+ witness address must use Bech32m checksum";
                    
                
rpc_invalid_address_message.py https://github.com/denis2342/bitcoin.git | Python | 98 lines
                    
15BECH32_INVALID_BECH32 = 'bcrt1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqdmchcc'
                    
16BECH32_INVALID_BECH32M = 'bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7k35mrzd'
                    
17BECH32_INVALID_VERSION = 'bcrt130xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqynjegk'
                    
45        assert not info['isvalid']
                    
46        assert_equal(info['error'], 'Version 1+ witness address must use Bech32m checksum')
                    
47
                    
47
                    
48        info = node.validateaddress(BECH32_INVALID_BECH32M)
                    
49        assert not info['isvalid']
                    
                
outputtype.cpp https://github.com/denis2342/bitcoin.git | C++ | 123 lines
                    
21static const std::string OUTPUT_TYPE_STRING_BECH32 = "bech32";
                    
22static const std::string OUTPUT_TYPE_STRING_BECH32M = "bech32m";
                    
23
                    
31        return OutputType::BECH32;
                    
32    } else if (type == OUTPUT_TYPE_STRING_BECH32M) {
                    
33        return OutputType::BECH32M;
                    
43    case OutputType::BECH32: return OUTPUT_TYPE_STRING_BECH32;
                    
44    case OutputType::BECH32M: return OUTPUT_TYPE_STRING_BECH32M;
                    
45    } // no default case, so the compiler can warn about missing cases
                    
63    }
                    
64    case OutputType::BECH32M: {} // This function should never be used with BECH32M, so let it assert
                    
65    } // no default case, so the compiler can warn about missing cases
                    
103    }
                    
104    case OutputType::BECH32M: {} // This function should not be used for BECH32M, so let it assert
                    
105    } // no default case, so the compiler can warn about missing cases
                    
                
bech32.cpp https://github.com/denis2342/bitcoin.git | C++ | 230 lines
                    
17
                    
18/** The Bech32 and Bech32m character set for encoding. */
                    
19const char* CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
                    
20
                    
21/** The Bech32 and Bech32m character set for decoding. */
                    
22const int8_t CHARSET_REV[128] = {
                    
34uint32_t EncodingConstant(Encoding encoding) {
                    
35    assert(encoding == Encoding::BECH32 || encoding == Encoding::BECH32M);
                    
36    return encoding == Encoding::BECH32 ? 1 : 0x2bc830a3;
                    
156    // list of values would result in a new valid list. For that reason, Bech32 requires the
                    
157    // resulting checksum to be 1 instead. In Bech32m, this constant was amended. See
                    
158    // https://gist.github.com/sipa/14c248c288c3880a3b191f978a34508e for details.
                    
160    if (check == EncodingConstant(Encoding::BECH32)) return Encoding::BECH32;
                    
161    if (check == EncodingConstant(Encoding::BECH32M)) return Encoding::BECH32M;
                    
162    return Encoding::INVALID;
                    
                
address.py https://github.com/martindale/bitcoin.git | Python | 177 lines
                    
8- bech32 segwit v0 P2WPKH and P2WSH addresses.
                    
9- bech32m segwit v1 P2TR addresses."""
                    
10
                    
42    """
                    
43    Generates a deterministic bech32m address (segwit v1 output) that
                    
44    can be spent with a witness stack of OP_TRUE and the control block
                    
                
CHANGELOG.md https://github.com/bitcoinjs/bitcoinjs-lib.git | Markdown | 353 lines
                    
7__added__
                    
8- taproot segwit v1 address support (bech32m) via address module (#1676)
                    
9- hashForWitnessV1 method on Transaction class (#1745)
                    
                
taproot.md https://github.com/bitcoinjs/bitcoinjs-lib.git | Markdown | 156 lines
                    
6
                    
7- [x] segwit v1 address support via bech32m
                    
8- [x] segwit v1 sighash calculation on Transaction class
                    
                
 

Source

Language