-
Notifications
You must be signed in to change notification settings - Fork 361
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
Add support for keccak hashing and secp256k1 signature verification #583
Comments
Welcoem to CosmWasm! Yeah we talked about adding crypto APIs before but nothing has been implemented so far. Did you try using Rust crates to compile this functionality as part of your Wasm contract? This might increate the contract size and gas consumption significantly but should work to unblock your project right now. Regarding potential APIs:
|
Thanks for an idea, will try to do this workaround until this issue is addressed
Right, I meant Keccak
Agreed, this would work and it will be more general purpose.
I think it will be better to support uncompressed keys because they can be easily converted to compressed version and not the other way round (afaik) |
I recently implemented BLS12-318 signature verification in pure Rust/Wasm. The contract is about 500 KB large and a verification costs about 5 million Cosmos SDK gas. Not production ready for sure, but with that approach prototypes can be built that will prove the point.
👍 will double check. I'm not too familiar with the math. But both conversions are possible without extra information. |
We're now implementing this in #751. Our current thinking is that hashing remains in the contract as it varies a lot from application to application and is small/fast enough to be done in Wasm. The VM would then provide a |
We're working on expanding Certus One Wormhole bridge architecture (currently supporting token transfer between Solana and Ethereum) to support other blockchains (you can find original repository here: https://github.com/certusone/wormhole)
One of the key parts of this architecture are VAAs (verifiable action approvals) which are sent by guardians who confirm cross-chain actions. And these VAAs contain signatures (in secp256k1 format) from guardians approving the action. These signatures have to be verified in the smart contract and this cannot be achieved with CosmWasm now. So what we ask is to add such signature verification (and sha-3 hashing) to be available from the smart contract environment.
Regarding interface it would be ideal if it is compatible with Ethereum ecrecover function, which accepts 32-byte message, v, r, s signature field and returns recovered address as first 20 bytes of sha3-hashed pubkey.
Overall we believe that such functionality in CosmWasm will be useful for many future projects on Cosmos. With high Ethereum fees many DeFi services will look for compatible blockchains they can integrate with their existing smart contracts and support for the same cryptography features in CosmWasm will be very important.
The text was updated successfully, but these errors were encountered: