Skip to main content

Quick Start

Demo

Try out the Dollar-Cost-Averaging demo that buys top memecoins on Base.

You can follow the end-to-end code for the DCA demo.

In this Quick Start guide you'll learn everything about Vincent Apps and how to register your own Vincent App. Follow the below steps to register your Vincent App:

1. Selecting Tools & Policies

  • Tools: Vincent Tools are the operations that an Agent can perform on behalf of the user and are codified as Lit Actions. Lit Actions are immutable Javascript code snippets assigned to the Agent's wallet. As a Vincent App developer you prompt the user, via the Consent Page, to delegate the execution of these Tools for their Agent wallets thus allowing you to autonomously execute these pre-defined operations on behalf of your users.

  • Policies: Users can set guard-rails for the permitted Tools to dictate the operating conditions for that Tool. Tools can have multiple Policies like max daily spend or 2FA and all these policies should be met before the Tool can sign using the delegated user's Agent wallet. This also becomes important since your AI Agents can occasionally halucinate. Just like the Tools, Policies are also codified as Lit Action and you as a developer prompt the user a set of optional Policies for each Tool via the Consent Page.

  • Policy Variables: Each Policy can optionally have multiple Policy Vars. For example, max spend policy can have two vars: spend duration (hourly/daily/weekly) and max spend amount ($). These Policy Vars values are fully configurable by the user.

  • Selecting from existing Tool-Policy Registry: You can select any of the following available Tools & their Policies to get quickly off the ground and register your Vincent App.

    Available Tools & Policies:

    ToolIPFS Cid
    ERC20 Token ApprovalQmPZ46EiurxMb7DmE9McFyzHfg2B6ZGEERui2tnNNX7cky
    Uniswap ToolQmZbh52JYnutuFURnpwfywfiiHuFoJpqFyFzNiMtbiDNkK
    PolicyIPFS Cid
    Spending LimitQmZrG2DFvVDgo3hZgpUn31TUgrHYfLQA2qEpAo3tnKmzhQ

    It's an ever expanding list and we're actively adding more Tools & Policies to the Registry.

    Note: The DCA example uses both the ERC20 Token Approval Tool & the Uniswap Tool because the user's first need to approve the ERC20 tokens to be used by the Uniswap contracts. Then they can set a spending limit for the Uniswap Tool.

  • Writing your own Tools & Policies: If none of the available Tool/Policies meet your needs you can write your own Lit Actions that signs using the user's delegated wallet.

2. Registering an App using the App Dashboard

App Dashboard

Please follow the below steps to register your App using the Dashboard.

Registering an App requires that you have gas on our Yellowstone blockchain. You can use the faucet to get some tokens for registering your App.

  • Management Wallet: Once you've selected your Tools & Policies (IPFS Cids) head over to the App Dashboard where you need to connect your EOA wallet. This is your App management account which is used for adding Delegatees, registering Vincent Apps on-chain and publishing newer versions of your existing Vincent Apps.

Connect App Management Wallet

  • Create New App: After you logged in and have selected the Tools & Policies you want to register your App with, you can create a new App by clicking on the "Create New App" button.

Create New App

  • Delegatees: Delegatees are EOA wallets generated in the App Dashboard that are allowed to execute the permitted Tools on behalf of your users. You need to register these Delegatee addresses on-chain and the Tools check whether the executor matches the on-chain Delegatee registered for the App.

Add Delegatees

3. Using the Vincent SDK

Vincent SDK

Please refer to the Vincent SDK API docs for a more comprehensive guide: https://sdk-docs.heyvincent.ai/

  • Handle User Login: You can use the Vincent Consent Page to sign-in users to your App instead of implementing a separate User Login flow. You need to provide a redirectUri in the URLSearch params (https://dashboard.heyvincent.ai/appId/160/consent?redirectUri=http://localhost:3000) to receive the signed JWT from the user's Agent Wallet after they log in on the Vincent Consent Page. This can be used as the User's Auth for your App, for example, use it as the user's access token for your API requests.

  • Install the Vincent SDK using NPM:

npm install @lit-protocol/vincent-sdk
import { getVincentWebAppClient } from '@lit-protocol/vincent-sdk';

const vincentAppClient = getVincentWebAppClient({ appId: MY_APP_ID });

// ... In your app logic:
if(vincentAppClient.isLogin()) {
// Handle app logic for the user has just logged in
const { decoded, jwt } = vincentAppClient.decodeVincentLoginJWT(EXPECTED_AUDIENCE);
// Store `jwt` for later usage; the user is now logged in.
} else {
// Handle app logic for the user is already logged in (check for stored & unexpired JWT)
// Handle app logic for the user is not yet logged in
vincentAppClient.redirectToConsentPage({ redirectUri: window.location.href });
}
  • Execute Tools for User's Wallet: This is where you provide all your AI-Agentic logic in the params object of the execute() function, for example, the tokens to buy and at what price.
import { ethers } from 'ethers';
import { getVincentToolClient } from '@lit-protocol/vincent-sdk';

const delegateePrivateKey = DELEGATEE_PRIVATE_KEY_GENERATED_FROM_APP_DASHBOARD;
const delegateeSigner = new ethers.Wallet(delegateePrivateKey, provider);
const vincentToolClient = getVincentToolClient({ ethersSigner: delegateeSigner, vincentToolCid: YOUR_TOOL_IPFS_CID });
// params = { amountIn: (wethAmount).toFixed(18).toString(), chainId: BASE_CHAIN_ID, pkpEthAddress: agentWalletAddress, rpcUrl: BASE_RPC_URL, tokenIn: WETH_ADDRESS }
const res = await vincentToolClient.execute({ params }); // This is the result of executing the Tool usually a txReceipt for the broadcasted tx