Technology
An overview of MAYAChain's 1-way State Pegs, State Machine and TSS Protocol.
Last updated
An overview of MAYAChain's 1-way State Pegs, State Machine and TSS Protocol.
Last updated
MAYAChain is a leaderless vault manager:
1-way State Pegs allow syncing state from external chains.
A State Machine to coordinate asset exchange logic and delegate outgoing transactions.
BifrΓΆst Chain Client to processs chain-specific transactions.
A TSS protocol to enable distributed threshold key-signing.
Each node has a "BifrΓΆst" service that deals with the nuances of connecting to each chain. Once nodes are synced, they watch vault addresses. If they ever see an inbound transaction, they read it and convert it into a MAYAChain witness transaction.
The witness transaction has the following parameters that are essentially the same for each chain, no matter the type:
MAYAChain processes each observed transaction and waits for consensus. Once a super-majority of nodes agree on a particular transaction, it moves from a pending
state to a finalised state.
Each chain client is quite light-weight, containing only as much logic as is necessary to connect to that particular chain. Most of the logic is in the observer itself.
The state machine processes the finalised transaction and performs logic, such as ordering transactions, computing state changes, and delegating them to a particular outbound vault. Finally, a txOut
item is created and stored in the Key-Value store.
The txOut
looks like the following:
The Transaction Out item details which chain it should be sent on, the destination address, the vault it should be sent from, and the maximum gas that should be spent. It also has fields for the transaction that initiated it (the InHash
) and the transaction that will complete the accounting (the OutHash
).
Once the finalised transaction is created, the Signer loads it from their local copy and serialises it into a correct transaction for the destination chain using the respective chain client. This is then sent to the TSS module which coordinates key-signing. The final signed transaction is then broadcast to the respective chain.
There are two types of vaults in MAYAChain's system - "inbound vaults" and "outbound vaults":
Asgard TSS Vaults - inbound vaults with large committees (27-of-40)
This allows the system to use the security of the large vaults to hold the bulk of assets, but delegate to the small, fast outbound vaults the outgoing assets. Every MAYANode runs an outbound vault.
In order to further increase the node count to beyond 40 nodes, the system shards Asgard vaults into two when it approaches the MaxNodesForAsgard
constant (and merges them if two ever drop below half of this). As such, with 100 nodes, there would be 3 Asgard vaults, with 100 yggdrasil vaults. The system constantly checks which vault has the highest excess security, and instructs users to send funds there.
When the network churns, it creates new public keys and migrates the funds forward. The churning process is split up in 5 different transactions, 1 per asset (identified by migrate
memo). It typically takes a few hours to complete. Users are instructed to only send funds to the newest vault, but the retiring vault is monitored. Once the last of the 5 migrations is complete, the previous vault is discarded and no longer monitored.
The previous vault cannot be monitored forever since it can not be guaranteed that all nodes in that vault are still online, and it becomes an attack vector to keep old vaults "around".
If you send funds to a retired vault (likely by caching the address) your funds will be forever lost and is impossible to be recovered.