peerplays.message module

class peerplays.message.Message(*args, **kwargs)

Bases: peerplays.instance.BlockchainInstance, peerplays.message.Message

MESSAGE_SPLIT = ('-----BEGIN PEERPLAYS SIGNED MESSAGE-----', '-----BEGIN META-----', '-----BEGIN SIGNATURE-----', '-----END PEERPLAYS SIGNED MESSAGE-----')
SIGNED_MESSAGE_ENCAPSULATED = '\n{MESSAGE_SPLIT[0]}\n{message}\n{MESSAGE_SPLIT[1]}\naccount={meta[account]}\nmemokey={meta[memokey]}\nblock={meta[block]}\ntimestamp={meta[timestamp]}\n{MESSAGE_SPLIT[2]}\n{signature}\n{MESSAGE_SPLIT[3]}'
SIGNED_MESSAGE_META = '{message}\naccount={meta[account]}\nmemokey={meta[memokey]}\nblock={meta[block]}\ntimestamp={meta[timestamp]}'
blockchain
blockchain_instance_class

alias of peerplays.instance.BlockchainInstance

chain

Short form for blockchain (for the lazy)

define_classes()

Needs to define instance variables that provide classes

get_instance_class()

Should return the Chain instance class, e.g. peerplays.PeerPlays

classmethod inject(cls)
peerplays

Alias for the specific blockchain

classmethod set_shared_blockchain_instance(instance)

This method allows us to override default instance for all users of SharedInstance.instance.

Parameters:instance (chaininstance) – Chain instance
classmethod set_shared_config(config)

This allows to set a config that will be used when calling shared_blockchain_instance and allows to define the configuration without requiring to actually create an instance

set_shared_instance()

This method allows to set the current instance as default

shared_blockchain_instance()

This method will initialize SharedInstance.instance and return it. The purpose of this method is to have offer single default instance that can be reused by multiple classes.

sign(*args, **kwargs)

Sign a message with an account’s memo key

Parameters:account (str) – (optional) the account that owns the bet (defaults to default_account)
Raises:ValueError – If not account for signing is provided
Returns:the signed message encapsulated in a known format
supported_formats = (<class 'graphenecommon.message.MessageV1'>, <class 'graphenecommon.message.MessageV2'>)
valid_exceptions = (<class 'graphenecommon.exceptions.AccountDoesNotExistsException'>, <class 'graphenecommon.exceptions.InvalidMessageSignature'>, <class 'graphenecommon.exceptions.WrongMemoKey'>, <class 'graphenecommon.exceptions.InvalidMemoKeyException'>)
verify(**kwargs)

Verify a message with an account’s memo key

Parameters:account (str) – (optional) the account that owns the bet (defaults to default_account)
Returns:True if the message is verified successfully

:raises InvalidMessageSignature if the signature is not ok