Skip to content

Demonstration of ERC token deployment using BuilderVault MPC wallet with Web3 Provider SDK

License

Notifications You must be signed in to change notification settings

Blockdaemon/demo-buildervault-token-deployment

Repository files navigation

Demo Builder Vault ERC token deployment

  • Runs local Ethereum chain fork - Anvil
  • Creates MPC wallet master key with 2 key shares
  • Derives wallet addresses from master key
  • Funds wallet with anvil override RPC
  • Deploys sample ERC1404 token contract
  • Mints tokens to recipient wallet
sequenceDiagram
    autonumber
    actor client as Application<br>(Builder Vault SDK)

    box Builder Vault
      participant TSM1 as MPC Wallet <br>(key share 1)
      participant TSM2 as MPC Wallet <br>(key share 2)
    end
    participant Blockchain as Ethereum Blockchain<br>(Anvil)

    note over client,TSM2: Create MPC Wallet Master Key
    par
      client ->> TSM1: create master key
      TSM1 -->> client: return master key id
    and
      client ->> TSM2: create master key
      TSM2 -->> client: return master key id
    end


    note over client,Blockchain: Deploy ERC1404 token contract
    client ->> TSM1: derive ethereum address from public key
    client ->> client: craft contract deployment transaction
    par
      client ->> TSM1: request signature (unsigned tx hash of ERC1404 contract deployment)
      TSM1 -->> client: return partial signature
    and
      client ->> TSM2: request signature (unsigned tx hash of ERC1404 contract deployment)
      TSM2 -->> client: return partial signature
    end
    client ->> client: combine partial signatures
    client ->> Blockchain: broadcast signed contract deployment

    note over client,Blockchain: Mint ERC1404 tokens
    client ->> client: craft mint transaction
    par
      client ->> TSM1: request signature (unsigned tx hash of mint transaction)
      TSM1 -->> client: return partial signature
    and
      client ->> TSM2: request signature (unsigned tx hash of mint transaction)
      TSM2 -->> client: return partial signature
    end
    client ->> client: combine partial signatures
    client ->> Blockchain: broadcast signed mint transaction

Loading

Prerequisites

Step 1. Install dependencies

# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup

# Set Builder Vault nodejsSDK public repository
npm config set @sepior:registry=https://gitlab.com/api/v4/projects/56306653/packages/npm/   
npm install # Installs Builder Vault Web3 Provider

Step 2. Run local EVM chain

anvil

Step 3. Generate BuilderVault Wallet Master Key for use with transaction signing operations

  • note the MPC Master Key ID output for use with environment variable MASTERKEY in the next step.
node generate-masterkey.ts

Step 4. Run sample app with BuilderVault Web3 Provider to deploy ERC1404 token contract and mint tokens

MASTERKEY=<master-key-id> NODE_ENV=development node main.ts

About

Demonstration of ERC token deployment using BuilderVault MPC wallet with Web3 Provider SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published