From 66c5ef130fc5711c73887d1cc473f615e76b716f Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 29 Sep 2024 01:40:41 -0400 Subject: [PATCH] docs: add warning and more cleanup (#225) --- README.md | 6 ++- docs/getting_started.md | 31 ++++++++++----- docs/wasmd_setup.md | 86 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 docs/wasmd_setup.md diff --git a/README.md b/README.md index 8a85075..484154d 100644 --- a/README.md +++ b/README.md @@ -29,17 +29,19 @@ example applications. Production features and requirements are in development. See [Future Work][future_work] --- + WARNING: Quartz is under heavy development and is not ready for production use. The current code contains known bugs and security vulnerabilities and APIs are still liable to change. We are making it available for devleopers to start playing with and to gather feedback on APIs and roadmap. It can be used today on CosmWasm testnets (testnets only, with no real funds at risk!). + --- ## Docs -- [Getting Started][getting_started] - Get a simple example app up and running in 5 minutes +- [Getting Started][getting_started] - Get a simple example app up and running in a few minutes - [How it Works][how_it_works] - How smart contracts and enclaves communicate securely - [TEE Security][tees] - Resources on TEE security - [Building Applications][building_apps] - How to build Quartz applications @@ -57,7 +59,7 @@ Example Quartz applications, including CosmWasm smart contracts, Gramine based s Currently implemented apps - -* [Transfer](apps/transfer) - The default transfer app which allows private transfer of assets +* [Transfer](/apps/transfers) - The default transfer app which allows private transfer of assets ### Core diff --git a/docs/getting_started.md b/docs/getting_started.md index 3dfeefe..dfccf2b 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -1,12 +1,14 @@ # Quartz: Getting Started Guide --- + WARNING: Quartz is under heavy development and is not ready for production use. The current code contains known bugs and security vulnerabilities and APIs are still liable to change. We are making it available for devleopers to start playing with and to gather feedback on APIs and roadmap. It can be used today on CosmWasm testnets (testnets only, with no real funds at risk!). + --- ## Table of Contents @@ -47,7 +49,12 @@ For more detailed instructions, continue reading the following sections. ## Simple Example -The Transfer Application is a simple template / demo app designed to showcase very basic use of the Quartz framework. It allows users to deposit funds into a contract, transfer them privately within the contract's encrypted state, and ultimately withdraw whatever balance they have left or have accumulated. +Quartz includes a simple example we call the `Transfer` application. It's +located in [/apps/transfers](/apps/transfers). It's a simple demo app +designed to showcase very basic use of the Quartz framework. +It allows users to deposit funds into a contract, +transfer them privately within the contract's encrypted state, +and ultimately withdraw whatever balance they have left or have accumulated. ### Key Features - Deposit funds into a smart contract @@ -156,6 +163,10 @@ make start-docker-container If using docker it will pre-configure a few keys and allocate funds to them. +If building from source, you'll need to initialize the accounts yourself. See +the guide on [setting up a CosmWasm chain](/docs/wasmd_setup.md) and then return +back here. + ## Local Testnet Without SGX @@ -215,9 +226,9 @@ transfers app is currently single asset only. If successful, it will print the resulting contract address. Save it to an environment variable: - ```bash - export CONTRACT_ADDRESS= - ``` +```bash +export CONTRACT_ADDRESS= +``` 3. Perform the handshake: ```bash @@ -230,9 +241,9 @@ If successful, it should output a pubkey value. We'll need both the contract address and this pubkey value to configure the frontend. Save this to an environment variable: - ```bash - export PUBKEY= - ``` +```bash +export PUBKEY= +``` Now the contract is ready to start processing requests to the enclave. @@ -278,9 +289,9 @@ Create a new address in Keplr for testing purpose. You'll need to send this address some funds from the `admin` account setup with your local node. For instance, send 10M ucosm with: - ```bash - wasmd tx bank send admin 10000000ucosm --chain-id testing - ``` +```bash +wasmd tx bank send admin 10000000ucosm --chain-id testing +``` You should now see the funds on your local testnet on Keplr. diff --git a/docs/wasmd_setup.md b/docs/wasmd_setup.md new file mode 100644 index 0000000..83576a0 --- /dev/null +++ b/docs/wasmd_setup.md @@ -0,0 +1,86 @@ +## CosmWasm Node Setup + +Here we describe how to initialize accounts and balances on a CosmWasm +blockchain. + +We'll assume you're using `wasmd` but it could be `neutrond` or any other. + +We'll also assume your chain ID is `testing`. + +Run `wasmd init --chain-id testing` to initialize the local wasmd +folder. + +Now open the file `~/.wasmd/config/client.toml` and change the field +`keyring-backend` from `os` to `test`: + +```toml +keyring-backend = "test" +``` + +Now, finally, we can create a local admin key for your wasmd. You'll use this to +deploy contracts: + +```bash +wasmd keys add admin +``` + +This should output a wasm address. + +Now either you will setup a local testnet or use an existing testnet. If its an +existing testnet, you need to fund this account. Send this address to someone +who has access to the admin account for your testnet. If you have access +yourself you can send funds yourself: + +```bash +wasmd tx bank send --chain-id testing -y +``` + +If you're setting up your own local testnet, continue with the following: + +```bash +# generate a second key for the validator +wasmd keys add validator + +# fund both accounts in genesis +wasmd genesis add-genesis-account admin 100000000000stake,100000000000ucosm +wasmd genesis add-genesis-account validator 100000000000stake,100000000000ucosm + +# sign genesis tx from validator and compose genesis +wasmd genesis gentx validator 100000000stake --chain-id testing +wasmd genesis collect-gentxs +``` + +Before finally starting the node, for it to work with the front end, you need to +configure CORS. + +In `~/.wasmd/config/config.toml`, you'll need to make sure the listen address +binds to the public IP (0.0.0.0) and the CORS allows all origins: + +```toml +[rpc] +laddr = "tcp://0.0.0.0:26657" +cors_allowed_origins = ["*"] +``` + +And in `~/.wasmd/config/app.toml`: + +```toml +[api] +enable = true +address = "tcp://0.0.0.0:1317" +enabled-unsafe-cors = true +``` + +Now, finally: + +```bash +wasmd start +``` + +And you should have a chain making blocks! + +You can also reduce the block time by lowering `timeout_commit` in +`~/.wasmd/config/config.toml`. + +Now that you have the chain running, you can start running the enclave and proxy +in other windows.