Skip to content

Commit 4c1b041

Browse files
authored
Merge pull request #913 from o1-labs/review/zkapp-deploy
Review of zkApp deployments.
2 parents 5291468 + fef8faf commit 4c1b041

File tree

4 files changed

+113
-91
lines changed

4 files changed

+113
-91
lines changed

docs/zkapps/how-to-deploy-a-zkapp.mdx

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,29 @@ zkApp programmability is not yet available on the Mina Mainnet, but zkApps can n
1717

1818
# How to Deploy a zkApp
1919

20-
Before deploying, you must first define a few settings, such as which network you are deploying to.
20+
Before deploying, you must first define a few settings, such as which network you are deploying your zkApp to.
2121

2222
## Add a deploy alias to config.json
2323

24-
Create a [deploy alias](/zkapps/tutorials/deploying-to-a-network#deploy-alias) in the `config.json` file in your smart contract project.
25-
26-
First, change into the directory that contains your smart contract and then run the
27-
following command:
24+
First, change into the directory that contains your smart contract and then run the following command:
2825

2926
```sh
3027
zk config
3128
```
3229

33-
When prompted, specify a name (can be anything), the target network (`testnet` or `mainnet`), the URL to deploy to, fee (in
34-
MINA) to be used when sending your deploy transaction, and the fee payer account.
30+
When prompted, specify:
31+
32+
- The name (can be anything)
33+
- The target network kind (`Testnet`, `Mainnet` or enter the custom network kind id) to deploy your zkApp to
34+
- The URL to send the deploy transaction to
35+
- Transaction fee (in MINA) to use when deploying
36+
- The fee payer account to pay transaction fees from
3537

36-
For more details, see [Deploy alias](/zkapps/tutorials/deploying-to-a-network#deploy-alias) in Tutorial 3: Deploy to a Live Network.
38+
For more details, see [deploy alias](/zkapps/tutorials/deploying-to-a-network#deploy-alias) section in corresponding tutorial.
3739

3840
:::tip
3941
If your project contains multiple smart contracts (for example, `Foo` and `Bar`) that
40-
you intend to deploy to the same network, a best practice is to follow a naming convention such as `berkeley-foo` and `berkeley-bar` when naming your deploy aliases. You can change these alias names at any time in `config.json`.
42+
you intend to deploy to the same network, the best practice is to follow the naming convention such as `berkeley-foo` and `berkeley-bar` when naming your deploy aliases. You can change these alias names at any time by manually editing the `config.json` file.
4143
:::
4244

4345
You see the following output:
@@ -46,28 +48,34 @@ You see the following output:
4648
$ zk config
4749

4850
Add a new network:
49-
✔ Choose a name (can be anything): · berkeley
50-
✔ Set URL to deploy to: · https://proxy.berkeley.minaexplorer.com/graphql
51+
✔ Create a name (can be anything): · berkeley
52+
✔ Choose the target network: · Testnet
53+
✔ Set the Mina GraphQL API URL to deploy to: · https://proxy.berkeley.minaexplorer.com/graphql
5154
✔ Set transaction fee to use when deploying (in MINA): · 0.1
52-
✔ Create key pair at keys/berkeley.json
53-
✔ Add network to config.json
55+
✔ Choose an account to pay transaction fees: · Use stored account MyFeePayer (public key: B62...)
56+
✔ Use stored fee payer MyFeePayer (public key: B62...)
57+
✔ Create zkApp key pair at keys/berkeley.json
58+
✔ Add deploy alias to config.json
5459

5560
Success!
5661

5762
Next steps:
5863

59-
- If this is a testnet, request tMINA at:
60-
https://faucet.minaprotocol.com/?address=<YOUR-ADDRESS>
61-
- To deploy, run: `zk deploy berkeley`
64+
- If this is the testnet, request tMINA at:
65+
https://faucet.minaprotocol.com/?address=<FEE-PAYER-ACCOUNT>
66+
- To deploy zkApp, run: `zk deploy berkeley`
6267
```
6368

64-
## Request funds from the faucet
69+
## Request funds from the Faucet
6570

66-
To deploy your zkApp, you must have funds to pay for transaction fees.
71+
To deploy your zkApp, your fee payer account must have funds to pay for transaction fees.
6772

68-
To get funds on the Berkeley Testnet, use the URL that was shown from the zkApp CLI output. Visit `https://faucet.minaprotocol.com/?address=<YOUR-ADDRESS>` and click **Request**.
73+
To get funds on the Berkeley Testnet, use the URL that was shown in the zkApp CLI output:
74+
- Visit `https://faucet.minaprotocol.com/?address=<FEE-PAYER-ACCOUNT>`
75+
- Choose the corresponding network you're going to deploy your zkApp to
76+
- And click the **Request** button
6977

70-
Before proceeding to the next step, wait a few minutes for the next block to include your transaction, so tMINA is available.
78+
Before proceeding to the next step, wait a few minutes for the next block to include your transaction, so that tMINA becomes available for the fee payer account.
7179

7280
## Deploy your smart contract
7381

@@ -77,9 +85,9 @@ To deploy your smart contract to the network, run the following command:
7785
zk deploy berkeley
7886
```
7987

80-
When running the deploy command, the zkApp CLI computes a verification key for your zkApp CLI. Computing the verification key can take 1-2 minutes, so please be patient. The zkApp CLI shows the details of the transaction, such as the network name, the URL, and the smart contract to deploy.
88+
Among other activities, when running the deploy command, zkApp CLI computes the verification key for your zkApp. Computing verification key can take 10-30 seconds, so please be patient. The zkApp CLI shows the details of the process, such as the network name, the URL, and the smart contract to deploy.
8189

82-
Finally, enter `yes` or `y` when prompted to confirm and send the transaction.
90+
Finally, enter `yes` or `y` when prompted to confirm and send the deploy transaction.
8391

8492
You see the following output:
8593

@@ -91,24 +99,42 @@ $ zk deploy berkeley
9199
Only one smart contract exists in the project: Add
92100
Your config.json was updated to always use this
93101
smart contract when deploying to this network.
94-
✔ Generate verification key (takes 1-2 min)
102+
✔ Generate verification key (takes 10-30 sec)
95103
✔ Build transaction
96104
✔ Confirm to send transaction
105+
106+
|-----------------|-------------------------------------------------|
107+
| Deploy alias | berkeley |
108+
|-----------------|-------------------------------------------------|
109+
| Network kind | testnet |
110+
|-----------------|-------------------------------------------------|
111+
| URL | https://proxy.berkeley.minaexplorer.com/graphql |
112+
|-----------------|-------------------------------------------------|
113+
| Fee payer | Alias : MyFeePayer |
114+
| | Account : B62... |
115+
|-----------------|-------------------------------------------------|
116+
| zkApp | Smart contract: Add |
117+
| | Account : B62... |
118+
|-----------------|-------------------------------------------------|
119+
| Transaction fee | 0.1 Mina |
120+
|-----------------|-------------------------------------------------|
121+
97122
Are you sure you want to send (yes/no)? · y
98123
✔ Send to network
99124

100125
Success! Deploy transaction sent.
101126

102127
Next step:
103128
Your smart contract will be live (or updated)
129+
at B62...
104130
as soon as the transaction is included in a block:
105-
https://berkeley.minaexplorer.com/transaction/<txn-hash>
131+
https://minascan.io/berkeley/tx/<txn-hash>?type=zk-tx
106132
```
107133

108-
After a few minutes, the transaction is included in the next block. To see your changes, go to on [berkeley.minaexplorer.com](https://berkeley.minaexplorer.com) and search for the address that you used.
134+
After a few minutes, the transaction is included in the next block.
135+
To see the zkApp transaction and navigate to accounts involved you can follow the transaction link provided to you in zkApp CLI output.
136+
Or use the [Minascan](https://minascan.io) explorer to search for the account with deployed zkApp.
109137

110138
## Next Steps
111139

112-
More local development and testing! Use Lightnet to test your zkApp locally on an accurate representation of the Mina blockchain. See [Testing zkApps with Lightnet](/zkapps/testing-zkapps-lightnet).
113-
114-
Now that you've learned how to deploy a smart contract, you can now learn [how to write a UI for your zkApp](how-to-write-a-zkapp-ui).
140+
Now that you've learned how to deploy a smart contract, you can learn [how to write the UI for your zkApp](how-to-write-a-zkapp-ui).

docs/zkapps/how-to-write-a-zkapp.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Examples are based on the standard project structure and provide additional file
107107

108108
The deploy alias name does not have to match the network name.
109109

110-
1. Choose the target network:
110+
1. Choose the target network kind:
111111

112112
```text
113113
Testnet

docs/zkapps/testing-zkapps-locally.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,4 @@ See the [Jest Getting Started](https://jestjs.io/docs/getting-started) documenta
188188

189189
## Next Steps
190190

191-
Now that you know how to test a smart contract on a simulated local blockchain, you can move on to [Testing zkApps with Lightnet](/zkapps/testing-zkapps-lightnet) before you learn [how to deploy a zkApp](how-to-deploy-a-zkapp).
191+
Now that you know how to test a smart contract on a simulated local blockchain, you can move on to [Testing zkApps with Lightnet](/zkapps/testing-zkapps-lightnet) before you learn [how to deploy your zkApp](how-to-deploy-a-zkapp) to public networks.

0 commit comments

Comments
 (0)