Skip to main content

Deploy with Foundry

This guide uses Syscoin NEVM Tanenbaum (chain ID 5700). Install Foundry and prepare a test account with tSYS. Foundry installation

Build a contract​

forge init hello-nevm --empty
cd hello-nevm

Save this contract as src/HelloNEVM.sol.

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

contract HelloNEVM {
function sayHello() external pure returns (string memory) {
return "Hello NEVM!";
}
}

Add these settings under [profile.default] in foundry.toml. The compiler and EVM target are explicit so you can reproduce the bytecode when verifying the deployment.

solc_version = "0.8.28"
evm_version = "paris"
forge build

Deploy on Tanenbaum​

Check that the RPC reports 5700. Import your disposable test account into Foundry's encrypted keystore using its hidden prompt. Foundry wallet import

rpc=https://rpc.tanenbaum.io
cast chain-id --rpc-url "$rpc"
cast wallet import nevm-testnet --interactive

Preview the transaction with forge create. Once you have reviewed the preview, add --broadcast to submit it using tSYS for gas. Foundry deployment reference

forge create src/HelloNEVM.sol:HelloNEVM --rpc-url "$rpc" --account nevm-testnet

Save the reported contract address and transaction hash after deployment. Set contract to that address and make a read-only call. The expected message is Hello NEVM!.

cast call "$contract" 'sayHello()(string)' --rpc-url "$rpc"

Verify on Blockscout​

Verification publishes the contract source and compiler settings. Run from the same project and keep the settings used to deploy. The NEVM testnet explorer provides the Blockscout API at /api. Foundry verification reference

forge verify-contract "$contract" src/HelloNEVM.sol:HelloNEVM \
--chain 5700 --verifier blockscout \
--verifier-url https://explorer.tanenbaum.io/api --watch

Open the result in the Syscoin NEVM testnet explorer. The NEVM RPC reference lists endpoints and chain IDs for other deployments.