Catenis Flow Guide

Export Asset Node

The Export Asset Node deploys a smart contract to create a “Token” equivalent to a Catenis Smart Asset on the foreign blockchain.  While exporting an asset creates the equivalent of the Catenis Smart Asset with all of its properties, exporting an asset does not create any units of that Catenis Smart Asset on the foreign blockchain; it simply creates the “Asset Type.”  Before any units of the asset can be transferred to the foreign blockchain, it is necessary to use the Export Asset node to create the asset type on the foreign blockchain. The same Catenis Smart Assets can be exported to more than one foreign blockchain provided you have enough units of that Catenis Smart Asset to migrate some units to one blockchain while migrating other units of the asset to other blockchains. For example, if you have five units of the XYZ smart asset, you can migrate one unit of XYZ to Polygon PoS Chain, one unit to Ethereum, and the other three units to Binance Smart Chain. To learn how to transfer units after exporting, see “Migrating Assets” Node here:

Image of the Export Asset Node

Node Properties Panel Field Description

Node property configuration slide-out panel (this panel is accessed by double-clicking on the node).

Properties Configuration Panel of the Export Asset Node

Node-RED Specific Fields

 

  1. Name Field:  Add a descriptive name that will help differentiate this node from others of the same type on the Node-RED workspace (not required).
  2. Connection Field: This drop-down selection is required. Set a previously configured Catenis connection (virtual device). If you need to configure a new virtual device, click the pencil button to the right of the field and follow the directions on setting up a new virtual device that you can find here.

Catenis Flow Setting Fields

  1. Asset ID: Enter the ID of a previously created Catenis Smart Asset that you will export to a foreign blockchain.
  2. Foreign Blockchain: Select a foreign blockchain to export Catenis Smart Assets among the available foreign blockchains, which currently include: Ethereum • Binance Smart ChainPolygon PoS Chain
  3. Consumption Profile: When the Export Asset functionality issues a transaction on the foreign blockchain, you may choose how fast or slow this transaction will be confirmed. Although Blockchain of Things does not charge a fee for this transaction type, this transaction will occur on a foreign blockchain and will therefore incur a fee in that blockchain’s native cryptocurrency. The fees are based on the fee market of the foreign blockchain and must be decided by the user. The fee amount is inversely related to the speed that you select, such that the fastest transaction times are the most expensive.

Note: All foreign tokens deposited into this account are non-refundable.

Note: Setting the consumption profile at this level overrides the consumption profile settings at the administrative dashboard on your account.

Note: Faster is more expensive, and slower is least expensive.

  1. Estimate Only: Simulate the foreign blockchain transaction in order to estimate the transaction fee. The result indicates the approximate amount of the cryptocurrency needed in your administrative dashboard’s “Asset Export Admin Account” in order to complete the transaction.

Tip: If the price is too high, set the transaction speed slower in the “Consumption Profile” field and re-run the estimate to get a lower fee.

How to Use

  1. Drag-and-drop the Export Asset Node from the Catenis Flow pallet on the left-hand side of the interface to the Node-RED workspace. Double-click on the node to display the properties slide-out panel.
  2. On the “Device” drop-down field of the properties slide-out panel, choose the Catenis Virtual Device you previously configured. The virtual device is a configuration node containing the Catenis Virtual Device information (The device ID and API Secret Key). If you do not have a virtual device already configured, please refer to our documentation titled: “Configure your First Virtual Device on Node-RED” here:
  3. Add the node’s configuration information to each field of the properties slide-out panel based on your needs.  Please refer to the description of each field under the section named “Node Properties Panel Field Description” for proper usage.
  4. Then, wire this node to a debug node. 
  5. Next, drag-and-drop an “inject” node to the Node-RED workspace.
  6. Wire the “inject” node to the “Export Assets” Node, and double click the inject node to open its properties slide-out panel. 
  7. Alter the information in the inject node’s properties slide-out panel by selecting the drop-down “Payload” field and choose the “JSON” Type. An Ellipse button “…” will appear to the right of the field. Click this ellipse button to display a JSON edit box. 
  8. Enter the JSON information you wish to pass as an input to the Catenis Node (an example JSON input is below). After entering your JSON text entry, click the red “Done” button. Click the Done button again to exit the properties dialogue box.
  9. Click the red “Deploy” button on the upper right-hand side of the Node-RED dashboard to deploy this flow.
  10. Now, let’s test the flow: Click the button on the left attached to the inject node to send the input from the inject node to the flow.
  11. The debug sidebar should display the returned JSON object containing the API call results to the right side of the workspace.
  12. To ensure that the export has been performed correctly, you can use the “Asset Export Outcome Node,” alternatively, you can get the TX ID from the returned JSON object and check the transaction using a block explorer.

Note: You will need to install an application that supports the foreign blockchain to which you are exporting your Catenis Smart Assets. You can see which blockchains are supported by popular wallet applications below:

Note: Some wallet apps (e.g., MetaMask) require you to supply the token contract address in order for tokens to be added to the wallet. After exporting the token using the Export Asset Node, you can access the newly created smart contract by executing the "Asset Export Outcome" node or the "List Exported Assets" node. These nodes return a "token.id" object in the JSON result that contains the contract address. Alternatively, you can see the contract address via the Asset Export Outcome notification, or simply examine the transaction ID on a block explorer.

Example JSON Object that can be passed to the Catenis Flow Node


{
    "assetId": "Insert_Asset_ID",
    "foreignBlockchain": "ethereum",
    "token": {
        "name": "Export Demo Token",
        "symbol": "EDT"
    },
    "options": {
        "estimateOnly": true
    }
}

Note: Inputs injected into this node via a JSON object containing alternate node properties will override the properties set on this node's slide-out properties panel.

Example Flow - Import into Node-Red to Get Started


[{"id":"eaddef34.1f5d7","type":"export asset","z":"3dbf2c28.70dd6c","name":"","connection":"","assetId":"","foreignBlockchain":"","consumptionProfile":"slow","estimateOnly":true,"x":470,"y":100,"wires":[["af1112a5.2ddf3"]]},{"id":"af1112a5.2ddf3","type":"debug","z":"3dbf2c28.70dd6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":100,"wires":[]},{"id":"e47e18d4.0082","type":"inject","z":"3dbf2c28.70dd6c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"assetId\":\"Insert_Your_Asset_ID\",\"foreignBlockchain\":\"ethereum\",\"token\":{\"name\":\"Export Demo Token\",\"symbol\":\"EDT\"},\"options\":{\"estimateOnly\":true}}","payloadType":"json","x":190,"y":100,"wires":[["eaddef34.1f5d7"]]},{"id":"7dbbd9be.b62088","type":"comment","z":"3dbf2c28.70dd6c","name":"Double click for instructions","info":"Please use your own asset ID generated when you previously issued an asset with Catenis. If you are not familiar with issuing assets on Catenis, please see the documentation titled issuing assets with Catenis flow.\n\nSTEPS:\n1) Double-click the \"inject\" node to alter the information in the inject node. Select the drop-down payload field and choose the \"JSON\" Type.\n\n2)Click the ellipses \"...\" to the right of the JSON field. This will open up a slide-out box where you can edit the JSON File.\n\n3)Modify the Asset ID information by using an asset ID you have previously issued. \n\n4) Make any adjustments as necessary to the JSON inputs. \n\n\n","x":180,"y":140,"wires":[]},{"id":"32daad09.df69e2","type":"comment","z":"3dbf2c28.70dd6c","name":"Set virtual device for this Catenis node - Click for instructions","info":"All Catenis nodes require that you set the proper virtual device on its slideout property panel on the device field. A Catenis Virtual Device is the equivalent of an API Account credential. If you are not familiar with a Catneis Virtual device, please read \"The Catenis Virtual Device\" in the Users guide.\n\n\nNot setting the virtual device properly will result in a \"TypeError: Cannot read property 'ctnApiClient' of null.\" ","x":480,"y":60,"wires":[]}]

Related Articles

(document).ready(function($) { $(".copy-button").on("click", function(evt) { evt.preventDefault(); var ta = document.createElement('textarea'); ta.value = $(this).next()[0].innerText; ta.style.position = 'absolute'; ta.style.left = '-3000px'; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta); $(this).text("Copied!"); var self = $(this); setTimeout(function() { self.text("Copy"); },3000) }); });