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

Sign and verify arbitrary payloads #2379

Closed
CodeSandwich opened this issue Jul 19, 2022 · 6 comments
Closed

Sign and verify arbitrary payloads #2379

CodeSandwich opened this issue Jul 19, 2022 · 6 comments
Labels
C-cast Command: cast first issue A good way to start contributing T-feature Type: feature

Comments

@CodeSandwich
Copy link
Contributor

CodeSandwich commented Jul 19, 2022

Component

Cast

Describe the feature you would like

We can sign and verify messages using cast wallet sign, they get the \x19Ethereum Signed Message:\n prefix before being hashed. It'd be great to be able to do the same with arbitrary payloads.

This could be used to tinker around with all kinds of signed things:

  • ERC-712 messages. Currently there's no way to create or verify a permit payload.
  • Raw transactions. There's no way to verify an arbitrary supposedly signed transaction. There's also no way to manually build a transaction because it can't be signed.

It's crucial to be able to provide a raw 256-bit payload (hash) to be signed. Being able to provide a payload which needs to be hashed first would be a nice addition, but not necessary, it'd save a call to cast keccak.

Additional context

No response

@CodeSandwich CodeSandwich added the T-feature Type: feature label Jul 19, 2022
@gakonst gakonst added this to Foundry Jul 19, 2022
@gakonst gakonst moved this to Todo in Foundry Jul 19, 2022
@onbjerg onbjerg added first issue A good way to start contributing C-cast Command: cast labels Jul 19, 2022
@onbjerg
Copy link
Collaborator

onbjerg commented Jul 19, 2022

Maybe we should add a flag like --raw or --headerless?

@CodeSandwich
Copy link
Contributor Author

That would be awesome, --raw could accept a 256-bit payload to be directly signed and --headerless an arbitrary length payload to be hashed and then signed.

@raxhvl
Copy link
Contributor

raxhvl commented Jun 27, 2023

Raw transactions. There's no way to verify an arbitrary supposedly signed transaction. There's also no way to manually build a transaction because it can't be signed.

I am looking to use cast for this use case. Any luck this would work?

@marcuspang
Copy link

Hey @CodeSandwich, I implemented the --raw and --headerless flags as mentioned over at #5248. I also added a --raw flag for cast wallet verify. Is this what you had in mind for the feature?

@CodeSandwich
Copy link
Contributor Author

Hi @marcuspang, yes, that's exactly it!

@marcuspang
Copy link

I believe this issue is resolved with #7180 using the --no-hash flag. Although one would need to hash the message themselves first.

@jenpaff jenpaff moved this from Todo to Completed in Foundry Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast first issue A good way to start contributing T-feature Type: feature
Projects
Archived in project
Development

No branches or pull requests

4 participants