is_key

static Key.is_key(wif, public) → bool[source]

Check if a private key wif matches a public key gls

Example:

>>> kp1 = '5Jq19TeeVmGrBFnu32oxfxQMiipnSCKmwW7fZGUVLAoqsKJ9JwP',
...           'GLS7qHue1h2eWV8M7WKtb6F8dbhKfEFvLVy9JqvSTHBBEM5JMdsmh'
>>>
>>> kp2 = '5KPQo2iNeACYagW5qAsgNpFxDDuwuArCCG8PvU6FKTMcD5LmhzJ',
...       'GLS8G7rgqhPUbyzYVYWb8BPcHtpgLDmJYooHmHPbaLaH7cdywsdwm'
>>>
>>> Key.is_key(kp1[0], kp1[1])   # Compare keypair 1's private key against it's own public key
True
>>> Key.is_key(kp1[0], kp2[1])   # Compare keypair 1's private key against keypair 2's public key
False
Parameters
  • wif (str) – The private key, as a WIF string, to compare against the public key public

  • public (str) – The public key, as a prefixed string address, to compare against the private key wif

Return bool key_matches

True if wif’s public key matches public - otherwise False