Skip to content

Instantly share code, notes, and snippets.

@whalelephant
Last active April 26, 2023 07:53
Show Gist options
  • Save whalelephant/915db60f0687172609f6ece6a541f98b to your computer and use it in GitHub Desktop.
Save whalelephant/915db60f0687172609f6ece6a541f98b to your computer and use it in GitHub Desktop.
CW contract signature validation

CW contract signature

The use of smart contracts (multisig, smart contract wallet) does not provide valid signatures from signature schemes. This is a limitation as EOA (externally owned accounts)

  • has a clear signature-client interface to sign arbitrary (or standard login) messages
  • can provide signature verifiable in contracts, such as for gas provision in smart contract wallets

This is similar to the isValidSiganture standard in Ethereum.

// Example function interface
// This creates the hash of the message and checks the state to see if the hash has been added to the state
// `signature` can be empty for contract signatures and only used to be compatible with EOA signatures
pub  fn is_valid_signature(msg: Binary, signature: Binary) -> StdResult<bool> {}

// Example state in the implementing contract
// Map of hash(msg) to validate state
// - valid signed
// - signed but revoked
pub const SIGNATURES: Map<&[u8], bool>
@whalelephant
Copy link
Author

@TrevorJTClarke, this example might be clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment