LogoLogo
  • Venn Network
    • Introduction to Venn
    • Getting Started
      • Protocols & Developers
        • Installation
        • Testnet Guide
        • Venn CLI
        • Venn DApp SDK
        • How It Works
        • Roles
      • Node Operators
        • Installation
        • Configuration
        • Testnet Guide
      • Security Teams
        • Build Custom Detector
        • API Reference
        • Security Sandbox
      • Venn Safe Guard
        • Bypass Mechanism
      • Venn Wallet RPC
        • Custom RPC in MetaMask
    • Explorer
    • Playground
    • Use Cases
    • Roadmap
    • Consensus Model
    • Litepaper
    • FAQ
    • Community
    • Audit Reports
Powered by GitBook
On this page
  • Overview
  • To protect your protocols with Venn you will need to:
  • Step 1 - Integrate the Firewall SDK
  • Install the Venn CLI
  • Integrate the Firewall SDK
  • Step 2 - Register your smart contracts with Venn.
  • Before You Begin
  • Configuration
  • Connect To Venn
  • Your Venn Policy
  • Step 3 - Set Up the dApp SDK on your frontend.
  • Install the SDK
  • Initialize a New VennClient Instance
  • Approving Transactions
  • Reference Documentation

Was this helpful?

  1. Venn Network
  2. Getting Started
  3. Protocols & Developers

Installation

Welcome to the Venn Network installation guide for protocols and developers. This guide details the steps needed to secure your protocols with Venn.

PreviousProtocols & DevelopersNextTestnet Guide

Last updated 2 months ago

Was this helpful?


Overview

To protect your protocols with Venn you will need to:

  1. Integrate the Firewall SDK into your smart contracts.

  2. Register your smart contracts on-chain with Venn.

  3. Install the dApp SDK on your frontend.

Before you start the installation, take some time to familiarize yourself with the Venn stack using the tools designed specifically for developers: A demo dApp that enables you to try Venn integrations, helping you understand how Venn works.

A “Hello World” repository designed to gain hands-on experience with the integration process and explore Venn's capabilities in a local controlled environment.


Step 1 - Integrate the Firewall SDK

Install the Venn CLI

Start by installing the Venn CLI. This will allow you to add the Firewall SDK to your smart contracts and register them on the chain.

npm i -g @vennbuild/cli

This command installs the CLI globally, making the venn command available in your terminal.

Integrate the Firewall SDK

venn fw integ -d contracts

This command scans all smart contracts in the contracts folder and automatically adds the required import VennFirewallConsumer to the external functions.

Example:

Before Integration:

pragma solidity ^0.8;

contract MyContract {
    
    myMethod() {
        ...
    }
}

After Integration:

pragma solidity ^0.8;

import {VennFirewallConsumer} from "@ironblocks/firewall-consumer/contracts/consumers/VennFirewallConsumer.sol";

contract MyContract is VennFirewallConsumer {

    myMethod() firewallProtected {
        ...
    }
}

Now that your smart contracts include the Firewall SDK, deploy them as you normally would on any network - this will enable you to register them on-chain to Venn, in the next step.


Step 2 - Register your smart contracts with Venn.

This step connects your Firewall-protected smart contracts to the Venn Network on-chain by sending setup transactions.

Before You Begin

  • Complete step 1: Firewall SDK integration on your smart contracts.

  • Ensure your smart contracts are deployed on-chain.

  • Have your deployment private key ready (this must be the same key used for deployment).

Configuration

  1. Create a configuration file named venn.config.json in your project’s root directory.

  2. Update the file with your deployed contract addresses. Example:

{
    "networks": {
        "holesky": {
            "contracts": {
                "MyContract1": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
                "MyContract2": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
            }
        }
    }
}
  • Each key in the contracts object is the Name of the contract

  • Each value in the contracts object is the Address of the contract

  1. Create an environment variable called VENN_PRIVATE_KEY with the private key that deployed your smart contracts.

IMPORTANT: This key must be the same key that deployed the smart contracts

Connect To Venn

Run this command to register your Firewall-protected smart contracts with Venn:

venn enable --network holesky

Your Venn Policy

After a successful connection to Venn, a new Venn Security Policy is created for you. The policy address is automatically saved in your venn.config.json file, for example:

{
    "networks": {
        "holesky": {
            "contracts": {
                "MyContract1": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
                "MyContract2": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
            },

            // YOUR VENN POLICY ADDRESS
            "policyAddress": "0x123..."
        }
    }
}

You will use thepolicyAddress in the next step, when setting up your dApp frontend.


Step 3 - Set Up the dApp SDK on your frontend.

Now that your smart contracts are secured, only approved transactions will be executed on-chain. To also approve transactions that go through your dApp frontend, you will need to install Venn-SDK in your dApp.

Install the SDK

In your dApp frontend project, open a new terminal and install the SDK.

npm i @vennbuild/venn-dapp-sdk

Initialize a New VennClient Instance

Import the VennClient and create a new instance by providing the Venn node URL and your Venn policy address from step 2:

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

const vennURL           = process.env.VENN_NODE_URL;          // URL of your Venn node operator
const vennPolicyAddress = process.env.VENN_POLICY_ADDRESS;      // Your Venn policy address

const vennClient = new VennClient({ vennURL, vennPolicyAddress });
  • vennURL, a URL pointing to a Venn node operator:

Venn node operator:
https://signer2.testnet.venn.build/api/17000/sign
  • vennPolicyAddress: the policyAddress You got from "Register With Venn" in step 2.

Approving Transactions

Use the SDK to validate transactions before sending them on-chain:

const approvedTransaction = await vennClient.approve({
    from,
    to,
    data,
    value
});

// You can now send the approvedTransaction as you normally would
const receipt = await wallet.sendTransaction(approvedTransaction);

Reference Documentation

The Firewall SDK adds the to your smart contracts. Run this command from the root folder of your project to integrate the SDK:

That's it! Welcome to Venn. You can now view your activity on Venn in the .

Venn Playground:
Hello Venn:
security modifiers
🎉
Explorer
Venn CLI
Venn DApp SDK