graphenecommon.memo module

class graphenecommon.memo.Memo(from_account=None, to_account=None, **kwargs)

Bases: graphenecommon.instance.AbstractBlockchainInstanceProvider

Deals with Memos that are attached to a transfer

  • from_account (account.Account) – Account that has sent the memo
  • to_account (account.Account) – Account that has received the memo
  • blockchain_instance (instance) – instance to use when accesing a RPC

A memo is encrypted with a shared secret derived from a private key of the sender and a public key of the receiver. Due to the underlying mathematics, the same shared secret can be derived by the private key of the receiver and the public key of the sender. The encrypted message is perturbed by a nonce that is part of the transmitted message.

from .memo import Memo
m = Memo("from-account", "to-account")
enc = (m.encrypt("foobar"))
>> {'nonce': '17329630356955254641', 'message': '8563e2bb2976e0217806d642901a2855'}
>> foobar

To decrypt a memo, simply use

from memo import Memo
m = Memo()

if op_data being the payload of a transfer operation.


Decrypt a message

Parameters:message (dict) – encrypted memo message
Returns:decrypted message
Return type:str

Encrypt a memo

Parameters:message (str) – clear text memo message
Returns:encrypted message
Return type:str
unlock_wallet(*args, **kwargs)

Unlock the library internal wallet