CAT can reduce curve point scalar multiplication to a subtraction in the scalar field.
Subtraction of field elements can probably be emulated in less than 250 (?) opcodes. For now, let's assume we had an (emulated) opcode, op_scalar_sub, for subtracting two elements of the scalar field of secp256k1.
Given secp's generator G, we want to compute for some scalar r the point R = rG
That is possible by hacking it into a Schnorr signature (R,s) for the key P = xG = 1G = G
The Script performs the following steps:
- Verify the signature
(R,s)for the committed keyP = G. That's possible with op_checksig. - Get the sighash
Monto the stack using the Schnorr+CAT trick (requires a second signature) - Compute
c = Hash(R | P | M)using op_cat, op_sha256 - Compute
r' = s - cusing op_scalar_sub- this works because
s = r + c * x, andx = 1
- this works because
- Verify
r == r'
This proves that R is r * G, which is as good as computing the scalar multiplication ourselves. However, unfortunately, this works only for scalar multiplications with the generator point G. Still, that's useful.