1

I wanna ask about the parameters s and b in the cryptographic function:

sp.check_signature(k, s, b)

the second parameter s: is the string that we should inject in the blockchain or the signature of the value returned by the Forge operation?

the third parameter b: is the value returned by the Forge operation?

Thank you in advance.

2

The SmartPy manual (https://smartpy.io/demo/reference.html#_cryptography) says that:

sp.check_signature(k, s, b): Determine whether the signature s (a sp.TSignature value) has been produced by signing b (a sp.TBytes value) with the private key corresponding to k (a sp.TKey public key value).

It simply computes a boolean after checking that the data in 'b' has been signed by 'k' into 's'.

  • So we can siply use it this way: sp.verify(sp.check_signature(params.k, params.s, params.b) == True) to evaluate the signature? – Daly Feb 1 '20 at 19:43
  • 1
    Yes. More properly, the == True is as always useless so: sp.verify(sp.check_signature(params.k, params.s, params.b)) is typically the right way to do it. It's used everywhere in the State Channel template smartpy.io/demo/index.html?template=stateChannels.py. – FFF Feb 1 '20 at 23:23
  • Thank you very much ! – Daly Feb 2 '20 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.