이 페이지는 영어로 된 기계 번역을 사용하므로 오류나 불명확한 언어가 포함될 수 있습니다. 가장 정확한 정보는 영어 원문을 참조하시기 바랍니다. 잦은 업데이트로 인해 일부 콘텐츠는 원래 영어로 되어 있을 수 있습니다. Crowdin에서 이 페이지의 번역을 개선하는 데 동참하여 도움을 주세요. (Crowdin translation page, Contributing guide)
How to Verify Smart Contracts Using Sourcify
Sourcify is a Solidity (smart contracts) source code verification service for Ethereum and EVM-compatible chains like Kaia. One of its unique features is that it leverages the Solidity metadata file to "fully verify" the contracts.
In this guide, we'll take a look at how to verify a smart contract on Foundry using Sourcify.
Getting started
This guide expects that you have an idea of developing smart contracts with Foundry. See Deploy smart contract using Foundry to get started. Foundry provides native support for Sourcify verification—all you need to do is add a few flags to your forge command. To verify contracts with Sourcify using Foundry, see the steps below:
Deploy and verify a contract:
/* deploy */forge create --rpc-url $KAIROS_RPC_URL --private-key $PRIVATE_KEY src/Counter.sol:Counter --broadcast
//* verify an already deployed contract as seen above *//forge verify-contract 0x2a31C3f597d8FD0Fbc5Ff02439ce6c6aEFb680a2 src/Counter.sol:Counter --chain-id 1001 --verifier sourcify --verifier-url https://sourcify.dev/server/
You can look up the verified contract here
Check if a contract is verified
forge verify-check 0x2a31C3f597d8FD0Fbc5Ff02439ce6c6aEFb680a2 --chain-id 1001 --verifier sourcify