Overview
Kakarot is a provable EVM built on the Cairo ZK-VM, Starkware's turing complete and efficient ZK-VM. For more information, visit Kakarot's documentation.
Kakarot on Starknet allows for EVM applications to interact with Starknet as well as interoperability between EVM tools and Cairo dApps.
Kakarot connectors allows EVM wallet users (non-Snaps Metamask, Rabby, Subwallet EVM, Phantom EVM) to connect to Starknet dApps (i.e. developped in Cairo) with an EVM wallet. It is a set of connectors based on wagmi EVM connectors.
The library is able to detect EVM connectors that the user has installed on their browser based on EIP-6963.
Getting Started
npm add @starknet-react/kakarot
Here is an example code snippet to add Kakarot connectors in a dApp.
import React from "react";
import {
StarknetConfig,
useInjectedConnectors,
argent,
braavos,
publicProvider,
voyager,
} from "@starknet-react/core";
import { sepolia, mainnet } from "@starknet-react/chains";
import { Chain } from "@starknet-react/chains";
import { kakarotConnectors } from "@starknet-react/kakarot";
export function StarknetProvider({
children,
defaultChain,
}: {
children: React.ReactNode;
defaultChain: Chain;
}) {
const chains = [sepolia, mainnet];
const provider = publicProvider();
console.log("provider", provider);
const { connectors } = useInjectedConnectors({
// Show these connectors if the user has no connector installed.
recommended: [argent(), braavos(), ...kakarotConnectors(provider)],
// Hide recommended connectors if the user has any connector installed.
includeRecommended: "always",
// Randomize the order of the connectors.
order: "alphabetical",
});
return (
<StarknetConfig
chains={chains}
connectors={connectors}
provider={publicProvider()}
explorer={voyager}
defaultChainId={defaultChain.id}
>
{children}
</StarknetConfig>
);
}
How It Works
When using Kakarot on Starknet, users manipulate two addresses:
- their EVM address (associated with their EOA's signing key or their ERC-4337 account);
- an underlying Starknet account which address is derived from the user's EVM address. It can be queried using kakarot core smart contract's method
get_starknet_address(felt evm_address)
Wallet interaction:
- User connects their EVM wallet, the Kakarot Core smart contract deployed on Starknet resolves the Starknet address associated to the user's EVM account.
- Upon performing an action on a Starknet dApp with the Kakarot connector, a transaction targeting the Kakarot Multicall Cairo Precompile that will perform the expected call is generated.
- User is able to see their underlying Starknet address with the Kakarot connector, as well as access their transaction status and data.