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.TAddress Gives the public-key-hash alice.public_key_hash sp.TKeyHash Gives the public-key-hash alice.public_key sp.TKey Gives the public-key alice.secret_key sp.TString 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.TBytes value (usually the result of an
sp.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).