Skip to content

Onboarding

Rubin address

The client application onboards the user by asking the user to sign a message using an existing wallet address. The v4-client-js library provides a function that deterministically generates the Rubin chain address (see accounts) and keys from the signed message. Once the keys are generated, the client application can use them to sign transactions on the Rubin chain on the user’s behalf, enabling secure and seamless interaction with the platform.

The payload doesn't matter to generate a Rubin address, but if you want to deterministically generate a Rubin address that matches what the Rubin Frontend generates, the payload must be byte-for-byte the same one the frontend signs:

"message": {
    "action": "Chain Onboarding"
  }

The payload typically looks like this:

Details
const ethersWallet = new ethers.Wallet('<wallet>');
const provider = new JsonRpcProvider('https://ethereum.publicnode.com', 1);
const signer = ethersWallet.connect(provider);
 
const signature = await signer.signTypedData(
  {
    name: 'RITBIT',
  },
  {
    RITBIT: [{ name: 'action', type: 'string' }],
  },
  {
    action: 'Chain Onboarding',
  },
);
 
const { mnemonic, privateKey, publicKey } = deriveHDKeyFromEthereumSignature(signature);

Subaccounts

Each main account has 128,001 subaccounts Subaccounts 0 to 127 are parent subaccounts. Parent subaccounts can have multiple positions opened and all positions are cross-margined. Subaccounts 128 to 128,000 are child subaccounts and are isolated margin. Child subaccounts will only ever have up to 1 position open.

Deposits and Withdrawals

Rubin uses a native bridge to move funds between supported source chains and the user's Rubin main account. Validators confirm deposits and sign withdrawals by consensus — there is no third-party bridge in the path.

For the user-facing flow, see:

After a deposit is credited to the main account, move the funds to a subaccount for trading. Before initiating a withdrawal, move the funds from the subaccount back to the main account.