PrivateKey
32-byte secp256k1 private key
Last updated
32-byte secp256k1 private key
32-byte secp256k1 private key used for transaction signing and ECDH key derivation.
class PrivateKey(Bytes32):
@staticmethod
def from_hex_str(hex_string: str) -> PrivateKey:
...val
bytes | str | int
Yes
Hex string, raw bytes, or integer
Raises ValueError if length is not exactly 32 bytes.
Create a PrivateKey from a hex string, with or without 0x prefix. Shorthand for PrivateKey(hex_to_bytes(hex_string)).
@staticmethod
def from_hex_str(hex_string: str) -> PrivateKeySubclass of Bytes32 — inherits immutability, hashability, .to_0x_hex()
Compatible with eth_keys.PrivateKey via eth_keys.PrivateKey(bytes(pk))
No validation on mathematical validity (i.e., no check that 0 < key < n)
Bytes32 — parent type
CompressedPublicKey — corresponding public key type
hex_to_bytes — general-purpose hex decoding
sign_seismic_tx_eip712 — sign transactions with private key
Last updated
import os
from seismic_web3 import PrivateKey
pk = PrivateKey.from_hex_str(os.environ["PRIVATE_KEY"])
