bitshares.aio.message module

class bitshares.aio.message.Message(*args, **kwargs)[source]

Bases: bitshares.aio.instance.BlockchainInstance, bitshares.aio.message.Message

MESSAGE_SPLIT = ('-----BEGIN BITSHARES SIGNED MESSAGE-----', '-----BEGIN META-----', '-----BEGIN SIGNATURE-----', '-----END BITSHARES 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]}'
bitshares

Alias for the specific blockchain.

blockchain
blockchain_instance_class

alias of bitshares.aio.instance.BlockchainInstance

chain

Short form for blockchain (for the lazy)

define_classes()[source]

Needs to define instance variables that provide classes

get_instance_class()

Should return the Chain instance class, e.g. bitshares.BitShares

classmethod inject(cls)
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)[source]

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.aio.message.MessageV1'>, <class 'graphenecommon.aio.message.MessageV2'>)
valid_exceptions = (<class 'graphenecommon.exceptions.AccountDoesNotExistsException'>, <class 'graphenecommon.exceptions.InvalidMessageSignature'>, <class 'graphenecommon.exceptions.WrongMemoKey'>, <class 'graphenecommon.exceptions.InvalidMemoKeyException'>)
verify(**kwargs)[source]

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