LogoLogo
  • General
    • 👋Welcome to Kinto
    • 📔Terminology
    • 📃Litepaper
    • 📄One Pager
    • 🔗Links
    • 🤝Partners and Collaborators
    • ❓FAQ
  • User Guides
    • 🌟Sign Up Walkthrough
    • 🗝️KYC Walkthrough
      • 🔑Synaps Walkthrough
      • 🔑Plaid Walkthrough
    • 📄KYB Walkthrough
    • 🪟Passkeys on Windows Walkthrough
    • Setting up a 1Password Passkey
    • ❔Troubleshooting/Help
    • 💰Kinto Deposits
      • Onramp on Kinto
    • 💸Kinto Withdrawals
      • 🗝️Recover funds from my Passkey address
      • 🎁Wrapping ETH in your Kinto Wallet
      • Offramp on Kinto
    • Swap on Kinto
    • Lending & Borrowing
    • Hyperliquid
      • Fees
      • Deposits
      • Creating Orders
      • Closing an Order
      • Withdrawals
    • Send to other Kinto Wallets
    • Token Sale Participation
    • Full Account Recovery
    • $K Transfer
      • Withdraw $K
      • Send $K on Kinto
      • Deposit $K
      • Swap $K on Kinto
    • Recover Funds from an X Signer
    • $K Lend and Borrow Market
      • Supply USDC to $K Lending Market
      • Withdraw USDC from $K Lending Market
      • Add $K and Borrow USDC
      • Repay USDC and Withdraw $K
  • Security/KYC/AML
    • 🔑Securing Kinto
    • 📃Security One Pager
    • 🔐Security and Risk Management
    • 🛡️Wallet Insurance
    • ⚙️User Owned KYC
    • 🏳️Enabled Countries
    • 🔒Beware of Scams
    • ✅Kinto Validators
    • 🤺Security Council
  • Building on Kinto
    • ℹ️Network Information
    • 🧱Kinto Rollup Architecture
    • ❕Differences with other rollups
    • 🤖Rollup Features
      • ⚙️Create2
      • 🔥Kinto Account Abstraction
      • 🛡️KintoWallet
      • 🪢Musubi - Chain Abstraction
    • 💻Development guide
      • 1️⃣1️⃣ Setup your Deployer EOA
      • 2️⃣2️⃣ Environment setup
      • 3️⃣3️⃣ Creating your Kinto App
    • ⛩️Interacting with your Kinto App
      • 🤖Interacting with contracts
      • 👩‍🏭Create a Web Dapp
    • 📗Smart Contract Reference
      • KintoAppRegistry
      • KintoID
      • KintoWalletFactory
      • Kinto Wallet
      • SponsorPaymaster
      • Kinto EntryPoint
      • KYCViewer
      • Faucet
      • EngenCredits
      • EngenGovernance
    • 🌍Kinto Wallet Web SDK
    • 🏪Running kinto nodes
    • ⚒️Tools
      • ⛈️Node RPC
      • 🏗️Build Tools
      • 🗺️Block Explorer
      • 🐞Debugging and monitoring
      • 🔮Oracle - Pyth
      • Firewall - Venn
    • 🚀ICO Platform
  • Governance
    • 🧠Introduction to the Kinto DAO
    • 📓Kinto Constitution
    • 📃KIP Proposal Template
    • 🌄Engen Proto-Governance
    • ⛩️Kinto Token
      • Information, addresses and links
  • 💧Liquidity Programs
    • 🛠️Mining Program
    • ⚫Engen - Launch Program
    • 🪙K Token Sale
  • Sakura Mining Season
Powered by GitBook
On this page
  1. Building on Kinto
  2. Tools

Firewall - Venn

This page describes how to integrate Venn.

PreviousOracle - PythNextICO Platform

Last updated 6 months ago

Venn Network is an advanced security layer that you can easily add on top of your smart contracts. Learn more at: Try it: Code it:

Instructions

In this challenge, you'll deploy a new Venn Firewall and integrate it into your smart contracts to enhance your project's security.

Once completed, you'll also need to integrate Venn DApp SDK to your DApp's Frontend so that transactions get approved before being sent onchain.

Step 1: In This Repo

  1. Clone the repo and install dependencies: git clone https://github.com/ironblocks/DC7-SEA npm ci

git clone https://github.com/ironblocks/DC7-SEA npm ci
  1. Setup your private key and hardhat network configuration

cp .env.example .env

PRIVATE_KEY=... 
RPC_URL=...
  1. Compile

npm run firewall:compile # the warning are a feature, not a bug 😅
  1. Deploy a new Firewall

Venn Firewall is an onchain solution that can surgically prevent malicious transactions from going through, only allowing approved transactions to be executed.

npm run firewall:deploy -- --network
  1. Note the new venn.config.json file that was created with the Firewall address in it. We'll use this later in Step 4.

Step 2: In Your Smart Contracts Repo

Now that the Firewall is deployed, you'll use various Venn SDKs to integrate Venn with your project.

  1. Install the CLI:

npm i -g @vennbuild/cli
  1. Run the CLI to add the Firewall to your smart contracts:

venn fw integ -r -d contracts
  1. Deploy your contracts as you normally would:

hardhat run scripts/deploy.js # your deployment script

Step 3: Back In This Repo

Now that your smart contracts have integration with Venn, you'll need to send a setup transaction to enable the Firewall.

  1. Remember venn.config.json ? time to use it. Open this file and add your contracts addresses:

{
        "networks": { 
                "holesky": { 
                       "firewall": "0x123...",

                        "contracts": { 
                                "MyContract1": "0x11111...", 
                                "MyContract2": "0x22222..."
                         } 
                  }
          } 
}
  1. Run the setup script. This script will send setup transactions from the PRIVATE_KEY you've configured in the .env file to turn on the Firewall on each of your contracts:

npm run firewall:setup -- --network

Step 4: Your Repo Again (last time)

With the Venn Firewall enabled on your smart contracts, transactions need to be approved via Venn Network before they can be submitted on chain.

To do this, you'll add our Venn DApp SDK to your DApp's Frontend.

  1. Install the SDK:

npm i @vennbuild/venn-dapp-sdk
  1. Create a new instance of the SDK Client:

import { VennClient } from '@vennbuild/venn-dapp-sdk';

const vennURL = "https://dc7sea.venn.build/sign"; 
const vennPolicyAddress = YOUR FIREWALL ADDRESS;

const vennClient = new VennClient(
{ 
    vennURL, 
    vennPolicyAddress 
});
  1. Update your DApp to approve transactions before submitting them onchain:


//You probably have something like this: 

const tx = { to, from, data, value }; 
const receipt = await 
wallet.sendTransaction(approvedTransaction);

//But now you need this: 
const tx = { to, from, data, value }; 
const approvedTransaction = await 
vennClient.approve(tx); 
const receipt = await 
wallet.sendTransaction(approvedTransaction);

Step 5: Removing the Firewall Just run this:

npm run firewall:remove -- --network <network>

Happy coding!

⚒️
Venn Site
Venn Playground
Source Code Repo