Files
mini_code/polymarket/获取私钥.py
2026-01-04 00:54:44 +08:00

33 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from eth_account import Account
# 启用助记词功能
Account.enable_unaudited_hdwallet_features()
# 在此处填入你的 12 或 24 个助记词(用空格隔开)
mnemonic = "material vapor okay save company news village license head slogan sadness wire"
# OKX 钱包/Metamask 第一个账户的标准路径
path = "m/44'/60'/0'/0/0"
try:
# 从助记词生成账户
acct = Account.from_mnemonic(mnemonic, account_path=path)
print("-" * 30)
print(f"✅ 钱包地址: {acct.address}")
print(f"🔑 私钥 (Private Key): {acct.key.hex()}")
print("-" * 30)
# 验证地址是否匹配
target_address = "0xADcA20376A6CdCBd232577ac830F4116eC863DcF"
if acct.address.lower() == target_address.lower():
print("🎉 地址匹配成功!这就是你在 Polymarket 使用的账户。")
print("请复制上面的【私钥】用于后续操作。")
else:
print(f"⚠️ 地址不匹配!")
print(f"脚本计算出的地址: {acct.address}")
print(f"Polymarket 日志中的地址: {target_address}")
print("可能是路径不同,或者是 OKX 钱包的第2/3个账户")
except Exception as e:
print(f"❌ 错误: {e}")