Cryptography
Some constructions are only available in tests, not in smart contracts.
- sp.test_account(seed) → test_account
Creating a deterministic key-pair from a seed string:
python# seed is `Alice` alice = sp.test_account("Alice")
It produces an object with the following properties:
Property Type Description alice.address sp.address
Gives the public-key-hash alice.public_key_hash sp.key_hash
Gives the public-key-hash alice.public_key sp.key
Gives the public-key alice.secret_key sp.string
Gives the secret-key
- sp.make_signature(secret_key, message, message_format = 'Raw') → sp.signature
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.bytes
value (usually the result of ansp.pack
call).
INFO
sp.test_account
methods and sp.make_signature
are not available for compilation to Michelson (a smart contract cannot manipulate secret keys).