1

I have a smart contract which verifies a signature from Bob in order to do something. The contract was made using SmartPy and for testing the scenario I used the following code to produce a signature:

bobSig = sp.make_signature(bob.secret_key, sp.pack(sp.record(gameName = gameName, bobScore = bobScore, aliceScore = aliceScore)))

Now I want to test the smart contract manually in tezos sandbox mode and I want to be able to serialize the data properly so that I can produce a signature using tezos-client sign bytes.

In other words, how can I do the equivalent of sp.pack(sp.record(gameName = gameName, bobScore = bobScore, aliceScore = aliceScore)) outside of SmartPy?

2

There are several steps:

  1. Produce a Michelson value for the record. It depends on the layout of the record and is shown in all SmartPy test transactions. (this is done by hand or with your language of choice). It will be something like (Pair "aaa" ...)
  2. Pack the value by calling the client with tezos-client hash data _data_ of type _type_ . _data_ is the result of the first point, _type_ is the Michelson type such as (pair string ...). (I think)
  3. call tezos-client sign bytes
| improve this answer | |

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.