Prime Architecture

How does Prime Protocol work?

Hub and Spoke Architecture

Prime Protocol uses a hub and spoke architecture as a part of its connected contracts approach. Moonbeam serves as Prime’s hub, allowing for the protocol to connect with other major ecosystems through decentralized message passers, while also connecting with other parachains in the ecosystem. Every time a user conducts an operation – even if they are depositing or borrowing on a different chain – a transaction is executed on Moonbeam to certify that change of account state. The vast majority of protocol logic lives on Moonbeam, and most of the gas required to power Prime Protocol is spent on Moonbeam.

Message Passing

Prime protocol utilizes generic message passing protocols to connect with chains outside the Moonbeam Ecosystem. To ensure robustness of the protocol regardless of what the future may hold, Prime Protocol features a router and standard messaging interface that can plug into any interoperability protocol. All user flows that may require a message to be passed – deposit, withdraw, borrow, repay, and liquidate – are packaged into a payload and sent to and from Moonbeam via a generic messaging protocol. Before a message is sent, a unique hash of that message’s payload with some metadata is stored on the sending contract. This ensures there is a record of the messages queued for delivery, so if anything were to go wrong with the message delivery, the tokens locked on the sending chain are not lost. For example, if the chosen message passer is paused or exploited, the messages could be routed over a different message passer to ensure delivery. On the receiving side, a queue of message hashes are stored to prevent replay attacks, and ensure every message received is processed exactly once. This means that a message that failed to deliver or was delayed could be re-sent over a different route. It also offers protection against one of the most common forms of bridge hacks. Currently, Prime leverages Axelar to securely deliver these messages and Wormhole as an alternative route. Both Axelar and Wormhole are excellent solutions, and the integrations with each have been fully audited. There has never been an issue with the consensus mechanism for either protocol, and the relayers they use are completely trustless. Prime Protocol does not rely on any token bridges, only the core message passing layers.

Last updated