bitshares.memo module

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

Bases: object

Deals with Memos that are attached to a transfer

Parameters:

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 bitshares.memo import Memo
m = Memo("bitshareseu", "wallet.xeroc")
m.bitshares.wallet.unlock("secret")
enc = (m.encrypt("foobar"))
print(enc)
>> {'nonce': '17329630356955254641', 'message': '8563e2bb2976e0217806d642901a2855'}
print(m.decrypt(enc))
>> foobar

To decrypt a memo, simply use

from bitshares.memo import Memo
m = Memo()
m.bitshares.wallet.unlock("secret")
print(memo.decrypt(op_data["memo"]))

if op_data being the payload of a transfer operation.

decrypt(memo)

Decrypt a memo

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

Encrypt a memo

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

Unlock the library internal wallet