D
D
Developer Docs
Search…
⌃K

Contract Deployment Tutorial

Our recent Pre-Alpha Testnet upgrade allows the community to deploy smart contracts on Scroll! To ensure testnet stability, we will be rolling out contract deploy access progressively. Watch out for an email notifying you that your address has had contract deployment enabled! To increase your priority, you can tell us a bit more about yourself at this form, but we hope to add everyone soon.
In this tutorial, we will teach you how to deploy a contract on the Scroll Testnet. This demo repo illustrates contract deployment with Hardhat and Foundry.

Deploy contracts with Hardhat

  1. 1.
    Clone the repo and install dependencies
git clone https://github.com/scroll-tech/scroll-contract-deploy-demo.git
cd scroll-contract-deploy-demo
yarn install
2. Create a .env file following the example .env.example in the root directory. Change PRIVATE_KEY to your own account private key in the .env.
3. Run yarn compile to compile the contract.
4. Run yarn deploy:scrollTestnet to deploy the contract on the Scroll Pre-Alpha Testnet.

Deploy contracts with Foundry

  1. 1.
    Clone the repo.
git clone https://github.com/scroll-tech/scroll-contract-deploy-demo.git
cd scroll-contract-deploy-demo
2. Install Foundry.
curl -L https://foundry.paradigm.xyz | bash
foundryup
3. Run forge build to build the project.
4. Deploy your contract with Foundry
forge create --rpc-url https://prealpha.scroll.io/l2 \
--value <lock_amount> \
--constructor-args <unlock_time> \
--private-key <your_private_key> \
--legacy \
contracts/Lock.sol:Lock

Questions and Feedback

Thank you for participating in and developing on the Scroll Pre-Alpha Testnet. If you encounter any issues, join our Discord and ask us in the developer channel.

Developer Notes

  1. 1.
    The SELFDESTRUCT opcode is disabled and will not be supported in Scroll, as it is slated to be removed from the EVM at a later date.
  2. 2.
    For now, we have set Layer 2 gas prices to be the same as on Ethereum Layer 1. However, these gas prices are subject to change and will be set in the future to match proving costs. We will endeavor to minimize these changes, primarily applying them to ZK-unfriendly precompiles when necessary for security.
Last modified 1mo ago