Crypto-condition types can be viewed as curried functions. Let's take a ed25519 signature condition as an example:
ed25519(pubkey)(signature)(message)
-
Initially, we start out with the condition type (
ed25519
). When we apply a first set of parameters (pubkey
), it returns a condition. -
A condition is another function which expects some kind of proof (
signature
) and returns a fulfillment. -
A fulfillment is again a function. This function verifies whether it (the fulfillment) is valid with respect to a certain
message
. Hence it takes amessage
parameter and return eithertrue
(valid) or an exception (invalid).
There are five condition types so far:
preimageSha256(hash)(preimage)()
rsaSha256(pubkey)(signature)(message)
ed25519(pubkey)(signature)(message)
prefixSha256(subcondition, prefix)(fulfillment)(message)
thresholdSha256(subconditions, threshold)(subfulfillments)(message)
(((preimageSha256 hash) preimage))
(((rsaSha256 pubkey) signature) message)
(((ed25519 pubkey) signature) message)
(((prefixSha256 subcondition prefix) fulfillment) message)
(((thresholdSha256 subconditions threshold) subfulfillments) message)
(preimageSha256 hash preimage)
(rsaSha256 pubkey signature message)
(ed25519 pubkey signature message)
(prefixSha256 subcondition prefix fulfillment message)
(thresholdSha256 subconditions threshold subfulfillments message)
preimageSha256 = (hash) => (preimage) => () => {}
rsaSha256 = (pubkey) => (signature) => (message) => {}
ed25519 = (pubkey) => (signature) => (message) => {}
prefixSha256 = (subcondition, prefix) => (fulfillment) => (message) => {}
thresholdSha256 = (subconditions, threshold) => (subfulfillments) => (message) => {}