Memo Length Reduction
Given the complexity of memos, they can become very long, beyond the limits of chains like Bitcoin. Various methods have been developed to significantly shorten memo length. Example:
SWAP:ETH.ETH:0xe6a30f4f3bad978910e2cbb4d97581f5b5a0ade0:1612345678:thor1el4ufmhll3yw7zxzszvfakrk66j7fx0tvcslym:10can be reduced to
SWAP:ETH.USDT-0xdac17f958d2ee523a2206206994597c13d831ec7:0xe6a30f4f3bad978910e2cbb4d97581f5b5a0ade0:10012345678:thor1el4ufmhll3yw7zxzszvfakrk66j7fx0tvcslym:10can be reduced to
The examples below use the following features to reduce memo length:
=:ETH.ETH:0x388C818CA8B9251b393131C08a736A67ccB19297is reduced to
=:e:0x388C818CA8B9251b393131C08a736A67ccB19297,Swap for Ether.
=:r:thor1el4ufmhll3yw7zxzszvfakrk66j7fx0tvcslym- Swap to RUNE.
Assets can be abbreviated using fuzzy logic. The following will all be matched appropriately. If there are conflicts, then the deepest pool is matched to prevent attacks.
THORNames allows a custom name to be assigned to an address, like an alias, so the address does not need to be specified.
thor1nt2d4kmj0xd6xxm3m82tac3d20y05dm0vv7ur3can be specified as
Memos contain functions such as Swap or Add, which describe the user's intent and are sent along with specific parameters. Functions can be reduced in the following way:
=SWAP:e:0x388C818CA8B9251b393131C08a736A67ccB19297is reduced to
In THORChain memos and the state machine, asset amounts are expressed as Base in 1e8 format requiring many digits to express an amount. E.g. 0.01 BTC is expressed as
1000000and 5 Ether is expressed as
To help save space in memos, scientific notation can shorten memos by specifying both significant digits and the amount of trailing zeros. Note that using scientific notation in memos always leads to a loss of precision, so ensure enough significant digits are used to express the amount properly. For example, using
1612345678results in a loss of precision.
- In memo:
1e8-> THORChain reads:
- In memo:
51e7-> THORChain reads:
Full Memo Example:
SWAP:ETH.ETH:0x388C818CA8B9251b393131C08a736A67ccB19297:1612341234:thor19emplkuphjk2y9gkkv06m8vcstc0ufn4pevv5u:10is reduced to