Tonspack
  • 😇Welcome
  • ⛓️Chains support
  • 👻How it works ?
  • Developer
    • Get start
    • MPC part
    • SDK Rules
    • Http interface (centralized)
  • SDK
    • HD Wallet SDK
      • Get start
      • Chain support
      • NPM
      • Github
    • CloudStorage Wallet SDK
      • Get Start
      • Npm
      • Github
  • Links
    • Tonspack-webapp-wallet
    • Tonspack-bot
    • Demo-raydiumV3
    • Demo-raydium
    • Demo-solana-tools
Powered by GitBook
On this page
  • How Tonspack work ?
  • Tonspack working flow
  • How Tonspack using Bip-44 works ?

How it works ?

How tonspack wallet works ?

PreviousChains supportNextGet start

Last updated 8 months ago

Tonspack is a telegram base mulity chains support wallet .

Auth user base on telegram-webapp-initdata and telegram-BiometricManager .

How Tonspack work ?

The core of Tonspack wallet is Web3auth base telegram webapp initData MPC . Details of MPC part can be found .

Tonspack working flow

  • Login telegram webapp

  • Auth telegram webapp initData into . Generate JWT token.

  • Redirect JWT token into Tonspack wallet font-end .

  • Tonspack wallet font-end request Web3auth for it's privateKey part . And culcuate the privateKey in local font-end .

  • Using BIP-44 to generate the different keypair for chains in local font-end .

  • Do follow connect/sign message/send transaction in font-end .

How Tonspack using Bip-44 works ?

Example code how it works base on BIP44

function getKp(sk:string)
{
    const master = hd.hdkey.fromMasterSeed(Buffer.from(sk,'hex'));
    const derive = master.deriveChild(derivePath)
    const evmWallet = derive.getWallet()
    const naclKp = nacl.sign.keyPair.fromSeed(evmWallet.getPrivateKey())
    
    return {
        naclKp : naclKp,
        evmKp :  {
            address : evmWallet.getAddressString(),
            privateKey : evmWallet.getPrivateKeyString()
        },
        solKp : {
            address : bs58.encode(naclKp.publicKey),
            privateKey :bs58.encode(naclKp.secretKey),
        },
        tonKp : ton.getTonWalletV4KeyPair(
            Buffer.from(naclKp.secretKey),0),
        btcKp : btc.getKeyPair(
            Buffer.from(evmWallet.getPrivateKey())
        )

    } as objKP

The init sk comes from Web3auth SDK generate .

And it can generate different keypair by BIP-44 rules .

👻
here
Tonspack-mpc-auth-middleware