Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating Signature Error #3214

Closed
Liguangyyu opened this issue Jan 31, 2024 · 1 comment
Closed

Generating Signature Error #3214

Liguangyyu opened this issue Jan 31, 2024 · 1 comment

Comments

@Liguangyyu
Copy link

  • Version: 6.14.0
  • Python: 3.8
  • OS: win11
  • pip freeze output
<put the output from running pip freeze here>

What was wrong?

When I run Generate Signature, I get the message "AttributeError: SECP256K1_CONTEXT_SIGN"

Please include any of the following that are applicable:

code that generates an error:
private_key = keys
address = add
rqc = "https://rpc.sepolia.org"
w3 = Web3(HTTPProvider(rqc))

msg = Web3.solidity_keccak(['address','uint256'],[address,0])
print(f"Mes:{msg.hex()}")

message = encode_defunct(hexstr=msg.hex())

signed_message = w3.eth.account.sign_message(message,private_key=private_key)
print(f"sig:{signed_message['signature'].hex()}")

Screenshot of the error message
image

How can it be fixed?

Fill this section in if you know how this could or should be fixed.


Note: We prefer to use issues to track our work. If you think you've encountered a bug in web3py or
have a feature request, you're in the right place. If you have implementation or usage questions,
please refer to our documentation and/or join the conversation
on discord.

@fselmo
Copy link
Collaborator

fselmo commented Apr 22, 2024

I cannot reproduce this using Sepolia and the following code:

from eth_account import Account

acct = Account.create()

msg = Web3.solidity_keccak(['address','uint256'],[acct.address,0])
print(f"Mes:{msg.hex()}")

message = encode_defunct(hexstr=msg.hex())

signed_message = w3.eth.account.sign_message(message,private_key=acct.key)
print(f"sig:{signed_message['signature'].hex()}")

@fselmo fselmo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants