Documentation
Plugins

Sourcify

BuildBear Sourcify is a service that allows you to explore the blockchain.

Overview

The BuildBear Sourcify Plugin simplifies the verification of Solidity smart contract source code on BuildBear sandboxes using the Sourcify verification tool. Unlike other verification services, Sourcify employs Solidity metadata to achieve verification of contracts, ensuring efficiency and reliability.

Features

  • Automated Contract Identification - Simply provide deployment details, and the plugin identifies the contract for verification.
  • Solidity Library Handling - Automated handling of Solidity libraries for seamless verification.
  • Pre-Verification Simulation - Local simulation for error detection before actual verification.
  • Hardhat & Foundry Integration - Seamless integration with Hardhat and Foundry workflows.

Installation

  1. Log in to your BuildBear account and navigate to the Plugin Marketplace.
  2. Search for the "Sourcify" Plugin and click "Install".

Plugin Installation

Ensure the plugin appears as installed in the marketplace or under the 'Installed' tab.

How to Use

Hardhat Integration

  1. Install the Hardhat Verify plugin:
    npm install --save-dev @nomicfoundation/hardhat-verify
  2. Add the following to your hardhat.config.js:
    require("@nomicfoundation/hardhat-verify");
  3. Configure the Sourcify object in hardhat.config.js:
    sourcify: { 
        enabled: true, 
        apiUrl: "https://rpc.buildbear.io/verify/sourcify/server/{sandboxId}"
    }
  4. Optionally, disable Etherscan verification:
    etherscan: {
      enabled: false,
    }

Foundry Integration

Programmatic Deployment & Verification

forge script script/{NAME OF THE SCRIPT}.s.sol \                       
      --rpc-url "https://rpc.buildbear/{sandboxId}" \
      --private-key <DEPLOYER_PRIVATE_KEY> \            
      --verify --verifier sourcify \
      --verifier-url "https://rpc.buildbear/verify/sourcify/server/{sandboxId}" \
      --broadcast

Manual Verification of Single Contract

forge verify-contract 
    --verifier sourcify 
    --verifier-url "https://rpc.buildbear/verify/sourcify/server/{sandboxId}" 
    <DEPLOYED_CONTRACT_ADDRESS> <PATH>/<CONTRACT_NAME>.sol:<CONTRACT_NAME> 
    --chain-id <CHAIN ID>

Note: The verifier-url should end with your Sandbox ID.

Conclusion

The BuildBear Sourcify Plugin enables seamless Solidity contract verification within BuildBear sandboxes. By integrating with Hardhat or Foundry, developers can verify contracts efficiently and ensure code transparency with minimal effort.