@aztec/cli 0.1.0-alpha21 → 0.1.0-alpha22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,36 +1,70 @@
1
1
  # Aztec CLI Documentation
2
2
 
3
- The Aztec CLI is a command-line interface for interacting with Aztec. It provides various commands to perform different tasks related to Aztec contracts and accounts. This documentation provides an overview of the available commands and their usage.
3
+ The Aztec CLI `azti` is a command-line interface (CLI) tool for interacting with Aztec. It provides various commands for deploying contracts, creating accounts, interacting with contracts, and retrieving blockchain data.
4
4
 
5
5
  ## Installation
6
6
 
7
- To use the Aztec CLI, you need to have Node.js installed on your system. You can install it from the official Node.js website: [https://nodejs.org](https://nodejs.org)
7
+ To use `azti`, you need to have Node.js installed on your system. Follow these steps to install and set up the CLI tool:
8
8
 
9
- After installing Node.js, you can install the Aztec CLI globally using the following command:
9
+ 1. Install Node.js: Visit the official Node.js website (https://nodejs.org) and download the installer for your operating system. Follow the installation instructions to install Node.js.
10
10
 
11
- ```shell
12
- npm install -g @aztec/azti
13
- ```
11
+ 2. Install `azti` package: Open a terminal or command prompt and run the following command to install `azti` globally on your system:
12
+
13
+ ```shell
14
+ npm install -g @aztec/cli
15
+ ```
16
+
17
+ This will install the `azti` globally, making it accessible from any location in your terminal.
18
+
19
+ 3. Verify the installation: After the installation is complete, run the following command to verify that `azti` is installed correctly:
20
+
21
+ ```shell
22
+ azti --version
23
+ ```
24
+
25
+ This command will display the version number of `azti` if the installation was successful.
14
26
 
15
27
  ## Usage
16
28
 
17
- Once the Aztec CLI is installed, you can run it using the `azti` command followed by the desired command and its arguments. Here's the basic syntax:
29
+ To use `azti`, open a terminal or command prompt and run the `azti` command followed by the desired command and its options.
30
+
31
+ Here's the basic syntax for running a command:
18
32
 
19
33
  ```shell
20
- azti [command] [arguments] [options]
34
+ azti <command> [options]
21
35
  ```
22
36
 
23
- To get help about the available commands and their usage, you can use the `--help` option:
37
+ Replace `<command>` with the actual command you want to execute and `[options]` with any optional flags or parameters required by the command.
38
+
39
+ ### Environment Variables
40
+
41
+ Some options can be set globally as environment variables to avoid having to re-enter them every time you call `azti.`
42
+ These options are:
43
+
44
+ - `PRIVATE_KEY` -> `-k, --private-key` for all commands that require a private key.
45
+ - `PUBLIC_KEY` -> `-k, --public-key` for all commands that require a public key.
46
+ - `AZTEC_RPC_HOST` -> `-u, --rpc-url` for commands that require an Aztec RPC URL.
47
+ - `API_KEY` -> `a, --api-key` for `deploy-l1-contracts`.
48
+ - `ETHEREUM_RPC_HOST` -> `-u, --rpc-url` for `deploy-l1-contracts`.
49
+
50
+ So if for example you are running your Aztec RPC server remotely you can do:
24
51
 
25
52
  ```shell
26
- azti --help
53
+ export AZTEC_RPC_HOST=http://external.site/rpc:8080
54
+ azti deploy my_contract.json
27
55
  ```
28
56
 
29
- ## Commands
57
+ And this will send the request to `http://external.site/rpc:8080`.
58
+
59
+ **NOTE**: Entering an option value will override the environment variable.
60
+
61
+ ## Available Commands
62
+
63
+ `azti` provides the following commands for interacting with Aztec:
30
64
 
31
65
  ### deploy-l1-contracts
32
66
 
33
- Deploy Aztec contracts on Layer 1.
67
+ Deploys all necessary Ethereum contracts for Aztec.
34
68
 
35
69
  Syntax:
36
70
 
@@ -44,11 +78,64 @@ Options:
44
78
 
45
79
  - `-a, --api-key <string>`: API key for the Ethereum host.
46
80
  - `-p, --private-key <string>`: The private key to use for deployment.
47
- - `-m, --mnemonic <string>`: The mnemonic to use in deployment. Default: "test test test test test test test test test test test junk".
81
+ - `-m, --mnemonic <string>`: The mnemonic to use in deployment. Default: `test test test test test test test test test test test junk`.
82
+
83
+ This command deploys all the necessary Ethereum contracts required for Aztec. It creates the rollup contract, registry contract, inbox contract, outbox contract, and contract deployment emitter. The command displays the addresses of the deployed contracts.
84
+
85
+ Example usage:
86
+
87
+ ```shell
88
+ azti deploy-l1-contracts
89
+ ```
90
+
91
+ ### create-private-key
92
+
93
+ Generates a 32-byte private key.
94
+
95
+ Syntax:
96
+
97
+ ```shell
98
+ azti create-private-key [options]
99
+ ```
100
+
101
+ Options:
102
+
103
+ - `-m, --mnemonic`: A mnemonic string that can be used for the private key generation.
104
+
105
+ This command generates a random 32-byte private key or derives one from the provided mnemonic string. It displays the generated private key.
106
+
107
+ Example usage:
108
+
109
+ ```shell
110
+ azti create-private-key
111
+ ```
112
+
113
+ ### create-account
114
+
115
+ Creates an Aztec account that can be used for transactions.
116
+
117
+ Syntax:
118
+
119
+ ```shell
120
+ azti create-account [options]
121
+ ```
122
+
123
+ Options:
124
+
125
+ - `-k, --private-key`: Private key to use for the account generation. Uses a random key by default.
126
+ - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
127
+
128
+ This command creates an Aztec account that can be used for transactions. It generates a new account with a private key or uses the provided private key. The command displays the account's address and public key.
129
+
130
+ Example usage:
131
+
132
+ ```shell
133
+ azti create-account
134
+ ```
48
135
 
49
136
  ### deploy
50
137
 
51
- Deploy an Aztec contract.
138
+ Deploys a compiled Noir contract to Aztec.
52
139
 
53
140
  Syntax:
54
141
 
@@ -57,16 +144,24 @@ azti deploy <contractAbi> [options]
57
144
  ```
58
145
 
59
146
  - `contractAbi`: Path to the compiled Noir contract's ABI file in JSON format.
147
+ - `constructorArgs` (optional): Contract constructor arguments.
60
148
 
61
149
  Options:
62
150
 
63
151
  - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
64
- - `-k, --public-key <string>`: Public key to use for deployment.
65
- - `-a, --constructor-args [args...]`: Constructor arguments for the contract.
152
+ - `-k, --public-key <string>`: Public key of the deployer. If not provided, it will check the RPC for existing ones.
153
+
154
+ This command deploys a compiled Noir contract to Aztec. It requires the path to the contract's ABI file in JSON format. Optionally, you can specify the public key of the deployer and provide constructor arguments for the contract. The command displays the address of the deployed contract.
155
+
156
+ Example usage:
157
+
158
+ ```shell
159
+ azti deploy path/to/contract.abi.json ...args
160
+ ```
66
161
 
67
162
  ### check-deploy
68
163
 
69
- Check if a contract has been deployed to an Aztec address.
164
+ Checks if a contract is deployed to the specified Aztec address.
70
165
 
71
166
  Syntax:
72
167
 
@@ -74,15 +169,23 @@ Syntax:
74
169
  azti check-deploy <contractAddress> [options]
75
170
  ```
76
171
 
77
- - `contractAddress`: Aztec address to check if the contract has been deployed to.
172
+ - `contractAddress`: An Aztec address to check if the contract has been deployed to.
78
173
 
79
174
  Options:
80
175
 
81
176
  - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
82
177
 
178
+ This command checks if a contract is deployed to the specified Aztec address. It verifies if the contract is present at the given address and displays the result.
179
+
180
+ Example usage:
181
+
182
+ ```shell
183
+ azti check-deploy 0x123456789abcdef123456789abcdef12345678
184
+ ```
185
+
83
186
  ### get-tx-receipt
84
187
 
85
- Get the receipt for a transaction hash.
188
+ Gets the receipt for the specified transaction hash.
86
189
 
87
190
  Syntax:
88
191
 
@@ -90,15 +193,23 @@ Syntax:
90
193
  azti get-tx-receipt <txHash> [options]
91
194
  ```
92
195
 
93
- - `txHash`: Transaction hash to get the receipt for.
196
+ - `txHash`: A transaction hash to get the receipt for.
94
197
 
95
198
  Options:
96
199
 
97
200
  - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
98
201
 
202
+ This command retrieves and displays the receipt for the specified transaction hash. It shows details such as the transaction status, block number, and block hash.
203
+
204
+ Example usage:
205
+
206
+ ```shell
207
+ azti get-tx-receipt 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef12345678
208
+ ```
209
+
99
210
  ### get-contract-data
100
211
 
101
- Get data about an Aztec contract.
212
+ Gets information about the Aztec contract deployed at the specified address.
102
213
 
103
214
  Syntax:
104
215
 
@@ -113,25 +224,17 @@ Options:
113
224
  - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
114
225
  - `-b, --include-bytecode`: Include the contract's public function bytecode, if any.
115
226
 
116
- ### create-account
227
+ This command retrieves and displays information about the Aztec contract deployed at the specified address. It shows the contract address, portal contract address, and optionally, the bytecode of the contract's public functions.
117
228
 
118
- Create a new Aztec account.
119
-
120
- Syntax:
229
+ Example usage:
121
230
 
122
231
  ```shell
123
- azti create-account [options]
232
+ azti get-contract-data 0x123456789abcdef123456789abcdef12345678
124
233
  ```
125
234
 
126
- Options:
127
-
128
- - `-k, --private-key`: Private Key to use for the 1st account generation.
129
- - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
130
- - `-n, --num-addresses <number>`: Number of accounts to create. Default: 1.
131
-
132
235
  ### get-accounts
133
236
 
134
- Get a list of Aztec accounts.
237
+ Gets all the Aztec accounts.
135
238
 
136
239
  Syntax:
137
240
 
@@ -143,9 +246,17 @@ Options:
143
246
 
144
247
  - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
145
248
 
249
+ This command retrieves and displays all the Aztec accounts available in the system.
250
+
251
+ Example usage:
252
+
253
+ ```shell
254
+ azti get-accounts
255
+ ```
256
+
146
257
  ### get-account-public-key
147
258
 
148
- Get the public key for an Aztec account.
259
+ Gets an account's public key, given its Aztec address.
149
260
 
150
261
  Syntax:
151
262
 
@@ -153,55 +264,101 @@ Syntax:
153
264
  azti get-account-public-key <address> [options]
154
265
  ```
155
266
 
156
- - `address`: Aztec address to get the public key for.
267
+ - `address`: The Aztec address to get the public key for.
157
268
 
158
269
  Options:
159
270
 
160
271
  - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
161
272
 
273
+ This command retrieves and displays the public key of an account given its Aztec address.
274
+
275
+ Example usage:
276
+
277
+ ```shell
278
+ azti get-account-public-key 0x123456789abcdef123456789abcdef12345678
279
+ ```
280
+
162
281
  ### call-fn
163
282
 
164
- Call a function on an Aztec contract.
283
+ Calls a function on an Aztec contract.
165
284
 
166
285
  Syntax:
167
286
 
168
287
  ```shell
169
- azti call-fn <contractAbi> <contractAddress> <functionName> [from] [functionArgs...] [options]
288
+ azti call-fn <contractAbi> <contractAddress> <functionName> [functionArgs...] [options]
170
289
  ```
171
290
 
172
- - `contractAbi`: Path to the compiled contract's ABI file in JSON format.
291
+ - `contractAbi`: The compiled contract's ABI in JSON format.
173
292
  - `contractAddress`: Address of the contract.
174
293
  - `functionName`: Name of the function to call.
175
- - `from` (optional): Caller of the transaction.
176
294
  - `functionArgs` (optional): Function arguments.
177
295
 
178
296
  Options:
179
297
 
298
+ - `-k, --private-key <string>`: The sender's private key.
180
299
  - `-u, --rpcUrl <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
181
300
 
182
- ### view-tx
301
+ This command calls a function on an Aztec contract. It requires the contract's ABI, address, function name, and optionally, function arguments. The command executes the function call and displays the transaction details.
302
+
303
+ Example usage:
304
+
305
+ ```shell
306
+ azti call-fn path/to/contract.abi.json 0x123456789abcdef123456789abcdef12345678 transfer 100
307
+ ```
183
308
 
184
- Simulate the execution of a view (read-only) function on a deployed contract without actually modifying state.
309
+ ### view-fn
310
+
311
+ Simulates the execution of a view (read-only) function on a deployed contract, without modifying state.
185
312
 
186
313
  Syntax:
187
314
 
188
315
  ```shell
189
- azti view-tx <contractAbi> <contractAddress> <functionName> [from] [functionArgs...] [options]
316
+ azti view-fn <contractAbi> <contractAddress> <functionName> [functionArgs...] [options]
190
317
  ```
191
318
 
192
- - `contractAbi`: Path to the compiled contract's ABI file in JSON format.
319
+ - `contractAbi`: The compiled contract's ABI in JSON format.
193
320
  - `contractAddress`: Address of the contract.
194
- - `functionName`: Name of the function to call.
195
- - `from` (optional): Caller of the transaction.
321
+ - `functionName`: Name of the function to view.
196
322
  - `functionArgs` (optional): Function arguments.
197
323
 
198
324
  Options:
199
325
 
326
+ - `-f, --from <string>`: Public key of the transaction viewer. If empty, it will try to find an account in the RPC.
200
327
  - `-u, --rpcUrl <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
201
328
 
329
+ This command simulates the execution of a view function on a deployed contract without modifying the state. It requires the contract's ABI, address, function name, and optionally, function arguments. The command displays the result of the view function.
330
+
331
+ Example usage:
332
+
333
+ ```shell
334
+ azti view-fn path/to/contract.abi.json 0x123456789abcdef123456789abcdef12345678 balanceOf 0xabcdef1234567890abcdef1234567890abcdef12
335
+ ```
336
+
337
+ ### parse-parameter-struct
338
+
339
+ Helper for parsing an encoded string into a contract's parameter struct.
340
+
341
+ Syntax:
342
+
343
+ ```shell
344
+ azti parse-parameter-struct <encodedString> <contractAbi> <parameterName>
345
+ ```
346
+
347
+ - `encodedString`: The encoded hex string.
348
+ - `contractAbi`: The compiled contract's ABI in JSON format.
349
+ - `parameterName`: The name of the struct parameter to decode into.
350
+
351
+ This command is a helper for parsing an encoded hex string into a contract's parameter struct. It requires the encoded string, the contract's ABI, and the name of the struct parameter. The command decodes the string and displays the struct data.
352
+
353
+ Example usage:
354
+
355
+ ```shell
356
+ azti parse-parameter-struct 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890 path/to/contract.abi.json paramName
357
+ ```
358
+
202
359
  ### get-logs
203
360
 
204
- Get logs from Aztec blocks.
361
+ Gets all the unencrypted logs from L2 blocks in the specified range.
205
362
 
206
363
  Syntax:
207
364
 
@@ -209,12 +366,43 @@ Syntax:
209
366
  azti get-logs <from> <take> [options]
210
367
  ```
211
368
 
212
- - `
369
+ - `from`: Block number to start fetching logs from.
370
+ - `take`: Number of block logs to fetch.
213
371
 
214
- from`: Block number to start fetching logs from.
372
+ Options:
215
373
 
216
- - `take`: Number of block logs to fetch.
374
+ - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
375
+
376
+ This command retrieves and displays all the unencrypted logs from L2 blocks in the specified range. It shows the logs found in the blocks and unrolls them for readability.
377
+
378
+ Example usage:
379
+
380
+ ```shell
381
+ azti get-logs 1000 10
382
+ ```
383
+
384
+ ### block-num
385
+
386
+ Gets the current Aztec L2 block number.
387
+
388
+ Syntax:
389
+
390
+ ```shell
391
+ azti block-num [options]
392
+ ```
217
393
 
218
394
  Options:
219
395
 
220
396
  - `-u, --rpc-url <string>`: URL of the Aztec RPC. Default: `http://localhost:8080`.
397
+
398
+ This command retrieves and displays the current Aztec L2 block number.
399
+
400
+ Example usage:
401
+
402
+ ```shell
403
+ azti block-num
404
+ ```
405
+
406
+ ## Conclusion
407
+
408
+ That covers the available commands and their usage in the `aztec-cli`. You can now use these commands to interact with Aztec and perform various actions such as deploying contracts, creating accounts, executing functions, and retrieving blockchain data.