From f33e6b93a90a6540d9d965c723a92a33010b8fcc Mon Sep 17 00:00:00 2001 From: nguyer Date: Wed, 15 Nov 2023 15:45:57 +0000 Subject: [PATCH] deploy: e0e9e34e9f6347227bf6644bcb1b202b5b76dfcc --- head/assets/js/search-data.json | 14 +++++----- head/tutorials/chains/tezos_testnet.html | 30 +++++++++++++++------- head/tutorials/custom_contracts/tezos.html | 4 +-- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/head/assets/js/search-data.json b/head/assets/js/search-data.json index 0a7356755..c1eeace62 100644 --- a/head/assets/js/search-data.json +++ b/head/assets/js/search-data.json @@ -4663,7 +4663,7 @@ },"777": { "doc": "Tezos", "title": "Example smart contract", - "content": "First let’s look at a simple contract smart contract called SimpleStorage, which we will be using on a Tezos blockchain. Here we have one state variable called ‘storedValue’ and initialized with the value 12. During initialization the type of the variable was defined as ‘int’. You can see more at SmartPy types. And then we added a simple test, which set the storage value to 15 and checks that the value was changed as expected. NOTE: Tests are used to verify the validity of contract entrypoints and do not affect the state of the contract during deployment. Here is the source for this contract: . import smartpy as sp @sp.module def main(): class SimpleStorage(sp.Contract): def __init__(self, value): self.data.storedValue = value @sp.entrypoint def replace(self, params): self.data.storedValue = params.value @sp.add_test(name=\"SimpleStorage\") def test(): c1 = main.SimpleStorage(12) scenario = sp.test_scenario(main) scenario.h1(\"SimpleStorage\") scenario += c1 c1.replace(value=15) scenario.verify(c1.data.storedValue == 15) . ", + "content": "First let’s look at a simple contract smart contract called SimpleStorage, which we will be using on a Tezos blockchain. Here we have one state variable called ‘storedValue’ and initialized with the value 12. During initialization the type of the variable was defined as ‘int’. You can see more at SmartPy types. And then we added a simple test, which set the storage value to 15 and checks that the value was changed as expected. NOTE: Smart contract’s tests (marked with @sp.add_test annotation) are used to verify the validity of contract entrypoints and do not affect the state of the contract during deployment. Here is the source for this contract: . import smartpy as sp @sp.module def main(): class SimpleStorage(sp.Contract): def __init__(self, value): self.data.storedValue = value @sp.entrypoint def replace(self, params): self.data.storedValue = params.value @sp.add_test(name=\"SimpleStorage\") def test(): c1 = main.SimpleStorage(12) scenario = sp.test_scenario(main) scenario.h1(\"SimpleStorage\") scenario += c1 c1.replace(value=15) scenario.verify(c1.data.storedValue == 15) . ", "url": "/firefly/head/tutorials/custom_contracts/tezos.html#example-smart-contract", "relUrl": "/tutorials/custom_contracts/tezos.html#example-smart-contract" },"778": { @@ -4699,7 +4699,7 @@ },"783": { "doc": "Tezos", "title": "Invoke the smart contract", - "content": "Now that we’ve got everything set up, it’s time to use our smart contract! We’re going to make a POST request to the invoke/replace endpoint to set the integer value on-chain. Let’s set it to the value of 3 right now. Request . POST http://localhost:5000/api/v1/namespaces/default/apis/simple-storage/invoke/replace . { \"input\": { \"newValue\": 3 }, \"key\": \"tz1cuFw1E2Mn2bVS8q8d7QoCb6FXC18JivSp\" } . NOTE: The key field is the Tezos account address, which will be used for signing our transactions. See more at transaction signing service set up. Response . { \"id\": \"cb38a538-7093-4150-8a80-6097a666df82\", \"namespace\": \"default\", \"tx\": \"5860befb-9f76-4aa0-a67c-55718b2c46d6\", \"type\": \"blockchain_invoke\", \"status\": \"Pending\", \"plugin\": \"tezos\", \"input\": { \"input\": { \"newValue\": 3 }, \"interface\": \"c655704a-f0e2-4aa3-adbb-c7bf3280cdc2\", \"key\": \"tz1cuFw1E2Mn2bVS8q8d7QoCb6FXC18JivSp\", \"location\": { \"address\": \"KT1D254HTPKq5GZNVcF73XBinG9BLybHqu8s\" }, \"method\": { \"description\": \"\", \"id\": \"6f707105-d8b5-4808-a864-51475086608d\", \"interface\": \"c655704a-f0e2-4aa3-adbb-c7bf3280cdc2\", \"name\": \"replace\", \"namespace\": \"default\", \"params\": [ { \"name\": \"newValue\", \"schema\": { \"details\": { \"internalType\": \"integer\", \"type\": \"integer\" }, \"type\": \"integer\" } } ], \"pathname\": \"replace\", \"returns\": [] }, \"methodPath\": \"replace\", \"options\": null, \"type\": \"invoke\" }, \"created\": \"2023-09-27T09:12:24.033724927Z\", \"updated\": \"2023-09-27T09:12:24.033724927Z\" } . You’ll notice that we got an ID back with status Pending, and that’s expected due to the asynchronous programming model of working with custom onchain logic in FireFly. After a while, let’s see the result of our operation. ", + "content": "Now that we’ve got everything set up, it’s time to use our smart contract! We’re going to make a POST request to the invoke/replace endpoint to set the integer value on-chain. Let’s set it to the value of 3 right now. Request . POST http://localhost:5000/api/v1/namespaces/default/apis/simple-storage/invoke/replace . { \"input\": { \"newValue\": 3 }, \"key\": \"tz1cuFw1E2Mn2bVS8q8d7QoCb6FXC18JivSp\" } . NOTE: The key field (optional) is the tezos account’s address, which is used to sign blockchain transactions. See more at transaction signing service set up. Response . { \"id\": \"cb38a538-7093-4150-8a80-6097a666df82\", \"namespace\": \"default\", \"tx\": \"5860befb-9f76-4aa0-a67c-55718b2c46d6\", \"type\": \"blockchain_invoke\", \"status\": \"Pending\", \"plugin\": \"tezos\", \"input\": { \"input\": { \"newValue\": 3 }, \"interface\": \"c655704a-f0e2-4aa3-adbb-c7bf3280cdc2\", \"key\": \"tz1cuFw1E2Mn2bVS8q8d7QoCb6FXC18JivSp\", \"location\": { \"address\": \"KT1D254HTPKq5GZNVcF73XBinG9BLybHqu8s\" }, \"method\": { \"description\": \"\", \"id\": \"6f707105-d8b5-4808-a864-51475086608d\", \"interface\": \"c655704a-f0e2-4aa3-adbb-c7bf3280cdc2\", \"name\": \"replace\", \"namespace\": \"default\", \"params\": [ { \"name\": \"newValue\", \"schema\": { \"details\": { \"internalType\": \"integer\", \"type\": \"integer\" }, \"type\": \"integer\" } } ], \"pathname\": \"replace\", \"returns\": [] }, \"methodPath\": \"replace\", \"options\": null, \"type\": \"invoke\" }, \"created\": \"2023-09-27T09:12:24.033724927Z\", \"updated\": \"2023-09-27T09:12:24.033724927Z\" } . You’ll notice that we got an ID back with status Pending, and that’s expected due to the asynchronous programming model of working with custom onchain logic in FireFly. After a while, let’s see the result of our operation. ", "url": "/firefly/head/tutorials/custom_contracts/tezos.html#invoke-the-smart-contract", "relUrl": "/tutorials/custom_contracts/tezos.html#invoke-the-smart-contract" },"784": { @@ -4729,31 +4729,31 @@ },"788": { "doc": "pages.tezos_testnet", "title": "Set up the transaction signing service ", - "content": "Signatory service allows to work with many different key-management systems. You should choose and set up an appropriate one. For development/prototyping purposes the easiest way is to use the local signing option. Note: Tezos accounts (private/public keys) should be generated by chosen KMS. ", + "content": "Signatory service allows to work with many different key-management systems. By default, FF uses local signing option. However, it is also possible to configure the transaction signing service using key management systems such as: AWS/Google/Azure KMS, HCP Vault, etc. NOTE: The default option is not secure and is mainly used for development and demo purposes. Therefore, for the production, use the selected KMS. The full list can be found here. ", "url": "/firefly/head/tutorials/chains/tezos_testnet.html#set-up-the-transaction-signing-service-", "relUrl": "/tutorials/chains/tezos_testnet.html#set-up-the-transaction-signing-service-" },"789": { "doc": "pages.tezos_testnet", "title": "Create a tezosconnect.yml config file", - "content": "In order to connect to the Tezos testnet, you will need to set a few configuration options for the tezosconnect blockchain connector. Create a text file called tezosconnect.yml with the following contents: . connector: blockchain: rpc: https://rpc.ghost.tzstats.com network: ghostnet signatory: http://127.0.0.1:6732 # tx signing service address . For this tutorial, we will assume this file is saved at ~/Desktop/tezosconnect.yml. If your path is different, you will need to adjust the path in the next command below. ", + "content": "In order to connect to the Tezos testnet, you will need to set a few configuration options for the tezosconnect blockchain connector. Create a text file called tezosconnect.yml with the following contents: . connector: blockchain: rpc: https://ghostnet.ecadinfra.com network: ghostnet signatory: http://127.0.0.1:6732 # tx signing service address . For this tutorial, we will assume this file is saved at ~/Desktop/tezosconnect.yml. If your path is different, you will need to adjust the path in the next command below. ", "url": "/firefly/head/tutorials/chains/tezos_testnet.html#create-a-tezosconnectyml-config-file", "relUrl": "/tutorials/chains/tezos_testnet.html#create-a-tezosconnectyml-config-file" },"790": { "doc": "pages.tezos_testnet", "title": "Creating a new stack", - "content": "To create a local FireFly development stack and connect it to the Tezos Ghostnet testnet, we will use command line flags to customize the following settings: . | Create a new Tezos based stack named tezos with 1 member | Disable multiparty mode. We are going to be using this FireFly node as a Web3 gateway, and we don’t need to communicate with a consortium here | Merge the custom config created above with the generated tezosconnect.yml config file | . To do this, run the following command: . ff init ethereum tezos 1 \\ --multiparty=false \\ --connector-config ~/Desktop/tezosonnect.yml . ", + "content": "To create a local FireFly development stack and connect it to the Tezos Ghostnet testnet, we will use command line flags to customize the following settings: . | Create a new Tezos based stack named tezos with 1 member | Disable multiparty mode. We are going to be using this FireFly node as a Web3 gateway, and we don’t need to communicate with a consortium here | Merge the custom config created above with the generated tezosconnect.yml config file | . To do this, run the following command: . ff init tezos dev 1 \\ --multiparty=false \\ --connector-config ~/Desktop/tezosonnect.yml . ", "url": "/firefly/head/tutorials/chains/tezos_testnet.html#creating-a-new-stack", "relUrl": "/tutorials/chains/tezos_testnet.html#creating-a-new-stack" },"791": { "doc": "pages.tezos_testnet", "title": "Start the stack", - "content": "Now you should be able to start your stack by running: . ff start tezos . After some time it should print out the following: . Web UI for member '0': http://127.0.0.1:5000/ui Sandbox UI for member '0': http://127.0.0.1:5109 To see logs for your stack run: ff logs tezos . ", + "content": "Now you should be able to start your stack by running: . ff start dev . After some time it should print out the following: . Web UI for member '0': http://127.0.0.1:5000/ui Sandbox UI for member '0': http://127.0.0.1:5109 To see logs for your stack run: ff logs dev . ", "url": "/firefly/head/tutorials/chains/tezos_testnet.html#start-the-stack", "relUrl": "/tutorials/chains/tezos_testnet.html#start-the-stack" },"792": { "doc": "pages.tezos_testnet", "title": "Get some XTZ", - "content": "At this point you should have a working FireFly stack, talking to a public chain. However, you won’t be able to run any transactions just yet, because you don’t have any way to pay transaction fee. A testnet faucet can give us some XTZ, the native token for Tezos. First, you need to get an account address, which was created during signer set up step. After that, go to Tezos Ghostnet Faucet and paste the address in the form and click the Request button. Confirm the transaction on TzStats . You should be able to go lookup your account on TzStats for the Ghostnet testnet and see that you now have a balance of 100 XTZ (or 2001 XTZ accordingly). Simply paste in your account address to search for it. On the Transfers tab from you account page you will see the actual transfer of the XTZ from the faucet. ", + "content": "At this point you should have a working FireFly stack, talking to a public chain. However, you won’t be able to run any transactions just yet, because you don’t have any way to pay transaction fee. A testnet faucet can give us some XTZ, the native token for Tezos. First, you need to get an account address, which was created during signer set up step. To check that, you can run: . ff accounts list dev [ { \"address\": \"tz1cuFw1E2Mn2bVS8q8d7QoCb6FXC18JivSp\", \"privateKey\": \"...\" } ] . After that, go to Tezos Ghostnet Faucet and paste the address in the form and click the Request button. Confirm the transaction on TzStats . You should be able to go lookup your account on TzStats for the Ghostnet testnet and see that you now have a balance of 100 XTZ (or 2001 XTZ accordingly). Simply paste in your account address to search for it. On the Transfers tab from you account page you will see the actual transfer of the XTZ from the faucet. ", "url": "/firefly/head/tutorials/chains/tezos_testnet.html#get-some-xtz", "relUrl": "/tutorials/chains/tezos_testnet.html#get-some-xtz" },"793": { diff --git a/head/tutorials/chains/tezos_testnet.html b/head/tutorials/chains/tezos_testnet.html index 67a4c19a4..b354680ed 100644 --- a/head/tutorials/chains/tezos_testnet.html +++ b/head/tutorials/chains/tezos_testnet.html @@ -326,10 +326,13 @@

-

Signatory service allows to work with many different key-management systems. -You should choose and set up an appropriate one. -For development/prototyping purposes the easiest way is to use the local signing option. -Note: Tezos accounts (private/public keys) should be generated by chosen KMS.

+

Signatory service allows to work with many different key-management systems.
+By default, FF uses local signing option.
+However, it is also possible to configure the transaction signing service using key management systems such as: AWS/Google/Azure KMS, HCP Vault, etc.

+
+

NOTE: The default option is not secure and is mainly used for development and demo purposes. Therefore, for the production, use the selected KMS.
+The full list can be found here.

+

@@ -343,7 +346,7 @@

connector:
   blockchain:
-    rpc: https://rpc.ghost.tzstats.com
+    rpc: https://ghostnet.ecadinfra.com
     network: ghostnet
     signatory: http://127.0.0.1:6732 # tx signing service address
 
@@ -368,7 +371,7 @@

To do this, run the following command:

-
ff init ethereum tezos 1 \
+
ff init tezos dev 1 \
     --multiparty=false \
     --connector-config ~/Desktop/tezosonnect.yml
 
@@ -383,7 +386,7 @@

Now you should be able to start your stack by running:

-
ff start tezos
+
ff start dev
 

After some time it should print out the following:

@@ -394,7 +397,7 @@

To see logs for your stack run: -ff logs tezos +ff logs dev

@@ -407,7 +410,16 @@

At this point you should have a working FireFly stack, talking to a public chain. However, you won’t be able to run any transactions just yet, because you don’t have any way to pay transaction fee. A testnet faucet can give us some XTZ, the native token for Tezos.

-

First, you need to get an account address, which was created during signer set up step.

+

First, you need to get an account address, which was created during signer set up step.
+To check that, you can run:

+
ff accounts list dev
+[
+  {
+    "address": "tz1cuFw1E2Mn2bVS8q8d7QoCb6FXC18JivSp",
+    "privateKey": "..."
+  }
+]
+

After that, go to Tezos Ghostnet Faucet and paste the address in the form and click the Request button.

diff --git a/head/tutorials/custom_contracts/tezos.html b/head/tutorials/custom_contracts/tezos.html index 8d24c3c0c..15c24bf7c 100644 --- a/head/tutorials/custom_contracts/tezos.html +++ b/head/tutorials/custom_contracts/tezos.html @@ -358,7 +358,7 @@

First let’s look at a simple contract smart contract called SimpleStorage, which we will be using on a Tezos blockchain. Here we have one state variable called ‘storedValue’ and initialized with the value 12. During initialization the type of the variable was defined as ‘int’. You can see more at SmartPy types. And then we added a simple test, which set the storage value to 15 and checks that the value was changed as expected.

-

NOTE: Tests are used to verify the validity of contract entrypoints and do not affect the state of the contract during deployment.

+

NOTE: Smart contract’s tests (marked with @sp.add_test annotation) are used to verify the validity of contract entrypoints and do not affect the state of the contract during deployment.

Here is the source for this contract:

@@ -872,7 +872,7 @@

-

NOTE: The key field is the Tezos account address, which will be used for signing our transactions. +

NOTE: The key field (optional) is the tezos account’s address, which is used to sign blockchain transactions.
See more at transaction signing service set up.