Skip to content

Commit 805c66c

Browse files
committed
Add extension spec for oracle checksig
1 parent 2844f5e commit 805c66c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

doc/extension_spec.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,19 @@ mod(x,y) | `[X] [Y] DIV64 <1> EQUALVERIFY DROP`
4747
bitand(x,y) | `[X] [Y] AND`
4848
bitor(x,y) | `[X] [Y] OR (cannot fail)`
4949
bitxor(x,y) | `[X] [Y] XOR (cannot fail)`
50-
50+
price_oracle_1(K,T) | `2DUP TOALTSTACK <T> OP_GREATERTHANEQ VERIFY CAT SHA256 <K> CHECKSIGFROMSTACKVERIFY OP_FROMATLSTACK`
5151

5252
- The division operation pushes the quotient(a//b) such that the remainder a%b (must be non-negative and less than |b|).
5353
- neg(a) returns -a, whereas bitinv(a) returns ~a.
54+
- `price_oracle_1(K,T)` pushes a 64 bit LE integer(price) of signed with key K. It checks whether the price is signed
55+
with at a timestamp greater than T. Roughly spea
56+
- K can be any `KEY` expression in descriptor format, but it not allowed to be uncompressed key.
57+
- T is a 64 byte LE UXIX timestamp.
58+
- `_1` is the version of the oracle. There can be multiple versions of the
59+
oracle with different fragments. `price_oracle_1` creates a schnorr signature with given key `K` on a message that is
60+
computed as: `sha256(T1||K)`
61+
- The fragment consumes three inputs from stack top: [`signature`, `timestamp`, `price`] where `price` is the
62+
stack top.
5463

5564
## Comparison extensions
5665

0 commit comments

Comments
 (0)