MCPcopy Create free account
hub / github.com/ElementsProject/elements / generate_keypair

Function generate_keypair

test/functional/test_framework/wallet_util.py:89–99  ·  view source on GitHub ↗

Generate a new random keypair and return the corresponding ECKey / bytes objects. The private key can also be provided as WIF (wallet import format) string instead, which is often useful for wallet RPC interaction.

(compressed=True, wif=False)

Source from the content-addressed store, hash-verified

87 )
88
89def generate_keypair(compressed=True, wif=False):
90 """Generate a new random keypair and return the corresponding ECKey /
91 bytes objects. The private key can also be provided as WIF (wallet
92 import format) string instead, which is often useful for wallet RPC
93 interaction."""
94 privkey = ECKey()
95 privkey.generate(compressed)
96 pubkey = privkey.get_pubkey().get_bytes()
97 if wif:
98 privkey = bytes_to_wif(privkey.get_bytes(), compressed)
99 return privkey, pubkey
100
101def get_multisig(node):
102 """Generate a fresh 2-of-3 multisig on node

Callers 1

spenders_taproot_activeFunction · 0.90

Calls 5

generateMethod · 0.95
get_bytesMethod · 0.95
get_pubkeyMethod · 0.95
ECKeyClass · 0.90
bytes_to_wifFunction · 0.85

Tested by

no test coverage detected