Skip to content
On this page


Some constructions are only available in tests, not in smart contracts.


Creating a deterministic key-pair from a seed string:

# seed is `Alice`
alice = sp.test_account("Alice")

It produces an object with the following properties:

alice.addresssp.TAddressGives the public-key-hash
alice.public_key_hashsp.TKeyHashGives the public-key-hash
alice.public_keysp.TKeyGives the public-key
alice.secret_keysp.TStringGives the secret-key

sp.make_signature(secret_key, message, message_format = 'Raw')

Forges a signature compatible with sp.check_signature(...).

message_format field accepts two values:

  • Hex in which case the message will be interpreted as an hexadecimal string;
  • Raw (the default) in which case the message is a sp.TBytes value (usually the result of an sp.pack call).


sp.test_account methods and sp.make_signature are not available for compilation to Michelson (a smart contract cannot manipulate secret keys).