Skip to content

Instantly share code, notes, and snippets.

@ObiajuluM
Last active May 12, 2022 00:23
Show Gist options
  • Save ObiajuluM/8da69c628879161c019a9256aa168d65 to your computer and use it in GitHub Desktop.
Save ObiajuluM/8da69c628879161c019a9256aa168d65 to your computer and use it in GitHub Desktop.
from typing import TypedDict
from cryptoconditions import PreimageSha256
def genCondition_Fulfillment(secret: bytes) -> TypedDict:
"""Generate a condition and fulfillment for escrows"""
fufill = PreimageSha256(preimage=secret)
return {
"condition": str.upper(fufill.condition_binary.hex()),
"fulfillment": str.upper(fufill.serialize_binary().hex())}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment