The ICO sale process

We will assume that all other prerequisites are met including website account creation, email verification, KYC and AML checks etc.

1. User comes on to the dashboard and sees a button to create a wallet (IM).

2. Upon clicking, an offline Stellar keypair (only for the first time) is generated for the user. The secret is saved in the browser temporarily for the upcoming set of transactions.

3. User is prompted to save this keypair securely (An option can be given where we generate a keystore file locked with a password and save it on the server).

4. The user is then prompted to enter the secret key again in order to proceed with the next step. This is to ensure that user has saved the private key.

5. In the background (via xhr), we fund IM with 3 XLM thereby activating it (calculations later). The server responds with a success status along with CO’s public key.

6. Upon successful activation, we create a transaction with following operations on IM (this transaction envelope (XDR) is sent to server instead of Stellar)

- Request trustline for token

- Add CO as a signer with weight 1

- Set all thresholds to 2

- Set own weight to 1

7. Server submits this transaction on Stellar and then approves the trustline from the token issuing account. Wallet is now set up to receive funds (XLM) from external sources and ready to buy tokens from SDEX.

8. User is now presented a button to buy tokens. On clicking, we ask user to deposit XLM in IM from anywhere they want. It could be their own Stellar wallet or an exchange as well.

9. Browser shows a waiting status while it waits for an incoming transaction. We check this by using Server-Sent Events (streaming) mode.

10. Upon receiving funds, we create the following transactions (partially signing it using the secret key saved in the browser):

Transaction #1: (N)

- Send 3 XLM to CO (recovering the account activation funds — one time only)

- Create an offer on SDEX to buy tokens for all but 3 XLM in account

Transaction #2: (N + 1) Time locked for the duration of ICO

- Remove CO as a signer from this account

- Reset thresholds

11. Both transactions are sent to the server. Transaction #1 is signed by CO and submitted directly to Stellar network. Transaction #2 is signed and its hash and transaction envelope are saved on server. Server also returns these to the user if they want to verify and save it with them.

12. Every time the user wants to transfer funds, steps 8 to 11 are repeated.

The server will post this transaction #2 in step 10 upon completion of the ICO regardless the ICO succeeds or not.

In case of when ICO is successful, the tokens are already in user’s account with full control of the account as well. The dashboard can provide quick and easy options to transfer these funds to a different account or merge it with another account etc.

In case of when it fails, we are locked by a different set of SSCs which keeps both us and our users protected. We will again provide simple options on the dashboard to claim the funds back.