| section | developers | ||
|---|---|---|---|
| date | Last Modified | ||
| title | Contract Deployment Tutorial | ||
| lang | en | ||
| permalink | developers/guides/contract-deployment-tutorial | ||
| excerpt | The Scroll Sepolia Testnet allows the community to deploy smart contracts on Scroll. In this tutorial, we will teach you how to deploy a contract on Scroll Sepolia. | ||
| whatsnext |
|
import Aside from "../../../../../components/Aside.astro"
The Scroll Sepolia Testnet allows anyone to deploy a smart contract on Scroll. In this tutorial, you will learn how to deploy a contract on Scroll Sepolia using common tools for developing on Ethereum. This demo repo illustrates contract deployment with Hardhat and Foundry.
Before you start deploying the contract, you need to request test tokens from a Sepolia faucet and use the [bridge](https://scroll.io/bridge) to transfer some test ETH from _Sepolia_ to _Scroll Sepolia_. Alternatively, you could acquire Scroll Sepolia ETH directly. See our [Faucet](/user-guide/faucet/) and [Bridge](/user-guide/bridge/) guides for help.-
Clone the repo and install dependencies:
git clone https://github.com/scroll-tech/scroll-guides.git cd scroll-guides/contract-deploy-demo yarn install -
Create a
.envfile following the example.env.examplein the root directory. ChangePRIVATE_KEYto your own account private key in the.env. -
Run
yarn compileto compile the contract. -
Run
yarn deploy:scrollTestnetto deploy the contract on the Scroll Sepolia Testnet. -
Run
yarn testfor hardhat tests.
-
Clone the repo:
git clone https://github.com/scroll-tech/scroll-guides.git cd scroll-guides/contract-deploy-demo -
Install Foundry:
curl -L https://foundry.paradigm.xyz | bash foundryup -
Run
forge buildto build the project. -
Deploy your contract with Foundry:
forge create --rpc-url https://sepolia-rpc.scroll.io/ \ --value <lock_amount> \ --constructor-args <unlock_time> \ --private-key <your_private_key> \ contracts/Lock.sol:Lock
<lock_amount>is the amount of testETHto be locked in the contract. Try setting this to some small amount, like0.0000001ether.<unlock_time>is the Unix timestamp after which the funds locked in the contract will become available for withdrawal. Try setting this to some Unix timestamp in the future, like1696118400(this Unix timestamp corresponds to October 1, 2023).
For example:
forge create --rpc-url https://sepolia-rpc.scroll.io/ \ --value 0.00000000002ether \ --constructor-args 1696118400 \ --private-key 0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 \ contracts/Lock.sol:Lock
Thank you for participating in and developing on the Scroll Sepolia Testnet! If you encounter any issues, join our Discord and ask us in the #testnet-devs channel.