Supported protocols • Chainstack blog • Chainstack docs • Blockchain API reference • Start for free
This project shows how to use Foundry to compile and deploy Smart contracts.
See the full tutorial on the Chainstack blog:
Foundry is one of the latest smart contract development tools currently in the market, and it allows users to compile contracts, write tests, deploy contracts, and much more through its command line interface. This project is already set up for you to deploy smart contracts and interact with Chainlink’s data feeds.
Learn more about Foundry: Foundry: A fast Solidity smart contract development toolkit
Clone this repository.
curl -L https://foundry.paradigm.xyz | bash
Then:
foundryup
forge build
In the root directory:
touch .env
This will create a new .env
file, paste and edit the following in it:
GOERLI_RPC_URL=CHAINSTACK_GOERLI_NODE_URL
PRIVATE_KEY=YOU_PRIVATE_KEY
ETHERSCAN_KEY=ETHERSCAN_API_KEY(to verify the smart contract)
Run the following command:
forge script script/priceFeedsScript.s.sol:ChainlinkScript --rpc-url $GOERLI_RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv
- Linux or MacOS
- A Goerli Chainstack endpoint
Deploy a Goerli node:
Clone this repository.
Install Foundry
curl -L https://foundry.paradigm.xyz | bash
Then:
foundryup
Here is a link to a verified smart contract deployed to the Goerli testnet, and then verified using Foundry's command line.