 {"id":910,"date":"2023-01-04T04:37:03","date_gmt":"2023-01-03T18:37:03","guid":{"rendered":"https:\/\/test.secrypt.tech\/?page_id=910"},"modified":"2023-01-05T17:53:56","modified_gmt":"2023-01-05T07:53:56","slug":"using-chainide","status":"publish","type":"page","link":"https:\/\/test.secrypt.tech\/index.php\/using-chainide\/","title":{"rendered":"Using ChainIDE"},"content":{"rendered":"<style>\/*! elementor - v3.9.2 - 21-12-2022 *\/\n.elementor-widget-image{text-align:center}.elementor-widget-image a{display:inline-block}.elementor-widget-image a img[src$=\".svg\"]{width:48px}.elementor-widget-image img{vertical-align:middle;display:inline-block}<\/style>\n<p>\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/test.secrypt.tech\/\"><br \/>\n\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/elementor\/thumbs\/image-removebg-preview-pusb43b4fkgjv12hawycptkh3fmhfjngdaesxsjilk.png\" title=\"image-removebg-preview\" alt=\"image-removebg-preview\" \/>\t\t\t\t\t\t\t\t<\/a><\/p>\n<style>\/*! elementor - v3.9.2 - 21-12-2022 *\/\n.elementor-column .elementor-spacer-inner{height:var(--spacer-size)}.e-con{--container-widget-width:100%}.e-con-inner>.elementor-widget-spacer,.e-con>.elementor-widget-spacer{width:var(--container-widget-width,var(--spacer-size));--align-self:var(--container-widget-align-self,initial);--flex-shrink:0}.e-con-inner>.elementor-widget-spacer>.elementor-widget-container,.e-con-inner>.elementor-widget-spacer>.elementor-widget-container>.elementor-spacer,.e-con>.elementor-widget-spacer>.elementor-widget-container,.e-con>.elementor-widget-spacer>.elementor-widget-container>.elementor-spacer{height:100%}.e-con-inner>.elementor-widget-spacer>.elementor-widget-container>.elementor-spacer>.elementor-spacer-inner,.e-con>.elementor-widget-spacer>.elementor-widget-container>.elementor-spacer>.elementor-spacer-inner{height:var(--container-widget-height,var(--spacer-size))}<\/style>\n<style>\/*! elementor - v3.9.2 - 21-12-2022 *\/\n.elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]>a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px}<\/style>\n<h2>Deploy a Smart Contract Using ChainIDE<\/h2>\n<h4><strong>Introduction<\/strong><\/h4>\n<p>ChainIDE\u00a0is a chain agnostic, cloud-based IDE for creating decentralized applications. It enhances development cycle through pre-configured plugins that save users&#8217; time and effort. This is a beginner guide on creating and deploying a simple ERC-721 smart contract on the SECRYPT Testnet.<\/p>\n<p><b>TIP<\/b><\/p>\n<p>If you have any questions, feel free to ask the ChainIDE team in their\u00a0<u>Discord<\/u>.<\/p>\n<h4><strong>Prerequisites<\/strong><\/h4>\n<ol>\n<li>ChainIDE<\/li>\n<li>MetaMask<\/li>\n<li>Solidity<\/li>\n<\/ol>\n<h4><strong>What you will do<\/strong><\/h4>\n<p>The following are general steps for deploying an ERC-721 smart contract:<\/p>\n<ol>\n<li>Set up a wallet<\/li>\n<li>Write down an ERC-721 smart contract<\/li>\n<li>Compile an ERC-721 Smart Contract<\/li>\n<li>Deploy an ERC-721 Smart Contract<\/li>\n<li>Create a Flattened File using Flattener Library<\/li>\n<li>Verify a Smart Contract<\/li>\n<li>NFT Minting<\/li>\n<\/ol>\n<h4><strong>Setting up a Wallet<\/strong><\/h4>\n<h4><strong>Install MetaMask<\/strong><\/h4>\n<p>A gas fee must be paid when deploying a smart contract on the blockchain or making a transaction to a deployed smart contract, and we must do so using a crypto wallet, such as MetaMask. To download MetaMask, click\u00a0here.<\/p>\n<h4><strong>Adding the SECRYPT testnet<\/strong><\/h4>\n<p>After installing MetaMask, you need to add the SECRYPT Testnet to MetaMask. In order to add SECRYPT Testnet, check out the configuration guide for\u00a0MetaMask.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/a.jpg\" alt=\"\" width=\"367\" height=\"606\" \/><\/p>\n<h4><strong>Obtaining SXC tokens on Testnet<\/strong><\/h4>\n<p>After adding the SECRYPT testnet on MetaMask, visit the\u00a0 SECRYPT Faucet\u00a0to request testnet tokens. These tokens are required to pay gas fees in order to deploy and interact with the smart contract. On the faucet page, Paste your MetaMask wallet address. Then, click\u00a0Submit\u00a0and the faucet will send you some test SXC within minutes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/b.jpg\" alt=\"\" width=\"904\" height=\"853\" \/><\/p>\n<h4><strong>Write an ERC-721 Smart Contract<\/strong><\/h4>\n<p>You need to write down all the required functions that you want to implement in your ERC-721 smart contract. A general ERC-721 smart contract has the following functions:<\/p>\n<ul>\n<li>balanceOf(): returns the number of NFTs held by the owner.<\/li>\n<li>ownerOf(): returns the address of the token holder.<\/li>\n<li>approve(): approves the permission to transfer tokens on the owner\u2019s behalf. Approval event needs to be triggered after the method is successful.<\/li>\n<li>setApprovalForAll(): Sets the approval of a given operator, and the\u00a0approvalforall\u00a0event needs to be triggered after success.<\/li>\n<li>getApproved()\u00a0: Get the approved address for a single NFT.<\/li>\n<li>isApprovedForAll(): Query if an address is an authorized operator for another address.<\/li>\n<li>safeTransferFrom(): To transfer the ownership of an NFT, a successful transfer operation must initiate a transfer event.<\/li>\n<li>transferFrom(): Used to transfer NFTs. After the method succeeds, it needs to trigger the transfer event. The caller confirms he can receive NFT normally, otherwise, this NFT will be lost. When this function is implemented, it needs to check whether it meets the judgment conditions.<\/li>\n<\/ul>\n<p>The ChainIDE team has prepared a complete ERC-721 template contract that includes all the required functions; you may use this built-in template and add\/delete functions according to your requirements.<\/p>\n<p>Visit the\u00a0ChainIDE site\u00a0and click on\u00a0Try Now.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/c-1024x636.jpg\" alt=\"\" width=\"1024\" height=\"636\" \/><\/p>\n<p>Then, click on\u00a0New Project\u00a0and select\u00a0SECRYPT. You will be presented with a list of available public templates. Select\u00a0ERC721 Showcase.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/d-1024x604.jpg\" alt=\"\" width=\"1024\" height=\"604\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/d-1024x604.jpg\" alt=\"\" width=\"1024\" height=\"604\" \/><\/p>\n<p>Now, you can see the template contract,\u00a0Creature.sol, that includes all the required functions.<\/p>\n<p>After creating the project, click on the\u00a0Unconnected\u00a0button in the upper right corner, select the\u00a0Injected Web3 Provider\u00a0button, and then click on MetaMask to connect your wallet (SECRYPT Mainnet is the main network, and SECRYPT is the test network &#8211; connect to SECRYPT).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/e-1024x580.jpg\" alt=\"\" width=\"1024\" height=\"580\" \/><\/p>\n<h4><strong>Compile an ERC-721 Smart Contract<\/strong><\/h4>\n<p>After you have completed your smart contract, it is time to compile it. To compile, navigate to &#8220;compile the module&#8221;, choose an appropriate compiler according to your source code, and press the &#8220;compile&#8221; button. An ABI and bytecode for the source code are generated upon successful compilation. If there are any errors in your source code, they will be displayed in the &#8220;Logger module&#8221; under the output panel. You may need to carefully read the error, resolve it, and recompile the contract.<\/p>\n<p><b>NOTE<\/b><\/p>\n<p>Note down the\u00a0compiler version\u00a0and the\u00a0license\u00a0for your source code. It would be needed when you\u00a0Verify\u00a0your smart contract on the\u00a0SECRYPT Testnet.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/f.jpg\" alt=\"\" width=\"1156\" height=\"822\" \/><\/p>\n<h4><strong>Deploy an ERC-721 Smart Contract<\/strong><\/h4>\n<p>After successful compilation, it&#8217;s time to deploy your compiled ERC-721 smart contract to the SECRYPT Testnet. Before you deploy, you need to have MetaMask installed, the SECRYPT test network added to your wallet, and some testnet SXC tokens to pay for the transaction fees.<\/p>\n<p>Navigate to the\u00a0Deploy &amp; Interaction\u00a0module and choose among the compiled smart contract. Select the smart contract you want to deploy and click the\u00a0Deploy\u00a0button. For this tutorial, the\u00a0GameItem\u00a0smart contract will be deployed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/g-1024x650.jpg\" alt=\"\" width=\"1024\" height=\"650\" \/><\/p>\n<h4><strong>Check Functions from the Deployed Contract<\/strong><\/h4>\n<p>After successful deployment, an output message should state that your smart contract was deployed successfully. You can now verify the deployed contract. All the functions in the deployed smart contract can be seen in the\u00a0INTERACT\u00a0panel.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/h-1024x662.jpg\" alt=\"\" width=\"1024\" height=\"662\" \/><\/p>\n<h4><strong>Create a Flattened File using Flattener Library<\/strong><\/h4>\n<p>To verify a smart contract that imports other smart contracts, we need to create a flattened file. A flattened file includes all the source codes of imported contracts in a single file. To create a flattened file, you need to add a\u00a0Flattener\u00a0plug-in.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/i.jpg\" alt=\"\" width=\"930\" height=\"845\" \/><\/p>\n<p>Once the\u00a0Flattener\u00a0plug-in is activated, you&#8217;ll be able to access it as a separate module as shown in the figure below. Choose the compiled file, and click on the\u00a0Flatten\u00a0button to create a flattened file. Once the flattened file is created, it will be automatically copied to the clipboard. You may paste it into a file and save it for later usage.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/j-1024x683.jpg\" alt=\"\" width=\"1024\" height=\"683\" \/><\/p>\n<p>If you want to save the flattened file, click the\u00a0Save\u00a0button, and a flattened file will be saved in the current repository.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/k-1024x689.jpg\" alt=\"\" width=\"1024\" height=\"689\" \/><\/p>\n<p>The saved flattened file can be accessed under the explorer module.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/l.jpg\" alt=\"\" width=\"881\" height=\"836\" \/><\/p>\n<h4><strong>Verify a Smart Contract<\/strong><\/h4>\n<p>To verify a smart contract, you need to visit\u00a0SECRYPT testnet explorer, and search for the deployed smart contract using the contract address.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/m.jpg\" alt=\"\" width=\"887\" height=\"816\" \/><\/p>\n<p>Click on the\u00a0Verify and Publish\u00a0link shown under the contract section.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/n.jpg\" alt=\"\" width=\"866\" height=\"800\" \/><\/p>\n<p>Once you click on the verify and publish link, you will be asked for the following:<\/p>\n<ul>\n<li>Contract Address: The address of a deployed smart contract that you want to verify<\/li>\n<li>Compiler Type: Either you want to verify a single file or multiple files<\/li>\n<li>Compiler Version: The compiler version that you used to compile the smart contract<\/li>\n<li>License: Open-source license type that you used for your source code<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/o.jpg\" alt=\"\" width=\"846\" height=\"831\" \/><\/p>\n<p>After that, you need to paste the flattened file that you created in step 5, and your smart contract will be verified.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/p.jpg\" alt=\"\" width=\"812\" height=\"816\" \/><\/p>\n<p>If there are no issues with your smart contract, it would be verified, and you&#8217;ll be able to see an image similar to the one that is shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/q.jpg\" alt=\"\" width=\"800\" height=\"801\" \/><\/p>\n<h4><strong>Minting NFT<\/strong><\/h4>\n<p>To mint an NFT, you need to use the\u00a0Award Item\u00a0function, the wallet address of someone to whom you want to award an NFT, and the link of the photo uploaded to IPFS to be pasted in the token URL input field.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/r-1024x623.jpg\" alt=\"\" width=\"1024\" height=\"623\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/s-1024x626.jpg\" alt=\"\" width=\"1024\" height=\"626\" \/><\/p>\n<p>After successful minting, you can check the minted NFT on the OpenSea NFT marketplace. Visit\u00a0OpenSea Testnet, connect your MetaMask wallet and make sure the selected network is SECRYPT Testnet, and you&#8217;ll be able to see and trade the minted NFT on the OpenSea NFT marketplace.<\/p>\n<p>Congratulations! You have successfully minted an NFT on SECRYPT using ChainIDE.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/t-1024x640.jpg\" alt=\"\" width=\"1024\" height=\"640\" \/><\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Deploy a Smart Contract Using ChainIDE Introduction ChainIDE\u00a0is a chain agnostic, cloud-based IDE for creating decentralized applications. It enhances development cycle through pre-configured plugins that save users&#8217; time and effort. This is a beginner guide on creating and deploying a simple ERC-721 smart contract on the SECRYPT Testnet. TIP If you have any questions, feel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-910","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/pages\/910","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/comments?post=910"}],"version-history":[{"count":14,"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/pages\/910\/revisions"}],"predecessor-version":[{"id":1408,"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/pages\/910\/revisions\/1408"}],"wp:attachment":[{"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/media?parent=910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}