Business Integration Process

In the deployment model of SMN, the components highlighted in white are the parts that need to be developed. Developers need to implement their own business logic and functionalities in the Apps and backend services.
The SMN Relayer supports a high-availability and scalable architecture for horizontal clustering, relying on Redis or Redis Cluster for relaying messages between MPC Nodes. End-to-end encrypted communication is implemented between MPC Nodes.
Embedded MPC Node supports iOS, Android, and Browsers, while SMN Service supports server-side deployment via Docker images.
Usage Process
Taking two MPC participants as an example, where one party holds and manages key shares on the developer's server, and the other party is a mobile or browser application developed by the developer, which allows users to hold and manage key shares on their devices. The overall usage process of the SMN suite is as follows:
- Deploy SMN Relayer on the developer's server.
- Deploy and authorize SMN CA on the developer's server.
- Deploy SMN Service on the developer's server.
- Developers write backend wallet business logic services and integrate with the SMN Service API.
- Integrate Embedded MPC Node SDK into the mobile App.
Distributed key generation process (corresponding to the wallet creation scenario) is as follows:

- The mobile App submits a wallet creation action; the developer's backend service negotiates a SessionId with the mobile App, recommending the UUIDv4.
- The developer backend service and the mobile App each send Keygen instructions and the SessionId to SMN Service and Embedded MPC Node (libsmnSDK).
- SMN Service and Embedded MPC Node organize the execution of the MPC protocol and store key shares.
- SMN Service and Embedded MPC Node return the same KeyId and extended public key (xPub) to the developer's backend service and the mobile App respectively.
Since MPC is a distributed computation, there might be scenarios where the server completes the computation before the client, or vice versa. Therefore, it is recommended that developers, before proceeding with the business logic based on the key shares, determine through the developer's backend service whether all nodes involved in the computation have completed their tasks and have obtained the same KeyId and xPub. Only after confirming that results are the same should then proceed to subsequent steps.
For instance, in a scenario where both mobile and server sides are creating an MPC wallet, if the server receives the KeyId and xPub and deems the key share creation successful, proceeding to subsequent wallet creation, while the client, due to network issues, fails the final round of computation and does not obtain the local key share. Then, if the wallet functionality operates normally at this point, when the user attempts to transfer funds, the absence of the local key share would always cause the transaction to fail to sign, resulting in the potential loss of user assets.
Similar precautions apply to other MPC protocols; whether the developer server needs to determine whether all participants have completed the computation depends on the actual business scenario.
Distributed key signing process (corresponding to the transaction signing scenario) is as follows:

- The mobile application submits a transaction signing action, and the developer's backend service negotiates a SessionId with the mobile App.
- The developer's backend service and the mobile App each send distributed key signing instructions and the SessionId to SMN Service and Embedded MPC Node.
- SMN Service and Embedded MPC Node organize the execution of the MPC protocol and compute the signature.
- SMN Service and Embedded MPC Node return the same signature to the developer's backend service and the mobile App respectively.
Conclusion
The integration process for other MPC protocols is similar and can be summarized as follows:
- All participants negotiate a SessionId and computation instructions. For security, use a UUIDv4 generated by the server as the SessionId.
- All participants send instructions to their respective MPC Nodes.
- All participants receive the MPC protocol results individually.