Contract Deployment Tutorial
Scroll Alpha Testnet is now deprecated.
Please visit our new documentation for the Scroll Sepolia Testnet at https://docs.scroll.io/
Our Alpha Testnet allows the community to deploy smart contracts on Scroll. 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.
Note: Before you start deploying the contract, you need to request test tokens from a Goerli faucet and use the bridge to transfer some testETH
from Goerli to Scroll Alpha.
Deploy contracts with Hardhat
Clone the repo and install dependencies
3. 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
.
4. Run yarn compile
to compile the contract.
5. Run yarn deploy:scrollTestnet
to deploy the contract on the Scroll Alpha Testnet.
6. Run yarn test
for hardhat tests.
Deploy contracts with Foundry
Clone the repo.
2. Install Foundry.
3. Run forge build
to build the project.
4. Deploy your contract with Foundry
<lock_amount>
is the amount of testETH
to 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:
Questions and Feedback
Thank you for participating in and developing on the Scroll Alpha Testnet. If you encounter any issues, join our Discord and ask us in the developers
channels.
Developer Notes
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.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.
For now, we recommend using
london
as a target EVM version for compiling. You can read more on that in the Ethereum & Alpha Testnet differences section.CREATE
andCREATE2
opcodes will yield the same behaviour as on Ethereum mainnet. Computation and address calculation is done in the same manner as on Ethereum.
Last updated
Was this helpful?