diff --git a/docs/lcd-server-example.md b/docs/lcd-server-example.md index 39c427411..44b837d4f 100644 --- a/docs/lcd-server-example.md +++ b/docs/lcd-server-example.md @@ -1,10 +1,8 @@ 1. Put this file in `/etc/systemd/system/secret-lcd.service` 2. Make sure `/bin/secretcli` is the right path for secretcli 3. Make sure port 443 is open -4. Make sure `secret-1` is the right chain ID +4. Make sure `--chain-id` is the right chain ID 5. Make sure `ubuntu` is the right user -6. Enable on startup: `sudo systemctl enable secret-lcd` -7. Start now: `sudo systemctl start secret-lcd` ``` [Unit] @@ -13,7 +11,7 @@ After=network.target [Service] Type=simple -ExecStart=/bin/secretcli rest-server --chain-id secret-1 --laddr tcp://0.0.0.0:1337 +ExecStart=/bin/secretcli rest-server --chain-id secret-1 --laddr tcp://127.0.0.1:1337 User=ubuntu Restart=always StartLimitInterval=0 @@ -24,8 +22,14 @@ LimitNOFILE=65535 WantedBy=multi-user.target ``` +Enable on startup and start: +```bash +sudo systemctl enable secret-lcd +sudo systemctl start secret-lcd +``` + Then, install caddy: https://caddyserver.com/docs/download#debian-ubuntu-raspbian -Edit /etc/caddy/Caddyfile to have this inside (Replace `bootstrap.int.testnet.enigma.co` with your domain name): +Edit `/etc/caddy/Caddyfile` to have this inside (Replace `bootstrap.int.testnet.enigma.co` with your domain name): ``` bootstrap.int.testnet.enigma.co @@ -48,5 +52,5 @@ reverse_proxy 127.0.0.1:1337 And then: ```bash sudo systemctl enable caddy.service -sudo systemctl start caddy.service +sudo systemctl start caddy.service ``` diff --git a/docs/testnet/deploy-contract.md b/docs/testnet/deploy-contract.md new file mode 100644 index 000000000..0baaa5ec0 --- /dev/null +++ b/docs/testnet/deploy-contract.md @@ -0,0 +1,68 @@ +## WARNING - Work in progress and unfinished + +### General + +The general steps we perform to create a secret contract are: + +1. Upload Code - Upload some optimized wasm code, no state nor contract address (example Standard ERC20 contract) +2. Instantiate Contract - Instantiate a code reference with some initial state, creates new address (example set token name, max issuance, etc for my ERC20 token) +3. Execute Contract - This may support many different calls, but they are all unprivileged usage of a previously instantiated contract, depends on the contract design (example: Send ERC20 token, grant approval to other contract) + +In this guide we will focus on steps 1 and 2. + +You can read more about the process, and other comparisons to Solidity, in the [cosmwasm documentation](https://www.cosmwasm.com/docs/getting-started/smart-contracts). + +### 1. Download the prebuilt contract + +`` + +### 2. Upload the optimized contract.wasm: + +``` +secretcli tx compute store contract.wasm --from --gas auto -y +``` + +#### Check that your code was uploaded properly + +List current smart contract code + +``` +secretcli query compute list-code +[ + { + "id": 1, + "creator": "secret1klqgym9m7pcvhvgsl8mf0elshyw0qhruy4aqxx", + "data_hash": "0C667E20BA2891536AF97802E4698BD536D9C7AB36702379C43D360AD3E40A14", + "source": "", + "builder": "" + } +] +``` + +You should see the `data_hash` of `TBD` with your address as the `creator` + +### 3. Instantiate the Smart Contract + +At this point the contract's been uploaded and stored on the testnet, but there's no "instance". This allows to deploy multiple instances from the same code, for example if you wanted to create multiple different "ERC-20" coins from the same base contract. You can read more about the logic behind this decision, and other comparisons to Solidity, in the [cosmwasm documentation](https://www.cosmwasm.com/docs/getting-started/smart-contracts). + +To create an instance of this project we must also provide some JSON input data, a starting count. + +``` +INIT="{\"count\": 100000000}" +CODE_ID= +secretcli tx compute instantiate $CODE_ID "$INIT" --from a --label "my counter" -y --keyring-backend test +``` +With the contract now initialized, we can find its address + +secretcli query compute list-contract-by-code 1 + +Our instance is secret18vd8fpwxzck93qlwghaj6arh4p7c5n8978vsyg + +We can query the contract state + +CONTRACT=secret18vd8fpwxzck93qlwghaj6arh4p7c5n8978vsyg +secretcli query compute contract-state smart $CONTRACT "{\"get_count\": {}}" + +And we can increment our counter + +secretcli tx compute execute $CONTRACT "{\"increment\": {}}" --from a diff --git a/docs/testnet/verify-sgx.md b/docs/testnet/verify-sgx.md index 79429492f..b024392a6 100644 --- a/docs/testnet/verify-sgx.md +++ b/docs/testnet/verify-sgx.md @@ -122,3 +122,11 @@ ERROR: failed to create attestation report: Error calling the VM: SGX_ERROR_SERV ``` Make sure the `aesmd-service` is running `systemctl status aesmd.service` + +* I'm seeing `CONFIGURATION_AND_SW_HARDENING_NEEDED` in the `isvEnclaveQuoteStatus` field + +This could mean a number of different things related to the configuration of the machine, but one such example we encountered was if hyper-threading is enabled in the BIOS. It must be disabled (see: https://software.intel.com/security-software-guidance/software-guidance/l1-terminal-fault) + +* I'm seeing `SGX_ERROR_DEVICE_BUSY` + +Most likely you tried reinstalling the driver and rerunning the enclave - restarting should solve the problem diff --git a/docs/validators-and-full-nodes/join-validator-mainnet.md b/docs/validators-and-full-nodes/join-validator-mainnet.md index 9947873da..58d07ba1c 100644 --- a/docs/validators-and-full-nodes/join-validator-mainnet.md +++ b/docs/validators-and-full-nodes/join-validator-mainnet.md @@ -13,9 +13,7 @@ perl -i -pe 's/^minimum-gas-prices = .+?$/minimum-gas-prices = "0.1uscrt"/' ~/.s sudo systemctl restart secret-node ``` -Your validator will not propose transactions that specify `--gas-price` lower than the `minimun-gas-price` you set here. - -This is the main parameter the affects your ROI, so you should adjust it with time. +Your validator will not accept transactions that specify `--gas-price` lower than the `minimun-gas-price` you set here. ### 3. Generate a new key pair for yourself (change `` with any word of your choice, this is just for your internal/personal reference): diff --git a/docs/validators-and-full-nodes/setup-sgx.md b/docs/validators-and-full-nodes/setup-sgx.md index 78e1c80e6..7b53f10d1 100644 --- a/docs/validators-and-full-nodes/setup-sgx.md +++ b/docs/validators-and-full-nodes/setup-sgx.md @@ -15,8 +15,10 @@ If you're running a local machine and not a cloud-based VM - Note: `sgx_linux_x64_driver_2.6.0_602374c.bin` is the latest driver as of July 13, 2020. Please check under https://download.01.org/intel-sgx/sgx-linux/ that this is still the case. If not, please send us a PR or notify us. ```bash +#! /bin/bash + UBUNTUVERSION=$(lsb_release -r -s | cut -d '.' -f 1) -PSW_PACKAGES='libsgx-enclave-common libsgx-urts sgx-aesm-service libsgx-uae-service autoconf libtool' +PSW_PACKAGES='libsgx-enclave-common libsgx-urts sgx-aesm-service libsgx-uae-service autoconf libtool make' if (($UBUNTUVERSION < 16)); then echo "Your version of Ubuntu is not supported. Must have Ubuntu 16.04 and up. Aborting installation script..." @@ -101,6 +103,8 @@ Then you can use this script (or run the commands one-by-one), which was tested ### Install SGX SDK + Driver ```bash +#! /bin/bash + UBUNTUVERSION=$(lsb_release -r -s | cut -d '.' -f 1) if (($UBUNTUVERSION < 16)); then @@ -117,7 +121,7 @@ echo "##### Installing missing packages #####" echo "#######################################\n\n" # Install needed packages for script -sudo apt install -y lynx parallel gdebi +sudo apt install -y lynx parallel gdebi make # Create a working directory to download and install the SDK inside mkdir -p "$HOME/.sgxsdk" diff --git a/yarn.lock b/yarn.lock index 15b061b1c..c7915a96b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4625,9 +4625,9 @@ lodash.uniq@^4.5.0: integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.5: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + version "4.17.19" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" + integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== loglevel@^1.6.8: version "1.6.8"