Citrea
WebsiteBlogJoin The Community
  • 👋Welcome
    • Getting started
  • ⛓️Technical Specs
    • TL;DR
    • Technical Introduction
    • Characteristics
      • Execution Environment
      • Block Production
        • Pre-Confirmations
        • Decentralized Sequencer Network
      • Proof Generation
      • Nodes
      • Bitcoin Settlement: Trust-minimized BTC Bridge
        • BitVM
        • Optimistic Verification
    • Security Properties
      • Validity
      • Data Availability
      • Re-org Resistance
      • Censorship Resistance and Force Transactions
        • Escape Hatch
  • 👤User Guide
    • Run Citrea Full Node
      • Bitcoin Testnet4
        • Testnet4 Docker Setup
        • Build Testnet4 from Source
      • Citrea Full Node
        • Citrea Binary Executable
        • Build Citrea from Source
    • Use Citrea Testnet Faucet
    • Installing an EVM Wallet
    • Taproot Recovery Address
  • 📖Developer Documentation
    • Kickstart
    • Deployment Guide
      • Deploy a Smart Contract Using Remix
      • Deploy a Token
      • Configure Hardhat
    • System Contracts
      • Bitcoin Light Client
      • Bridge
      • Fee Vaults
    • Chain Information
    • RPC Documentation
    • Deploy a Bitcoin Appchain (L3)
  • 🔎Future Research
    • Decentralized Sequencer Network
    • Lightning Integration
    • Multi Prover
    • Multi VM Approach
    • Trustless Atomic Swaps
    • Trustless Settlement
    • Volition Model
  • 🌐Community
    • Citrea Meetups
      • Meetup Guide
      • Resources
      • Code of Conduct
Powered by GitBook
On this page
  • Configure Hardhat
  • Hardhat Installation
  • Create a Hardhat Project
  • Configure Hardhat for Citrea
  • Implement Your Smart Contract and Deploy
  • Congratulations!

Was this helpful?

  1. Developer Documentation
  2. Deployment Guide

Configure Hardhat

PreviousDeploy a TokenNextSystem Contracts

Last updated 7 months ago

Was this helpful?

Configure Hardhat

is a development environment to compile, deploy, test, and debug your Ethereum software. It helps developers manage the entire development cycle of their smart contracts. Hardhat is a popular choice for developers who want to build, test, and deploy smart contracts on the Ethereum network.

This guide will walk you through configuring Hardhat to work with Citrea. You will learn how to set up Hardhat to deploy smart contracts on Citrea Testnet.

Hardhat Installation

Before you begin, make sure you have Node.js installed on your machine. If you haven't installed Node.js yet, you can download it from the .

To install Hardhat, run the following command in your terminal:

npm install --save-dev hardhat

This command will install Hardhat as a development dependency in your project.

Create a Hardhat Project

To create a new Hardhat project, run the following command in your terminal:

npx hardhat init

Select the default options when prompted. This command will create a new Hardhat project in your current directory.

Configure Hardhat for Citrea

To configure Hardhat for Citrea, you need to update the hardhat.config.js file in your project directory. Open the hardhat.config.js file in your code editor and add the following configuration:

"REST_OF_YOUR_CONFIG_GOES_HERE",
module.exports = {
    "REST_OF_YOUR_CONFIG_GOES_HERE",
    networks: {
        citrea: {
            url: "https://rpc.testnet.citrea.xyz",
            chainId: 5115,
            accounts: ["YOUR_PRIVATE_KEY"],
        },
    },
    "REST_OF_YOUR_CONFIG_GOES_HERE",
};

Replace YOUR_PRIVATE_KEY with your private key. Make sure to keep your private key secure and never share it with anyone. You can obtain a private key from your Citrea Testnet wallet (e.g., Metamask).

Implement Your Smart Contract and Deploy

Once you have implemented your smart contract, you can deploy it to Citrea Testnet using the following command:

npx hardhat run --network citrea scripts/deploy.js

This command will deploy your smart contract to the Citrea Testnet network. You can interact with your smart contract using the Citrea Testnet explorer or other tools.

Congratulations!

For the rest of the development process, you can follow the official Hardhat documentation to compile, deploy, test, and debug your smart contracts. You can find more information on the .

You have successfully configured Hardhat to work with Citrea. You can now start building and deploying smart contracts on Citrea Testnet. If you have any questions or need help, feel free to ask in the .

📖
Hardhat
official website
Hardhat website
Citrea Discord