 {"id":935,"date":"2023-01-04T04:54:31","date_gmt":"2023-01-03T18:54:31","guid":{"rendered":"https:\/\/test.secrypt.tech\/?page_id=935"},"modified":"2023-01-05T17:54:25","modified_gmt":"2023-01-05T07:54:25","slug":"using-remix","status":"publish","type":"page","link":"https:\/\/test.secrypt.tech\/index.php\/using-remix\/","title":{"rendered":"Using Remix"},"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 Remix<\/h2>\n<h4><strong>Overview<\/strong><\/h4>\n<p>This tutorial guides you to implement a\u00a0Hello World\u00a0dApp which echoes a message passed to the contract on to the frontend. You will also be able to change the message using the interactive panel.<\/p>\n<p><b>RECOMMENDED<\/b><\/p>\n<p>We recommend you to follow this tutorial using the online IDE available at\u00a0<u>Remix IDE<\/u>. Remix IDE is an easy-to-use platform that does not require any downloads, creating accounts, or logins.<\/p>\n<h4><strong>What you will do<\/strong><\/h4>\n<ul>\n<li>Create a file on Remix<\/li>\n<li>Upload a pre-built smart contract into the IDE<\/li>\n<li>Compile the smart contract<\/li>\n<li>Connect the application to the SECRYPT Testnet via Metamask<\/li>\n<li>Deploy the smart contract<\/li>\n<li>Verify the smart contract<\/li>\n<\/ul>\n<h4><strong>Getting started with\u00a0<\/strong><strong>Remix IDE<\/strong><\/h4>\n<p>Remix is a Ethereum-focused IDE: an online platform to develop and deploy smart contracts. To start building a smart contract, click on\u00a0New File\u00a0and name it\u00a0HelloWorld.sol.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/a-1024x481.png\" alt=\"\" width=\"1024\" height=\"481\" \/><\/p>\n<h4><strong>Smart Contract<\/strong><\/h4>\n<p>Copy and paste the Smart Contract code provided below into the newly created\u00a0HelloWorld.sol\u00a0file.<\/p>\n<p>HelloWorld.sol<\/p>\n<p><em>\/\/ Specifies that the source code is for a version<\/em><br \/><em>\/\/ of Solidity greater than 0.5.10<\/em><br \/>pragma solidity ^0.5.10;<\/p>\n<p><em>\/\/ A contract is a collection of functions and data (its state)<\/em><br \/><em>\/\/ that resides at a specific address on the Ethereum blockchain.<\/em><br \/>contract HelloWorld {<\/p>\n<p>\u00a0\u00a0\u00a0 <em>\/\/ The keyword &#8220;public&#8221; makes variables accessible from outside a contract<\/em><br \/>\u00a0\u00a0\u00a0 <em>\/\/ and creates a function that other contracts or SDKs can call to access the value<\/em><br \/>\u00a0\u00a0\u00a0 string public message;<\/p>\n<p>\u00a0\u00a0\u00a0 <em>\/\/ A special function only run during the creation of the contract<\/em><br \/>\u00a0\u00a0\u00a0 constructor(string memory initMessage) public {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <em>\/\/ Takes a string value and stores the value in the memory data storage area,<\/em><br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <em>\/\/ setting `message` to that value<\/em><br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 message = initMessage;<br \/>\u00a0\u00a0\u00a0 }<\/p>\n<p>\u00a0\u00a0\u00a0 <em>\/\/ A publicly accessible function that takes a string as a parameter<\/em><br \/>\u00a0\u00a0\u00a0 <em>\/\/ and updates `message`<\/em><br \/>\u00a0\u00a0\u00a0 function update(string memory newMessage) public {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 message = newMessage;<br \/>\u00a0\u00a0\u00a0 }<br \/>}<\/p>\n<p>The first line\u00a0pragma solidity ^0.5.10\u00a0specifies that the source code is for a Solidity version greater than 0.5.10.\u00a0Pragmas\u00a0are common instructions for compilers about how to treat the source code (e.g., pragma once).<\/p>\n<p>A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain. The line\u00a0string public message\u00a0declares a public state variable called\u00a0message\u00a0of type\u00a0string. You can think of it as a single slot in a database that you can query and alter by calling functions of the code that manages the database. The keyword\u00a0public\u00a0automatically generates a function that allows you to access the current value of the state variable from outside of the contract. Without this keyword, other contracts have no way to access the variable.<\/p>\n<p>The\u00a0constructor\u00a0is a special function run during the creation of the contract and cannot be called afterward. In this case, it takes a string value\u00a0initMessage, stores the value in the\u00a0memory\u00a0data storage area, and sets\u00a0message\u00a0to that value.<\/p>\n<p>The\u00a0update\u00a0function is another public function that is similar to the constructor, taking a string as a parameter, and updating the\u00a0message\u00a0variable.<\/p>\n<h4><strong>Compile Smart Contract<\/strong><\/h4>\n<ul>\n<li>Go to the\u00a0Solidity Compiler\u00a0tab (below the search button)<\/li>\n<li>Select compiler version to\u00a00.5.10<\/li>\n<li>Now, compile\u00a0HelloWorld.sol<\/li>\n<li>After successful compilation, it will show a green tick mark on the\u00a0Compiler\u00a0tab button<\/li>\n<\/ul>\n<h4><strong>Deploying to the SECRYPT Testnet<\/strong><\/h4>\n<p>Now, we have to deploy our smart contract on SECRYPT, SECRYPT Network&#8217;s Testnet. Not only does it cost money (e.g., gas fees) to deploy a smart contract on SECRYPT Mainnet, but also, the contract is immutable and can&#8217;t be changed once deployed. Therefore, it&#8217;s best to first deploy your smart contract to the Testnet first.<\/p>\n<p>To deploy to the SECRYPT testnet, we have to connect to the Web3 world which can be accomplished by using any of the services like Metamask, Brave, Portis, etc. We will be using Metamask in this tutorial. Please follow this\u00a0guide to set up a Metamask Account.<\/p>\n<ul>\n<li>Open Metamask. Click on the network dropdown menu (set to\u00a0Ethereum Mainnet\u00a0by default) and click on the\u00a0Add Network\u00a0button.<\/li>\n<\/ul>\n<p>RPC endpoint URL below.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Network:\u00a0SECRYPT Testnet<\/li>\n<li>New RPC URL (public endpoint):\u00a0http:\/\/ttv-wkqbnkghpr.dynamic-m.com:8543\/.<\/li>\n<li>Chain ID:\u00a01144<\/li>\n<li>Currency Symbol:\u00a0SXC<\/li>\n<li>Block Explorer URL:\u00a0<a href=\"https:\/\/explorer-testnet.secrypt.tech\">https:\/\/explorer-testnet.secrypt.tech<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Go ahead and click\u00a0Save<\/li>\n<li>Copy your wallet address from Metamask by clicking over your account name<\/li>\n<li>Head over to\u00a0Faucet\u00a0and request test SXC &#8211; you will need this to pay for gas on the SECRYPT network. Select\u00a0SECRYPT\u00a0as the network and\u00a0SXC Token\u00a0as the token in the faucet. You can also use this free\u00a0SXC faucet<\/li>\n<li>Finally, to deploy to SECRYPT, refer to the instructions in the &#8220;Remix deployment&#8221; section below<\/li>\n<\/ul>\n<h4><strong>Deploying to SECRYPT Mainnet<\/strong><\/h4>\n<p>After you can deploy on the SECRYPT Testnet without any errors (i.e., the purpose of the Testnet), let&#8217;s deploy the Smart Contract on the SECRYPT Mainnet. Remember this will cost real $ in the form of SXC tokens.<\/p>\n<p>Similar to the steps above when you deployed to SECRYPT, you open your Metamask wallet. Click on the network dropdown menu (set to\u00a0Ethereum Mainnet\u00a0by default) and click on the\u00a0Add Network\u00a0button.<\/p>\n<ul>\n<li>Open Metamask\n<ul>\n<li>Network Name: SECRYPT Mainnet<\/li>\n<li>New RPC URL (public endpoint):\u00a0http:\/\/ttv-wkqbnkghpr.dynamic-m.com:8541\/.<\/li>\n<li>Chain ID: 1143<\/li>\n<li>Currency Symbol: SXC<\/li>\n<li>Block Explorer URL:\u00a0<a href=\"https:\/\/explorer-mainnet.secrypt.tech\">https:\/\/explorer-mainnet.secrypt.tech<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Go ahead and click\u00a0Save<\/li>\n<li>Copy your wallet address from Metamask by clicking over your account name<\/li>\n<li>Make sure your Metamask wallet has SXC tokens to pay the deployment \/ gas fees<\/li>\n<li>Finally, to deploy to SECRYPT, refer to the instructions in the &#8220;Remix deployment&#8221; section below<\/li>\n<\/ul>\n<h4><strong>Remix Deployment<\/strong><strong>\u00a0\u00a0\u00a0\u00a0 <\/strong><\/h4>\n<p>In both Testnet and Mainnet, you do the below to deploy your smart contract using Remix. The below step will use the connect Metamask API keys you set up in the previous steps.<\/p>\n<ul>\n<li>Select\u00a0Injected Provider\u00a0Metamask in the\u00a0Environment\u00a0dropdown and your contract<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/b-475x1024.png\" alt=\"\" width=\"475\" height=\"1024\" \/><\/p>\n<ul>\n<li>Accept the\u00a0Connect\u00a0request received in MetaMask. If the popup doesn&#8217;t open by default, you can also try manually launching the MetaMask extension<\/li>\n<li>Once MetaMask is connected to Remix, the\u00a0Deploy\u00a0transaction would generate another MetaMask popup that requires transaction confirmation. Simply confirm the transaction!<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/c-1024x523.png\" alt=\"\" width=\"1024\" height=\"523\" \/><\/p>\n<p>Congratulations!\u00a0You have successfully deployed the\u00a0HelloWorld\u00a0Smart Contract to the\u00a0SECRYPT Testnet** You can start interacting with your Smart Contract. Check the deployment status at\u00a0https:\/\/explorer-testnet.secrypt.tech<\/p>\n<h4><strong>Verifying your Contract<\/strong><\/h4>\n<h4>\u00a0<\/h4>\n<h5><strong>Flatten your Smart Contract<\/strong><\/h5>\n<p>The first and foremost step is to flatten the solidity smart contract into a single file. In order to do that, install\u00a0truffle-flattener\u00a0or\u00a0sol-merger.<\/p>\n<p>After installation, flatten the contract using below command (we have demonstrated using sol-merger).<\/p>\n<p>sol-merger &#8220;.\/contracts<em>\/*.sol&#8221; .\/build<\/em><\/p>\n<h5><strong>Verifying on SECRYPT scan<\/strong><\/h5>\n<ul>\n<li>Navigate to your contract&#8217;s SECRYPT scan page and click on\u00a0Verify and Publish.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/test.secrypt.tech\/wp-content\/uploads\/2023\/01\/d-1024x618.png\" alt=\"\" width=\"1024\" height=\"618\" \/><\/p>\n<ul>\n<li>Select\u00a0Solidity (Single File)\u00a0in compiler type<\/li>\n<li>Select appropriate compiler version<\/li>\n<li>Choose the license type of your contract<\/li>\n<\/ul>\n<p>In the next section, paste your flattened samrt contract here. If you had enabled optimization, then adjust the\u00a0optimization\u00a0section accordingly.<\/p>\n<p>Constructor arguments should have been filled in automatically. If not, they can be retrieved from the trailing bytes of the deployment transaction (example:\u00a0000000000000000000000000a6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Deploy a Smart Contract Using Remix Overview This tutorial guides you to implement a\u00a0Hello World\u00a0dApp which echoes a message passed to the contract on to the frontend. You will also be able to change the message using the interactive panel. RECOMMENDED We recommend you to follow this tutorial using the online IDE available at\u00a0Remix IDE. [&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-935","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/pages\/935","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=935"}],"version-history":[{"count":14,"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/pages\/935\/revisions"}],"predecessor-version":[{"id":1411,"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/pages\/935\/revisions\/1411"}],"wp:attachment":[{"href":"https:\/\/test.secrypt.tech\/index.php\/wp-json\/wp\/v2\/media?parent=935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}