You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 23, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/deploying/deploy-smart-contracts.mdx
+8-47Lines changed: 8 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -8,39 +8,21 @@ To deploy your smart contracts to a live network, there are a few things you nee
8
8
9
9
## 1. Configure your network
10
10
11
-
Scaffold-ETH 2 comes with a selection of predefined networks. You can also add your custom network in:
11
+
Scaffold-Stark 2 comes with a selection of predefined networks. They are `Devnet` and `Sepolia`.
12
12
13
-
- Hardhat => `packages/hardhat/hardhat.config.ts`
14
-
- Foundry => `packages/foundry/foundry.toml`
13
+
Here are the [Starknet docs](https://docs.starknet.io/documentation/tools/api-services/) for information on Seplia networks providers.
15
14
16
-
Here are the [Alchemy docs](https://docs.alchemy.com/docs/how-to-add-alchemy-rpc-endpoints-to-metamask) for information on specific networks.
17
-
18
-
## 2. Generate a new account or add one to deploy the contract(s) from.
15
+
## 2. Use prefunded accounts and add one of them to deploy the contract(s) from.
19
16
20
17
The deployer account is the account that will deploy your contracts. Additionally, the deployer account will be used to execute any function calls that are part of your deployment script.
21
18
22
-
You can generate a random account / private key or add your crypto wallet's private key.
23
-
24
-
To create a random account and add the `DEPLOYER_PRIVATE_KEY` to the `.env` file, run:
25
-
26
-
```
27
-
yarn generate
28
-
```
29
-
30
-
If you prefer to manually set your own private key, you will need to add `DEPLOYER_PRIVATE_KEY=yourWalletPrivateKey` to the `packages/hardhat/.env` / `packages/foundry/.env` file.
19
+
You can use any prefunded account / private key or add your crypto wallet's private key.
31
20
32
-
You can check the configured (generated or manually set) account and balances with:
33
-
34
-
```
35
-
yarn account
36
-
```
21
+
You can also manually set your own private key, you will need to add `PRIVATE_KEY_SEPOLIA=yourWalletPrivateKey` to the `packages/snfoundry/.env` file.
37
22
38
23
## 3. Deploy your smart contract(s)
39
24
40
-
By default `yarn deploy` will deploy contract to the local network. You can change `defaultNetwork` in:
41
-
42
-
- Hardhat => `hardhat.config.ts`
43
-
- Foundry => `foundry.toml`
25
+
By default `yarn deploy` will deploy contract to the local network. You can change `defaultNetwork` in `scaffold.config.ts`
44
26
45
27
Run the command below to deploy the smart contract to the target network. Make sure to have some funds in your deployer account to pay for the transaction.
You can verify your smart contract on Etherscan by running:
56
-
57
-
```
58
-
yarn verify --network network_name
59
-
```
60
-
61
-
eg: `yarn verify --network sepolia`
62
-
63
-
This command **works in both Hardhat and Foundry**, verifying all the deployed contracts. However, the verification method differs depending on the Solidity framework you're using:
64
-
65
-
- Hardhat => uses [etherscan-verify from hardhat-deploy](https://www.npmjs.com/package/hardhat-deploy#4-hardhat-etherscan-verify).
66
-
- Foundry => uses `VerifyAll.s.sol` script located in `packages/foundry/script`.
67
-
68
-
Additionally, **in Hardhat**, there's an alternative method for contract verification. You can use [hardhat-verify](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify) to verify your contracts, passing in the network name, contract address and constructor arguments (if any): `yarn hardhat-verify --network network_name contract_address "Constructor arg 1"`
69
-
70
-
If the chain you're using is not supported by any of the verifying methods, you can add new supported chains to your chosen method, either [etherscan-verify](https://www.npmjs.com/package/hardhat-deploy#options-2) or [hardhat-verify](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify#adding-support-for-other-networks).
71
-
72
35
## Configuration of Third-Party Services for Production-Grade Apps.
73
36
74
-
By default, Scaffold-ETH 2 provides predefined API keys for popular services such as Alchemy and Etherscan. This allows you to begin developing and testing your applications more easily, avoiding the need to register for these services.
37
+
By default, Scaffold-Stark 2 provides predefined API keys for popular services such as Infura. This allows you to begin developing and testing your applications more easily, avoiding the need to register for this service.
75
38
76
39
For production-grade applications, it's recommended to obtain your own API keys (to prevent rate limiting issues). You can configure these at:
77
40
78
-
-`ALCHEMY_API_KEY` variable in `packages/hardhat/.env` and `packages/nextjs/.env.local`. You can create API keys from the [Alchemy dashboard](https://dashboard.alchemy.com/).
79
-
80
-
-`ETHERSCAN_API_KEY` variable in `packages/hardhat/.env` | `packages/foundry/.env` using your generated API key. You can get your key [here](https://etherscan.io/myapikey).
41
+
-`RPC_URL_SEPOLIA` variable in `packages/snfoundry/.env` and `packages/nextjs/.env.local`. You can create API keys from the [Alchemy dashboard](https://dashboard.alchemy.com/).
81
42
82
43
:::tip Hint
83
44
It's recommended to store envs for nextjs in Vercel/system env config for live apps and use .env.local for local testing.
0 commit comments