Skip to content

Files

Latest commit

 

History

History
106 lines (80 loc) · 3.67 KB

File metadata and controls

106 lines (80 loc) · 3.67 KB

SilentData Rollup Providers

Table of Contents

Introduction

Custom providers for SilentData Rollup, compatible with ethers.js.

Prerequisites

  • Node.js (version 18 or higher)
  • Hardhat v2
  • npm or yarn
  • Basic knowledge of Ethereum and smart contracts

Integration

Hardhat Integration

Installing Hardhat Integration Dependencies

npm install @appliedblockchain/silentdatarollup-core @appliedblockchain/silentdatarollup-hardhat-plugin-fireblocks @nomicfoundation/hardhat-ignition-ethers@0.15.7

Hardhat Integration Example

To integrate the SilentData Rollup Provider with Hardhat, you need to configure your Silent Data network in the hardhat.config.ts file. Below is an example of how to set it up, and note that a silentdata property is needed on the network config to enable it. This property can be an empty object to apply defaults, or you can specify the configurations.

import {
  ApiBaseUrl,
  ASSETS,
  ChainId,
} from "@fireblocks/fireblocks-web3-provider";
import "@nomicfoundation/hardhat-ignition-ethers";
import "@appliedblockchain/silentdatarollup-hardhat-plugin-fireblocks";
import { SilentDataSignatureTypeRollupProvider } from "@appliedblockchain/silentdatarollup-core";

const RPC_URL = "SILENT_DATA_ROLLUP_RPC_URL";
const FIREBLOCKS_API_KEY = "FIREBLOCKS_API_KEY";

const fireblocksConfig = {
  privateKey: "FIREBLOCKS_PATH_TO_PRIVATE_KEY",
  apiKey: FIREBLOCKS_API_KEY,
  assetId: ASSETS[ChainId.SEPOLIA].assetId,
  vaultAccountIds: "FIREBLOCKS_VAULT_ACCOUNT_ID", // Note: Currently, only one vault account can be passed to the configuration.
  chainId: ChainId.SEPOLIA,
  apiBaseUrl: ApiBaseUrl.Sandbox, // If using a sandbox workspace
  rpcUrl: RPC_URL,
};

export default {
  solidity: "0.8.21",
  defaultNetwork: "sdr",
  networks: {
    hardhat: {},
    sdr: {
      url: RPC_URL,
      fireblocks: fireblocksConfig,
      silentdata: {
        authSignatureType: SignatureType.EIP712, // Optional, defaults to RAW
      },
    },
  },
};

Note: With the above configuration, you can deploy a contract using Hardhat Ignition. For a detailed example, including a sample contract and an Ignition module, please refer to the Hardhat Ignition Getting Started Guide.

To deploy your contract using Hardhat Ignition, run the following command:

npx hardhat ignition deploy ignition/modules/Apollo.ts --network sdr

Troubleshooting

If you encounter any issues, please check the following:

  1. Ensure you're using the correct RPC URL for your desired network.
  2. Verify that your private key is correctly set and has sufficient funds.
  3. Ensure that your token is still active on the SilentData AppChains dashboard.
  4. If using Fireblocks, validate your user and API keys.

License

This project is licensed under the MIT License.

Additional Resources