From e6a7328047bb3901aaad899a5a45d750421d9cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Mon, 26 Aug 2024 10:30:33 +0100 Subject: [PATCH] chore(docs): first pass --- .latest_aztec_cli_vars | 97 ------------------- .../codealong/cli_wallet/_category_.json | 6 ++ .../codealong/cli_wallet/faceid_wallet.md | 57 ++++++++++- 3 files changed, 59 insertions(+), 101 deletions(-) delete mode 100644 .latest_aztec_cli_vars create mode 100644 docs/docs/tutorials/codealong/cli_wallet/_category_.json diff --git a/.latest_aztec_cli_vars b/.latest_aztec_cli_vars deleted file mode 100644 index 6b344b5a37b..00000000000 --- a/.latest_aztec_cli_vars +++ /dev/null @@ -1,97 +0,0 @@ -TEST_ACCOUNTS -ENABLE_GAS -API_PREFIX -ETHEREUM_HOST -L1_CHAIN_ID -MNEMONIC -ROLLUP_CONTRACT_ADDRESS -REGISTRY_CONTRACT_ADDRESS -INBOX_CONTRACT_ADDRESS -OUTBOX_CONTRACT_ADDRESS -AVAILABILITY_ORACLE_CONTRACT_ADDRESS -FEE_JUICE_CONTRACT_ADDRESS -FEE_JUICE_PORTAL_CONTRACT_ADDRESS -ARCHIVER_URL -DEPLOY_AZTEC_CONTRACTS -L1_PRIVATE_KEY -L2_QUEUE_SIZE -WS_BLOCK_CHECK_INTERVAL_MS -P2P_ENABLED -P2P_BLOCK_CHECK_INTERVAL_MS -P2P_PEER_CHECK_INTERVAL_MS -P2P_L2_QUEUE_SIZE -TCP_LISTEN_ADDR -UDP_LISTEN_ADDR -P2P_TCP_ANNOUNCE_ADDR -P2P_UDP_ANNOUNCE_ADDR -PEER_ID_PRIVATE_KEY -BOOTSTRAP_NODES -P2P_TX_PROTOCOL -P2P_MIN_PEERS -P2P_MAX_PEERS -DATA_DIRECTORY -TX_GOSSIP_VERSION -P2P_QUERY_FOR_IP -P2P_TX_POOL_KEEP_PROVEN_FOR -TELEMETRY -OTEL_EXPORTER_OTLP_ENDPOINT -OTEL_SERVICE_NAME -NETWORK_NAME -NETWORK -API_KEY -AZTEC_NODE_URL -ARCHIVER_POLLING_INTERVAL_MS -ARCHIVER_VIEM_POLLING_INTERVAL_MS -ARCHIVER_MAX_LOGS -SEQ_TX_POLLING_INTERVAL_MS -SEQ_MAX_TX_PER_BLOCK -SEQ_MIN_TX_PER_BLOCK -SEQ_MIN_SECONDS_BETWEEN_BLOCKS -SEQ_MAX_SECONDS_BETWEEN_BLOCKS -COINBASE -FEE_RECIPIENT -ACVM_WORKING_DIRECTORY -ACVM_BINARY_PATH -SEQ_ALLOWED_SETUP_FN -SEQ_ALLOWED_TEARDOWN_FN -SEQ_MAX_BLOCK_SIZE_IN_BYTES -ENFORCE_FEES -SEQ_PUBLISHER_PRIVATE_KEY -SEQ_REQUIRED_CONFIRMATIONS -SEQ_PUBLISH_RETRY_INTERVAL_MS -VERSION -SEQ_DISABLED -PROVER_DISABLED -PROVER_REAL_PROOFS -PROVER_AGENT_ENABLED -PROVER_AGENT_POLL_INTERVAL_MS -PROVER_AGENT_CONCURRENCY -PROVER_JOB_TIMEOUT_MS -PROVER_JOB_POLL_INTERVAL_MS -PROVER_ID -WS_L2_BLOCK_QUEUE_SIZE -WS_PROVEN_BLOCKS_ONLY -PROVER_PUBLISH_RETRY_INTERVAL_MS -PROVER_PUBLISHER_PRIVATE_KEY -PROVER_REQUIRED_CONFIRMATIONS -PROVER_TEST_DELAY_MS -TX_PROVIDER_NODE_URL -TXE_PORT -BOT_PXE_URL -BOT_PRIVATE_KEY -BOT_RECIPIENT_ENCRYPTION_SECRET -BOT_TOKEN_SALT -BOT_TX_INTERVAL_SECONDS -BOT_PRIVATE_TRANSFERS_PER_TX -BOT_PUBLIC_TRANSFERS_PER_TX -BOT_FEE_PAYMENT_METHOD -BOT_NO_START -BOT_TX_MINED_WAIT_SECONDS -BOT_NO_WAIT_FOR_TRANSFERS -PXE_BLOCK_POLLING_INTERVAL_MS -PXE_L2_STARTING_BLOCK -PXE_DATA_DIRECTORY -BB_BINARY_PATH -BB_WORKING_DIRECTORY -BB_SKIP_CLEANUP -PXE_PROVER_ENABLED diff --git a/docs/docs/tutorials/codealong/cli_wallet/_category_.json b/docs/docs/tutorials/codealong/cli_wallet/_category_.json new file mode 100644 index 00000000000..886b4dc2477 --- /dev/null +++ b/docs/docs/tutorials/codealong/cli_wallet/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "CLI Wallet Tutorial", + "position": 3, + "collapsible": true, + "collapsed": true +} diff --git a/docs/docs/tutorials/codealong/cli_wallet/faceid_wallet.md b/docs/docs/tutorials/codealong/cli_wallet/faceid_wallet.md index 9e681affe5f..a8ef99e6ac3 100644 --- a/docs/docs/tutorials/codealong/cli_wallet/faceid_wallet.md +++ b/docs/docs/tutorials/codealong/cli_wallet/faceid_wallet.md @@ -42,7 +42,7 @@ brew install socat ### Creating a key -We will create our private key, which will be stored in the Secure Enclave. Open Secretive, click the "+" sign and create a key with authentication. Secretive will then store it in the Secure Enclave. +We will create our private key, which will be stored in the Secure Enclave. Open Secretive, click the "+" sign and create a key with authentication. Secretive will then store it in the Secure Enclave. Make sure Secretive's "Secret Agent" is running! :::info @@ -56,13 +56,62 @@ Fortunately, Aztec implements [Account Abstraction](../../../aztec/concepts/acco Finally, we're ready to use our key in our seedless wallet. Every wallet on Aztec is a contract, and you can basically use any contract you want (there's even [a tutorial on it](../contract_tutorials/write_accounts_contract)). -But out of excitement, the Aztec team already wrote some account contract boilerplates we can use. One of them is, you've guessed, an account that uses the `secp256r1` elliptic curve (the one the Secure Enclave uses). +But of course, the Aztec team already wrote some account contract boilerplates we can use. One of them is an account that uses the `secp256r1` elliptic curve (the one the Secure Enclave uses). So let's do it: ```bash -aztec-wallet create-account -a awesometouchidaccount -t ecdsasecp256r1ssh +aztec-wallet create-account -a omg -t ecdsasecp256r1ssh ``` -This command creates an account using the `ecdsasecp256r1ssh` type. You can find other accounts by running `aztec-wallet create-account -h`. +This command creates an account using the `ecdsasecp256r1ssh` type and aliases it to `omg`. You can find other accounts by running `aztec-wallet create-account -h`. +Your machine will ask you for which key you'd like to use. Since we have created one above, let's just select it. The contract will then be deployed and aliased to `omg` + +### OMG + +This is cool. Now how do I use this? Well... You can just use it as you use any other wallet. That's the beauty of Native Account abstraction. Let's just create a simple token contract example and mint ourselves some tokens with this. + +I'm lazy so I'll just use `npx aztec-app` like a boss: + +```bash +npx aztec-app new -s -t contract -n token_contract token +``` + +This creates a new project, skips running the sandbox (`-s`), and clones the contract-only box (`-t`) called token_contract (`-n`). You should now have a `token_contract` folder. Let's just move inside and get cozy: + +```bash +cd token_contract +aztec-nargo compile +``` + +Great, our contract is ready to deploy with our TouchID wallet: + +```bash +aztec-wallet deploy --from accounts:omg token_contract@Token --args accounts:omg DevToken DTK 18 -a devtoken +``` + +Wondering what each of these options do? You can call `aztec-wallet -h` and see by yourself or check [the reference](../../../reference/developer_references/sandbox_reference/cli_wallet_reference.md), but I'll break it down for you (because I like you anon 💜): + +- --from is just the sender: our account `omg`. We use the alias because it's easier than writing the key stored in our Secure Enclave. The wallet resolves the alias and knows where to grab it. +- token_contract@Token is just a shorthand to look in the `target` folder for our contract `token_contract-Token` +- --args are the arguments for our token contract: owner, name, ticker and decimals. +- -a tells the wallet to store its address with the "devtoken" alias, this way we can just use it later like `contracts:devtoken`, how cool is that + +You should get a prompt to sign this transaction. You can now mint, transfer, and do anything you want with it: + +```bash +aztec-wallet create-account -a new_recipient # creating a schnorr account +aztec-wallet send mint_public -ca last --args accounts:omg 10 -f accounts:omg # minting some tokens in public +aztec-wallet simulate balance_of_public -ca contracts:devtoken --args accounts:omg -f omg # checking that omg has 10 tokens +aztec-wallet send transfer_public -ca contracts:devtoken --args accounts:omg accounts:new_recipient 10 0 -f accounts:omg # transferring some tokens in public +aztec-wallet simulate balance_of_public -ca contracts:devtoken --args accounts:new_recipient -f omg # checking that new_recipient has 10 tokens +``` + +### What next + +In this tutorial, we created an account with the Aztec's [CLI Wallet](../../../reference/developer_references/sandbox_reference/cli_wallet_reference.md), using the Apple Mac's Secure Enclave to store the private key. + +Turns out you can use a multitude of authentication methods, for example with RSA you could use a passport as a recovery, or even as a signer in a multisig. All of this is based on the account contract. + +Next step is then to [code your own account contract!](../contract_tutorials/write_accounts_contract.md)