<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by aditya.rola on Medium]]></title>
        <description><![CDATA[Stories by aditya.rola on Medium]]></description>
        <link>https://medium.com/@aditya.rola?source=rss-b88614a15fff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y541NM7Wb5Tar4AldoglbQ.jpeg</url>
            <title>Stories by aditya.rola on Medium</title>
            <link>https://medium.com/@aditya.rola?source=rss-b88614a15fff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 00:47:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aditya.rola/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to setup your own self sovereign app chain zk roll up using polygon zkEVM and connect with…]]></title>
            <link>https://medium.com/coinmonks/how-to-setup-your-own-self-sovereign-app-chain-zk-roll-up-using-polygon-zkevm-and-connect-with-f50b13231123?source=rss-b88614a15fff------2</link>
            <guid isPermaLink="false">https://medium.com/p/f50b13231123</guid>
            <category><![CDATA[polygon]]></category>
            <category><![CDATA[metamask]]></category>
            <category><![CDATA[zkp]]></category>
            <category><![CDATA[zkrollup]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[aditya.rola]]></dc:creator>
            <pubDate>Tue, 01 Aug 2023 00:41:16 GMT</pubDate>
            <atom:updated>2023-08-10T09:47:50.435Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to setup your own self sovereign app chain zk roll up using polygon zkEVM and connect with Metamask</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OWm57OftO7n1kthxylPpXw.png" /></figure><p>In this article, we will delve into:</p><ul><li>Understanding zk-Rollups.</li><li>Exploring Polygon zkEVM.</li><li>Unveiling the modules underpinning Polygon zkEVM.</li><li>A step-by-step guide to setting up your zk-Rollup using Polygon zkEVM.</li></ul><h3>What are zk Roll ups?</h3><p>zk-Rollups are Layer 2 scaling solutions that utilize zero-knowledge proofs to validate transactions off-chain. By doing this, they offer a leap in scalability. Compared to on-chain Ethereum transactions, zk-Rollups can execute these much more rapidly and cost-effectively.</p><p>Here’s a simple breakdown of how zk-Rollups function:</p><ol><li>Transactions are aggregated and managed off-chain.</li><li>A zero-knowledge proof is crafted, vouching for the genuineness of these clustered transactions.</li><li>This zero-knowledge proof is then relayed to the Ethereum mainchain.</li><li>Following this, the Ethereum mainchain inspects the proof and amends its state based on the validation.</li></ol><p>By leveraging zero-knowledge proofs, zk-Rollups don’t just enhance scalability but do so without forfeiting security or privacy. This positions them as a viable avenue for amplifying the capacity of Ethereum and other blockchain networks.</p><p>Let’s glance at some core advantages of zk-Rollups:</p><ul><li>Scalability: They can handle transactions with speed and affordability, outpacing on-chain Ethereum.</li><li>Security: Equally as robust as Ethereum, their reliability stems from the foundational security of the Ethereum mainchain.</li><li>Privacy: zk-Rollups uphold the confidentiality of transactions since transaction specifics remain undisclosed on the Ethereum mainchain.</li></ul><p>In summation, zk-Rollups are not just promising but pivotal for the scalability prospects of Ethereum and other blockchain systems. As the technology underpinning zk-Rollups matures, it’s poised to be integral to the blockchain landscape’s evolution.</p><h3>What is polygon zkEVM?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-ca4irzkkcRvKO4nblBZg.png" /><figcaption>Credit : <a href="https://polygon.technology/polygon-zkevm">https://polygon.technology/polygon-zkevm</a></figcaption></figure><p>Polygon zkEVM stands as a decentralized Ethereum Layer 2 scalability solution. By harnessing the power of cryptographic zero-knowledge proofs, it guarantees authenticity and swift completion for off-chain transaction computations, a feature often referred to as ZK-Rollup.</p><p>The essence of ZK-Rollup lies in its ability to transparently run smart contracts. This is achieved by presenting zero-knowledge validity proofs, all while ensuring opcode compatibility with the Ethereum Virtual Machine (EVM).</p><p>Advantages of Polygon zkEVM:</p><ul><li><strong>EVM-equivalence</strong>: Ensures seamless integration and interaction with existing Ethereum-based systems.</li><li><strong>Ethereum Security</strong>: Inherits the robust security framework of Ethereum, ensuring that transactions and contracts remain tamper-proof.</li><li><strong>ZKP-driven Scalability</strong>: By leveraging Zero-Knowledge Proofs (ZKP), it offers enhanced transaction processing speeds and scalability potential.</li></ul><h3>What are the modules used polygon zkEVM?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*34JXQ4vPy4lrP7y-j5Nn_g.png" /><figcaption>Credit : <a href="https://zkevm.polygon.technology/docs/architecture">https://zkevm.polygon.technology/docs/architecture</a></figcaption></figure><p>Polygon zkEVM is adept at managing state transitions stemming from Ethereum Layer 2 transaction activities — those transactions dispatched by users to the network. It further crafts validity proofs to vouch for the authenticity of these off-chain state adjustments, capitalizing on the distinct traits of zero-knowledge technology.</p><p>Key components of zkEVM are:</p><ul><li>Consensus Contract (PolygonZkEVM.sol): The most recent iteration of the zkEVM Consensus Contract, situated on Layer 1, draws inspiration from the Proof of Efficiency model. Incorporating insights from the pre-existing PoD in its v1.0, this contract introduces an enhanced framework that allows an unrestricted entry of multiple coordinators to formulate batches on L2.</li><li>zkNode: This represents the essential software to operate a zkEVM node. Acting as a client, the zkNode aids the network in implementing synchronization and designating roles to its participants, be it Sequencers or Aggregators.</li><li>zkProver: At the heart of zkEVM’s prowess is the advanced zero-knowledge mechanism that crafts validity proofs. The system calls upon a dedicated zero-knowledge prover, aptly termed zkProver, engineered to operate on diverse servers and aimed to be versatile enough for compatibility with a vast array of consumer hardware. Every Aggregator taps into this zkProver to authenticate batches and furnish Validity Proofs.</li><li>zkEVM Bridge: Serving as a pivotal conduit, the zkEVM bridge is a smart contract designed to facilitate users in shuttling their assets between layers, denoted as LX and LY. In the zkEVM framework, the L1-L2 bridge emerges as a decentralized avenue, ensuring secure and seamless asset deposits and withdrawals. This bridge is a fusion of two smart contracts, each deployed on their respective chains.</li></ul><h3>Setting Up Your Own zk-Rollup Using Polygon zkEVM</h3><p>Now that we’ve demystified the architecture and the modules powering Polygon zkEVM, let’s embark on a journey to establish your zk-Rollup using Polygon zkEVM. This guide is tailored for a Linux machine operating on Ubuntu. But before we dive into the detailed steps, let’s equip ourselves with the essentials:</p><ol><li>Go &gt;=1.18 (Recommended) on your local machine<br>sudo snap install go --channel=1.19/stable --classic</li><li>Node v16.x<br>1. sudo apt install curl <br>2. curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash<br>3. source ~/.bashrc<br>4. nvm install 16.20.1</li><li><a href="https://docs.docker.com/engine/install/ubuntu/">Docker Engine</a></li><li><a href="https://docs.docker.com/compose/install/">Docker Compose</a></li><li><a href="https://github.com/0xPolygonHermez/zkevm-contracts/releases/tag/v1.1.0-fork.4">Polygon zkEVM Smart Contracts</a></li><li><a href="https://github.com/0xPolygonHermez/zkevm-node/releases/download/v0.1.4/testnet.zip">Polygon zkEVM Node Config</a></li></ol><p>With the prerequisites in place, you’re poised to deploy the Polygon zkEVM smart contracts. For testing, we’ll utilize a local geth instance as our root chain of choice.</p><h3>Deploy zkEVM Smart Contracts</h3><p>In your terminal paste this commands</p><pre>sudo apt install unzip<br><br>unzip zkevm-contracts-1.1.0-fork.4</pre><p>This should extract the content of polygon-zkEVM smart contract into current directory</p><pre>cd zkevm-contracts-1.1.0-fork.4 &amp;&amp; npm install </pre><p>This will install all the node packages required to deploy polygon-zkEVM smart contract</p><blockquote>Note : In case you are using docker compose version 2.0.0 or above go to scripts directory inside docker directory and modify deploy-docker.sh file to the below content</blockquote><pre>#!/bin/bash<br>sudo rm -rf docker/gethData/geth_data<br>DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml up -d geth<br>sleep 5<br>node docker/scripts/fund-accounts.js<br>cp docker/scripts/deploy_parameters_docker.json deployment/deploy_parameters.json<br>cp docker/scripts/genesis_docker.json deployment/genesis.json<br>npx hardhat run deployment/testnet/prepareTestnet.js --network localhost<br>npx hardhat run deployment/2_deployPolygonZKEVMDeployer.js --network localhost<br>npx hardhat run deployment/3_deployContracts.js --network localhost<br>mkdir docker/deploymentOutput<br>mv deployment/deploy_output.json docker/deploymentOutput<br>docker compose -f docker/docker-compose.geth.yml down<br>sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth .<br># Let it readable for the multiplatform build coming later!<br>sudo chmod -R go+rxw docker/gethData</pre><p>To deploy the contracts go to the root directory of zkEVM Contracts and run the following command in your terminal</p><pre>npm run docker:contracts</pre><p>To facilitate this, we’ll utilize the deploy-docker.sh script located within the script subdirectory of the docker directory. This script will:</p><ul><li>Initiate a local geth instance.</li><li>Deploy the zkEVM smart contracts.</li><li>Store the results in the deploymentOutput directory, also situated within the docker directory.</li></ul><p>The results will be saved in a file named deploy_output.json. This file catalogues the details of the deployed smart contracts, including their respective addresses.</p><pre>{<br> &quot;polygonZkEVMAddress&quot;: &quot;0x610178dA211FEF7D417bC0e6FeD39F05609AD788&quot;,<br> &quot;polygonZkEVMBridgeAddress&quot;: &quot;0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0&quot;,<br> &quot;polygonZkEVMGlobalExitRootAddress&quot;: &quot;0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6&quot;,<br> &quot;maticTokenAddress&quot;: &quot;0x5FbDB2315678afecb367f032d93F642f64180aa3&quot;,<br> &quot;verifierAddress&quot;: &quot;0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9&quot;,<br> &quot;zkEVMDeployerContract&quot;: &quot;0x4b2700570f8426A24EA85e0324611E527BdD55B8&quot;,<br> &quot;deployerAddress&quot;: &quot;0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266&quot;,<br> &quot;timelockContractAddress&quot;: &quot;0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0&quot;,<br> &quot;deploymentBlockNumber&quot;: 70,<br> &quot;genesisRoot&quot;: &quot;0x634e9b1b6903eae47735b0d811d8a80c0e37f4f29263f9b5e83dedd90a50d375&quot;,<br> &quot;trustedSequencer&quot;: &quot;0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266&quot;,<br> &quot;trustedSequencerURL&quot;: &quot;http://zkevm-json-rpc:8123&quot;,<br> &quot;chainID&quot;: 1001,<br> &quot;networkName&quot;: &quot;zkevm&quot;,<br> &quot;admin&quot;: &quot;0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266&quot;,<br> &quot;trustedAggregator&quot;: &quot;0x70997970C51812dc3A010C7d01b50e0d17dc79C8&quot;,<br> &quot;proxyAdminAddress&quot;: &quot;0xf065BaE7C019ff5627E09ed48D4EeA317D211956&quot;,<br> &quot;forkID&quot;: 4,<br> &quot;salt&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br> &quot;version&quot;: &quot;0.0.1&quot;<br>}</pre><p>This will also create an docker image with the name hermeznetwork/geth-zkevm-contracts</p><p>you can verify this by typing the following command in your terminal</p><pre>docker images</pre><p>the output should be as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HJoMT4wa6uFC8dzrdyzgJw.png" /></figure><p>Next we will setup the zkEVM node using the node config we downloaded earlier.</p><h3>SETUP zkEVM node and bridge</h3><h4><strong>1. Setup required directory</strong></h4><p>In your terminal paste this commands</p><pre>echo &#39;<br>export ZKEVM_NET=testnet<br>export ZKEVM_DIR=~/zkevm/zkevm-node<br>export ZKEVM_CONFIG_DIR=~/zkevm/zkevm-config<br><br>[ -d &quot;/usr/local/go/bin&quot; ] &amp;&amp; PATH=&quot;/usr/local/go/bin:$PATH&quot;<br>&#39; &gt;&gt; ~/.profile<br>source ~/.profile &amp;&amp; mkdir -p ~/zkevm/data/{statedb,pooldb,eventdb} ~/zkevm/zkevm-config ~/zkevm/zkevm-node</pre><p>The above command will create the directories required for storing the node config and postgres database persisted storage volumes.</p><h4>2. <strong>Unzip the config file into the zkevm directory</strong></h4><p>In your terminal paste the following command</p><pre>unzip testnet.zip -d ./zkevm/zkevm-node/ &amp;&amp; cp $ZKEVM_DIR/$ZKEVM_NET/example.env $ZKEVM_CONFIG_DIR/.env</pre><p>The above command will unzip the testnet configuration into zkevm-node directory and copy the env.example file inside the just populated zkevm-node directory to zkevm-config directory.</p><p>Next edit the .env file in zkevm-config directory to the following values</p><pre>ZKEVM_NODE_ETHERMAN_URL = &quot;http://zkevm-mock-l1-network:8545&quot;     # set a valid root chain RPC node<br>ZKEVM_NODE_STATEDB_DATA_DIR = &quot;~/zkevm/data/statedb&quot; # persistent volume path to store state db data<br>ZKEVM_NODE_POOLDB_DATA_DIR = &quot;~/zkevm/data/pooldb&quot; # persistent volume path to store pool db data<br>ZKEVM_NODE_EVENTDB_DATA_DIR = &quot;~/zkevm/data/eventdb&quot; # persistent volume path to store event db data</pre><h4>3. <strong>Download the Aggregator and Sequencer keystore file</strong></h4><p>go to the zkevm-config directory and in your terminal paste the following command</p><pre>wget https://raw.githubusercontent.com/0xPolygonHermez/zkevm-node/hotfix/v0.1.X/test/aggregator.keystore &amp;&amp; wget https://raw.githubusercontent.com/0xPolygonHermez/zkevm-node/hotfix/v0.1.X/test/sequencer.keystore</pre><p>The above command downloads the account keystore file of sequencer and aggregator</p><blockquote>Note : In test setup the account used to deploy the contracts i.e the zkEVM owner and the sequencer are same account.</blockquote><h4>4.<strong> Edit the node config files</strong></h4><p>Now we will edit the configuration files required to run the zkEVM node.</p><p>Go to ~/zkevm/zkevm-node/testnet/config/environments/public directory</p><p>(i) <strong>public.node.config.toml</strong></p><p>Make the following changes in the file (changes are marked by change number in green or you can copy and replace the content of config file from <a href="https://github.com/0xPolygonHermez/zkevm-node/blob/hotfix/v0.1.X/test/config/test.node.config.toml"><strong>this link</strong></a>)</p><pre>[Log]<br>Environment = &quot;development&quot; <br>Level = &quot;debug&quot; # change 1 &quot;info to debug&quot;<br><br>[Pool]<br>FreeClaimGasLimit = 1500000 #change 2 &quot;variable added&quot;<br><br>[Etherman]<br>URL = &quot;http://zkevm-mock-l1-network:8545&quot; #change 3 &quot;url changed&quot;<br><br>[RPC]<br>Host = &quot;0.0.0.0&quot;<br>Port = 8123 #change 3 &quot;port change&quot;<br>ReadTimeout = &quot;60s&quot;<br>WriteTimeout = &quot;60s&quot;<br>MaxRequestsPerIPAndSecond = 5000<br>SequencerNodeURI = &quot;&quot; #change 4 &quot;url changed&quot;<br>EnableL2SuggestedGasPricePolling = true<br> [RPC.WebSockets]<br>  Enabled = true<br>  Port = 8133 #change 5 &quot;port change&quot;<br><br>[Sequencer] #change 6 &quot;config block added&quot;<br>WaitPeriodPoolIsEmpty = &quot;1s&quot;<br>LastBatchVirtualizationTimeMaxWaitPeriod = &quot;10s&quot;<br>BlocksAmountForTxsToBeDeleted = 100<br>FrequencyToCheckTxsForDelete = &quot;12h&quot;<br>MaxTxsPerBatch = 150<br>MaxBatchBytesSize = 129848<br>MaxCumulativeGasUsed = 30000000<br>MaxKeccakHashes = 468<br>MaxPoseidonHashes = 279620<br>MaxPoseidonPaddings = 149796<br>MaxMemAligns = 262144<br>MaxArithmetics = 262144<br>MaxBinaries = 262144<br>MaxSteps = 8388608<br>WeightBatchBytesSize = 1<br>WeightCumulativeGasUsed = 1<br>WeightKeccakHashes = 1<br>WeightPoseidonHashes = 1<br>WeightPoseidonPaddings = 1<br>WeightMemAligns = 1<br>WeightArithmetics = 1<br>WeightBinaries = 1<br>WeightSteps = 1<br>TxLifetimeCheckTimeout = &quot;10m&quot;<br>MaxTxLifetime = &quot;3h&quot;<br> [Sequencer.Finalizer]<br>  GERDeadlineTimeout = &quot;2s&quot;<br>  ForcedBatchDeadlineTimeout = &quot;5s&quot;<br>  SleepDuration = &quot;100ms&quot;<br>  ResourcePercentageToCloseBatch = 10<br>  GERFinalityNumberOfBlocks = 0<br>  ClosingSignalsManagerWaitForCheckingL1Timeout = &quot;10s&quot;<br>  ClosingSignalsManagerWaitForCheckingGER = &quot;10s&quot;<br>  ClosingSignalsManagerWaitForCheckingForcedBatches = &quot;10s&quot;<br>  ForcedBatchesFinalityNumberOfBlocks = 0<br>  TimestampResolution = &quot;10s&quot;<br> [Sequencer.DBManager]<br>  PoolRetrievalInterval = &quot;500ms&quot;<br>  L2ReorgRetrievalInterval = &quot;5s&quot;<br> [Sequencer.Worker]<br>  ResourceCostMultiplier = 1000<br><br>[SequenceSender] #change 7 &quot;config block added&quot;<br>WaitPeriodSendSequence = &quot;15s&quot;<br>LastBatchVirtualizationTimeMaxWaitPeriod = &quot;10s&quot;<br>MaxTxSizeForL1 = 131072<br>SenderAddress = &quot;0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266&quot;<br>PrivateKeys = [{Path = &quot;/pk/sequencer.keystore&quot;, Password = &quot;testonly&quot;}]<br><br>[Aggregator] #change 8 &quot;config block added&quot;<br>Host = &quot;0.0.0.0&quot;<br>Port = 50081<br>ForkId = 2<br>RetryTime = &quot;5s&quot;<br>VerifyProofInterval = &quot;10s&quot;<br>TxProfitabilityCheckerType = &quot;acceptall&quot;<br>TxProfitabilityMinReward = &quot;1.1&quot;<br>ProofStatePollingInterval = &quot;5s&quot;<br>SenderAddress = &quot;0x70997970c51812dc3a010c7d01b50e0d17dc79c8&quot;<br>CleanupLockedProofsInterval = &quot;2m&quot;<br>GeneratingProofCleanupThreshold = &quot;10m&quot;<br><br>[EthTxManager] #change 9 &quot;config block added&quot;<br>ForcedGas = 0<br>PrivateKeys = [<br> {Path = &quot;/pk/sequencer.keystore&quot;, Password = &quot;testonly&quot;},<br> {Path = &quot;/pk/aggregator.keystore&quot;, Password = &quot;testonly&quot;}<br>]<br><br>[L2GasPriceSuggester] #change 10 &quot;config block added&quot;<br>Type = &quot;follower&quot;<br>UpdatePeriod = &quot;10s&quot;<br>Factor = 0.5<br>DefaultGasPriceWei = 1000000000<br><br>[Metrics]<br>ProfilingEnabled = true #change 11 &quot;config block added&quot;<br><br>[EventLog] #change 12 &quot;config block added&quot;<br> [EventLog.DB]<br> User = &quot;event_user&quot;<br> Password = &quot;event_password&quot;<br> Name = &quot;event_db&quot;<br> Host = &quot;zkevm-event-db&quot;<br> Port = &quot;5432&quot;<br> EnableLog = false<br> MaxConns = 200<br><br></pre><p><strong>(ii) public.genesis.config.json</strong></p><p>For this step create a new file with the name <strong>public.genesis.config.json </strong>the content for the same can be downloaded from <a href="https://github.com/0xPolygonHermez/zkevm-node/blob/hotfix/v0.1.X/test/config/test.genesis.config.json"><strong>this link</strong></a><strong>.</strong></p><p>Also make the following changes in the file</p><pre>&quot;l1Config&quot; : {<br>  &quot;chainId&quot;: 1337, ## Chain Id of the root chain<br>  &quot;polygonZkEVMAddress&quot;: &quot;0x610178dA211FEF7D417bC0e6FeD39F05609AD788&quot;,<br>  &quot;maticTokenAddress&quot;: &quot;0x5FbDB2315678afecb367f032d93F642f64180aa3&quot;,<br>  &quot;polygonZkEVMGlobalExitRootAddress&quot;: &quot;0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6&quot;<br> },<br>  &quot;root&quot;: &quot;0xd88680f1b151dd67518f9aca85161424c0cac61df2f5424a3ddc04ea25adecc7&quot;,<br>  &quot;genesisBlockNumber&quot;: 65, ##should match the deploymentBlockNumber in deploy_output.json<br>  &quot;genesis&quot; : {...}</pre><p><strong>(iii) config.local.toml</strong></p><p>For this step create a new file with the name <strong>config.local.toml </strong>the content for the same can be downloaded from <a href="https://github.com/0xPolygonHermez/zkevm-bridge-service/blob/develop/config/config.local.toml"><strong>this link</strong></a><strong>.</strong></p><p>This file is the configuration file for the zkevm-bridge service.</p><p>Also make the following changes in the file</p><pre>[Etherman]<br>L2URLs = [&quot;http://zkevm-json-rpc:8123&quot;]<br><br>[NetworkConfig]<br>GenBlockNumber = 1 ##should match the deploymentBlockNumber in deploy_output.json<br>PolygonBridgeAddress = &quot;0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0&quot;<br>PolygonZkEVMGlobalExitRootAddress = &quot;0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6&quot;<br>MaticTokenAddress = &quot;0x5FbDB2315678afecb367f032d93F642f64180aa3&quot;<br>L2PolygonBridgeAddresses = [&quot;0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0&quot;]<br>L1ChainID = 1337</pre><p><strong>(iv) public.prover.config.json</strong></p><p>For this step edit the file in case you want to <strong>run a mock prover</strong> with the content of from <a href="https://github.com/0xPolygonHermez/zkevm-node/blob/hotfix/v0.1.X/test/config/test.prover.config.json"><strong>this link</strong></a><strong> </strong>or<strong> </strong>you let it stay as is in case you want to run a full zkProver.</p><p><strong>(v) config.json (Optional in case of full zkProver Only)</strong></p><p>For this step create a new file with the name <strong>config.json </strong>and copy the following content<strong>.</strong></p><pre>{<br>  &quot;runExecutorServer&quot;: false,<br>  &quot;runExecutorClient&quot;: false,<br>  &quot;runExecutorClientMultithread&quot;: false,<br><br>  &quot;runStateDBServer&quot;: false,<br>  &quot;runStateDBTest&quot;: false,<br><br>  &quot;runAggregatorServer&quot;: false,<br>  &quot;runAggregatorClient&quot;: true,<br>  &quot;proverName&quot;: &quot;static_prover&quot;,<br><br>  &quot;runFileGenBatchProof&quot;: false,<br>  &quot;runFileGenAggregatedProof&quot;: false,<br>  &quot;runFileGenFinalProof&quot;: false,<br>  &quot;runFileProcessBatch&quot;: false,<br>  &quot;runFileProcessBatchMultithread&quot;: false,<br>  &quot;runFileExecutor&quot;: false,<br><br>  &quot;runKeccakScriptGenerator&quot;: false,<br>  &quot;runKeccakTest&quot;: false,<br>  &quot;runStorageSMTest&quot;: false,<br>  &quot;runBinarySMTest&quot;: false,<br>  &quot;runMemAlignSMTest&quot;: false,<br>  &quot;runSHA256Test&quot;: false,<br>  &quot;runBlakeTest&quot;: false,<br>  &quot;executeInParallel&quot;: true,<br>  &quot;useMainExecGenerated&quot;: true,<br>  &quot;useProcessBatchCache&quot;: true,<br>  &quot;saveRequestToFile&quot;: false,<br>  &quot;saveInputToFile&quot;: true,<br>  &quot;saveDbReadsToFile&quot;: true,<br>  &quot;saveDbReadsToFileOnChange&quot;: false,<br>  &quot;saveOutputToFile&quot;: true,<br>  &quot;saveFilesInSubfolders&quot;: false,<br>  &quot;saveProofToFile&quot;: true,<br>  &quot;saveResponseToFile&quot;: false,<br>  &quot;loadDBToMemCache&quot;: true,<br>  &quot;loadDBToMemCacheInParallel&quot;: false,<br>  &quot;dbMTCacheSize&quot;: 16384,<br>  &quot;dbProgramCacheSize&quot;: 16384,<br>  &quot;dbMultiWrite&quot;: true,<br>  &quot;dbFlushInParallel&quot;: true,<br><br>  &quot;opcodeTracer&quot;: false,<br>  &quot;logRemoteDbReads&quot;: false,<br>  &quot;logExecutorServerResponses&quot;: false,<br><br>  &quot;executorServerPort&quot;: 50071,<br>  &quot;executorROMLineTraces&quot;: false,<br>  &quot;executorClientPort&quot;: 50071,<br>  &quot;executorClientHost&quot;: &quot;127.0.0.1&quot;,<br><br>  &quot;stateDBServerPort&quot;: 5432,<br>  &quot;stateDBURL&quot;: &quot;local&quot;,<br><br>  &quot;aggregatorServerPort&quot;: 50081,<br>  &quot;aggregatorClientPort&quot;: 50081,<br>  &quot;aggregatorClientHost&quot;: &quot;zkevm-aggregator&quot;,<br>  &quot;aggregatorClientMockTimeout&quot;: 10000000,<br><br>  &quot;mapConstPolsFile&quot;: false,<br>  &quot;mapConstantsTreeFile&quot;: false,<br><br>  &quot;inputFile&quot;: &quot;testvectors/aggregatedProof/recursive1.zkin.proof_0.json&quot;,<br>  &quot;inputFile2&quot;: &quot;testvectors/aggregatedProof/recursive1.zkin.proof_1.json&quot;,<br><br>  &quot;outputPath&quot;: &quot;/output/&quot;,<br>  &quot;configPath&quot;: &quot;/mnt/prover/config/&quot;,<br><br>  &quot;zkevmCmPols_disabled&quot;: &quot;/mnt/prover/runtime/zkevm.commit&quot;,<br>  &quot;c12aCmPols&quot;: &quot;runtime/c12a.commit&quot;,<br>  &quot;recursive1CmPols_disabled&quot;: &quot;runtime/recursive1.commit&quot;,<br>  &quot;recursive2CmPols_disabled&quot;: &quot;runtime/recursive2.commit&quot;,<br>  &quot;recursivefCmPols_disabled&quot;: &quot;runtime/recursivef.commit&quot;,<br>  &quot;finalCmPols_disabled&quot;: &quot;runtime/final.commit&quot;,<br><br>  &quot;publicsOutput&quot;: &quot;public.json&quot;,<br>  &quot;proofFile&quot;: &quot;proof.json&quot;,<br><br>  &quot;databaseURL&quot;: &quot;postgresql://prover_user:prover_pass@zkevm-state-db:5432/prover_db&quot;,<br>  &quot;databaseURL_disabled&quot;: &quot;local&quot;,<br>  &quot;dbNodesTableName&quot;: &quot;state.nodes&quot;,<br>  &quot;dbProgramTableName&quot;: &quot;state.program&quot;,<br>  &quot;dbConnectionsPool&quot;: true,<br>  &quot;cleanerPollingPeriod&quot;: 600,<br>  &quot;requestsPersistence&quot;: 3600,<br>  &quot;maxExecutorThreads&quot;: 20,<br>  &quot;maxProverThreads&quot;: 8,<br>  &quot;maxStateDBThreads&quot;: 8<br>}</pre><p>Also additional configuration needs to be downloaded for full zkProver which can be done using the following command.</p><pre>cd ~/zkevm/zkevm-node/testnet/config/environments/public<br><br>wget https://de012a78750e59b808d922b39535e862.s3.eu-west-1.amazonaws.com/v1.1.0-rc.1-fork.4.tgz<br><br>tar xzvf v1.1.0-rc.1-fork.4.tgz</pre><h4>5. Edit the db init files</h4><p>For the following step the script file can be found in the following directory: <strong>~/zkevm/zkevm-node/testnet/db</strong></p><p><strong>(i) init_event_db.sql</strong></p><p>For this step create a new file with the name <strong>init_event_db.sql</strong> in and copy the following content<strong>.</strong></p><pre>CREATE TYPE level_t AS ENUM (&#39;emerg&#39;, &#39;alert&#39;, &#39;crit&#39;, &#39;err&#39;, &#39;warning&#39;, &#39;notice&#39;, &#39;info&#39;, &#39;debug&#39;);<br><br>CREATE TABLE public.event (<br>   id BIGSERIAL PRIMARY KEY,<br>   received_at timestamp WITH TIME ZONE default CURRENT_TIMESTAMP,<br>   ip_address inet,<br>   source varchar(32) not null,<br>   component varchar(32),<br>   level level_t not null,<br>   event_id varchar(32) not null,<br>   description text,<br>   data bytea,<br>   json jsonb<br>);</pre><p><strong>(ii) init_prover_db.sql (Optional in case of full zkProver)</strong></p><p>For this step edit the <strong>init_prover_db.sql</strong> file and copy the following content<strong>.</strong></p><pre>CREATE DATABASE prover_db;<br>\connect prover_db;<br><br>CREATE SCHEMA state;<br><br>CREATE TABLE state.nodes (hash BYTEA PRIMARY KEY, data BYTEA NOT NULL);<br>CREATE TABLE state.program (hash BYTEA PRIMARY KEY, data BYTEA NOT NULL);<br><br>CREATE USER prover_user with password &#39;prover_pass&#39;;<br>GRANT CONNECT ON DATABASE prover_db TO prover_user;<br>ALTER USER prover_user SET SEARCH_PATH=state;<br>GRANT ALL PRIVILEGES ON SCHEMA state TO prover_user;<br>GRANT ALL PRIVILEGES ON TABLE state.nodes TO prover_user;<br>GRANT ALL PRIVILEGES ON TABLE state.program TO prover_user;</pre><h4>6. Edit the docker-compose file</h4><p>For the following step the script file can be found in the following directory: <strong>~/zkevm/zkevm-node/testnet</strong></p><p>Edit the docker-compose.yml file and paste the following content</p><pre>version: &quot;3.5&quot;<br>networks:<br>  default:<br>    name: zkevm<br>    <br>services:<br>  zkevm-sequencer:<br>    container_name: zkevm-sequencer<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    depends_on:<br>      zkevm-pool-db:<br>        condition: service_healthy<br>      zkevm-state-db:<br>        condition: service_healthy<br>      zkevm-prover:<br>        condition: service_started<br>    ports:<br>      - 9092:9091 # needed if metrics enabled<br>      - 6060:6060<br>    environment:<br>      - ZKEVM_NODE_STATEDB_HOST=zkevm-state-db<br>      - ZKEVM_NODE_POOL_DB_HOST=zkevm-pool-db<br>    volumes:<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components sequencer&quot;<br><br>  zkevm-sequence-sender:<br>    container_name: zkevm-sequence-sender<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    depends_on:<br>      zkevm-pool-db:<br>        condition: service_healthy<br>      zkevm-state-db:<br>        condition: service_healthy<br>      zkevm-prover:<br>        condition: service_started<br>    environment:<br>      - ZKEVM_NODE_STATEDB_HOST=zkevm-state-db<br>      - ZKEVM_NODE_POOL_DB_HOST=zkevm-pool-db<br>      - ZKEVM_NODE_SEQUENCER_SENDER_ADDRESS=0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266<br>    volumes:<br>      - ${ZKEVM_CONFIG_DIR}/sequencer.keystore:/pk/sequencer.keystore<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components sequence-sender&quot;<br><br>  zkevm-json-rpc:<br>    container_name: zkevm-json-rpc<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    depends_on:<br>      zkevm-pool-db:<br>        condition: service_healthy<br>      zkevm-state-db:<br>        condition: service_healthy<br>      zkevm-sync:<br>        condition: service_started<br>    ports:<br>      - 8123:8123<br>      - 8133:8133 # needed if WebSockets enabled<br>      - 9091:9091 # needed if metrics enabled<br>    environment:<br>      - ZKEVM_NODE_STATEDB_HOST=zkevm-state-db<br>      - ZKEVM_NODE_POOL_DB_HOST=zkevm-pool-db<br>      - ZKEVM_NODE_ETHERMAN_URL=http://zkevm-mock-l1-network:8545<br>    volumes:<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components rpc&quot;<br><br>  zkevm-aggregator:<br>    container_name: zkevm-aggregator<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    depends_on:<br>      zkevm-pool-db:<br>        condition: service_healthy<br>      zkevm-state-db:<br>        condition: service_healthy<br>    ports:<br>      - 50081:50081<br>      - 9093:9091 # needed if metrics enabled<br>    environment:<br>      - ZKEVM_NODE_STATEDB_HOST=zkevm-state-db<br>      - ZKEVM_NODE_AGGREGATOR_SENDER_ADDRESS=0x70997970c51812dc3a010c7d01b50e0d17dc79c8<br>    volumes:<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components aggregator&quot;<br><br>  zkevm-sync:<br>    container_name: zkevm-sync<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    depends_on:<br>      zkevm-state-db:<br>        condition: service_healthy<br>      zkevm-prover:<br>        condition: service_started<br>    ports:<br>      - 9095:9091 # needed if metrics enabled<br>    environment:<br>      - ZKEVM_NODE_STATEDB_HOST=zkevm-state-db<br>      - ZKEVM_NODE_ETHERMAN_URL=http://zkevm-mock-l1-network:8545<br>    volumes:<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components synchronizer&quot;<br><br>  zkevm-eth-tx-manager:<br>    container_name: zkevm-eth-tx-manager<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    depends_on:<br>      zkevm-state-db:<br>          condition: service_healthy<br>    ports:<br>      - 9094:9091 # needed if metrics enabled<br>    environment:<br>      - ZKEVM_NODE_STATEDB_HOST=zkevm-state-db<br>    volumes:<br>      - ${ZKEVM_CONFIG_DIR}/sequencer.keystore:/pk/sequencer.keystore<br>      - ${ZKEVM_CONFIG_DIR}/aggregator.keystore:/pk/aggregator.keystore<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components eth-tx-manager&quot;<br><br>  zkevm-l2gaspricer:<br>    container_name: zkevm-l2gaspricer<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    depends_on:<br>      zkevm-pool-db:<br>          condition: service_healthy<br>    environment:<br>      - ZKEVM_NODE_POOL_DB_HOST=zkevm-pool-db<br>    volumes:<br>      - ${ZKEVM_CONFIG_DIR}/sequencer.keystore:/pk/sequencer.keystore<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components l2gaspricer&quot;<br><br>  zkevm-state-db:<br>    container_name: zkevm-state-db<br>    image: postgres<br>    healthcheck:<br>      test: [ &quot;CMD-SHELL&quot;, &quot;pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}&quot; ]<br>    deploy:<br>      resources:<br>        limits:<br>          memory: 2G<br>        reservations:<br>          memory: 1G<br>    ports:<br>      - 5432:5432<br>    volumes:<br>      - ./db/scripts/init_prover_db.sql:/docker-entrypoint-initdb.d/init.sql<br>      - ${ZKEVM_NODE_STATEDB_DATA_DIR}:/var/lib/postgresql/data<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/postgresql.conf:/etc/postgresql.conf<br>    environment:<br>      - POSTGRES_USER=state_user<br>      - POSTGRES_PASSWORD=state_password<br>      - POSTGRES_DB=state_db<br>    command:<br>      - &quot;postgres&quot;<br>      - &quot;-N&quot;<br>      - &quot;500&quot;<br><br>  zkevm-pool-db:<br>    container_name: zkevm-pool-db<br>    image: postgres<br>    healthcheck:<br>      test: [ &quot;CMD-SHELL&quot;, &quot;pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}&quot; ]<br>    deploy:<br>      resources:<br>        limits:<br>          memory: 2G<br>        reservations:<br>          memory: 1G<br>    ports:<br>      - 5433:5432<br>    volumes:<br>      - ${ZKEVM_NODE_POOLDB_DATA_DIR}:/var/lib/postgresql/data<br>    environment:<br>      - POSTGRES_USER=pool_user<br>      - POSTGRES_PASSWORD=pool_password<br>      - POSTGRES_DB=pool_db<br>    command:<br>      - &quot;postgres&quot;<br>      - &quot;-N&quot;<br>      - &quot;500&quot;<br><br>  zkevm-event-db:<br>    container_name: zkevm-event-db<br>    image: postgres<br>    deploy:<br>      resources:<br>        limits:<br>          memory: 2G<br>        reservations:<br>          memory: 1G<br>    ports:<br>      - 5435:5432<br>    volumes:<br>      - ./db/scripts/init_event_db.sql:/docker-entrypoint-initdb.d/init.sql<br>      - ${ZKEVM_NODE_EVENTDB_DATA_DIR}:/var/lib/postgresql/data<br>    environment:<br>      - POSTGRES_USER=event_user<br>      - POSTGRES_PASSWORD=event_password<br>      - POSTGRES_DB=event_db<br>    command:<br>      - &quot;postgres&quot;<br>      - &quot;-N&quot;<br>      - &quot;500&quot;<br><br>  zkevm-explorer-l2:<br>    container_name: zkevm-explorer-l2<br>    image: hermeznetwork/zkevm-explorer:latest<br>    ports:<br>      - 4001:4000<br>    environment:<br>      - NETWORK=POE<br>      - SUBNETWORK=Capx Testnet<br>      - COIN=ETH<br>      - CHAIN_ID=1716<br>      - ETHEREUM_JSONRPC_VARIANT=geth<br>      - ETHEREUM_JSONRPC_HTTP_URL=http://zkevm-explorer-json-rpc:8124<br>      - DATABASE_URL=postgres://l2_explorer_user:l2_explorer_password@zkevm-explorer-l2-db:5432/l2_explorer_db<br>      - ECTO_USE_SSL=false<br>      - MIX_ENV=prod<br>      - SUPPORTED_CHAINS=[]<br>      - SHOW_OUTDATED_NETWORK_MODAL=false<br>      - LOGO=/images/blockscout_logo.svg<br>      - LOGO_FOOTER=/images/blockscout_logo.svg<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;mix do ecto.create, ecto.migrate; mix phx.server&quot;<br><br>  zkevm-explorer-json-rpc:<br>    container_name: zkevm-explorer-json-rpc<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    ports:<br>      - 8124:8124<br>      - 8134:8134 # needed if WebSockets enabled<br>    environment:<br>      - ZKEVM_NODE_STATEDB_HOST=zkevm-state-db<br>      - ZKEVM_NODE_POOL_DB_HOST=zkevm-pool-db<br>      - ZKEVM_NODE_RPC_PORT=8124<br>      - ZKEVM_NODE_RPC_WEBSOCKETS_PORT=8134<br>    volumes:<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components rpc --http.api eth,net,debug,zkevm,txpool,web3&quot;<br><br>  zkevm-explorer-l2-db:<br>    container_name: zkevm-explorer-l2-db<br>    image: postgres<br>    ports:<br>      - 5437:5432<br>    environment:<br>      - POSTGRES_USER=l2_explorer_user<br>      - POSTGRES_PASSWORD=l2_explorer_password<br>      - POSTGRES_DB=l2_explorer_db<br>    command: [ &quot;postgres&quot;, &quot;-N&quot;, &quot;500&quot; ]<br><br>  zkevm-prover:<br>    container_name: zkevm-prover<br>    image: hermeznetwork/zkevm-prover:v1.1.4-RC2-fork.4<br>    depends_on:<br>      zkevm-state-db:<br>        condition: service_healthy<br>    ports:<br>      - 50059:50052 # Mock Prover<br>      - 50061:50061 # MT<br>      - 50071:50071 # Executor<br>    volumes:<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.prover.config.json:/usr/src/app/config.json<br>    command: &gt;<br>      zkProver -c /usr/src/app/config.json<br><br>  zkevm-prover-server: # Optional In case of full zkProver only<br>    container_name: zkevm-prover-server<br>    image: hermeznetwork/zkevm-prover:v1.1.4-RC2-fork.4<br>    ports:<br>      - 50051:50051<br>    volumes:<br>     - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/v1.1.0-rc.1-fork.4/config:/mnt/prover/config:ro<br>     - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/config.json:/app/config.json<br>    command: &quot;zkProver -c /app/config.json&quot;<br><br>  zkevm-approve:<br>    container_name: zkevm-approve<br>    image: hermeznetwork/zkevm-node:v0.1.2-RC1<br>    environment:<br>      - ZKEVM_NODE_STATEDB_HOST=zkevm-state-db<br>    volumes:<br>      - ${ZKEVM_CONFIG_DIR}/sequencer.keystore:/pk/sequencer.keystore<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.node.config.toml:/app/config.toml<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/public.genesis.config.json:/app/genesis.json<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-node approve --network custom --custom-network-file /app/genesis.json --key-store-path /pk/keystore --pw password --am 115792089237316195423570985008687907853269984665640564039457584007913129639935 -y --cfg /app/config.toml&quot;<br><br>  zkevm-metrics:<br>    image: prom/prometheus:v2.39.1<br>    container_name: zkevm-metrics<br>    restart: unless-stopped<br>    ports:<br>      - 9090:9090<br>    command:<br>      - --config.file=/etc/prometheus/prometheus.yml<br>      - --web.enable-lifecycle<br>    volumes:<br>      - ../config/metrics/prometheus:/etc/prometheus<br><br>  zkevm-bridge-db:<br>    container_name: zkevm-bridge-db<br>    image: postgres<br>    healthcheck:<br>      test: [ &quot;CMD-SHELL&quot;, &quot;pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}&quot; ]<br>    deploy:<br>      resources:<br>        limits:<br>          memory: 2G<br>        reservations:<br>          memory: 1G<br>    expose:<br>      - 5438<br>    ports:<br>      - 5438:5432<br>    environment:<br>      - POSTGRES_USER=test_user<br>      - POSTGRES_PASSWORD=test_password<br>      - POSTGRES_DB=test_db<br>    command: [&quot;postgres&quot;, &quot;-N&quot;, &quot;500&quot;]<br><br>  zkevm-bridge-service:<br>    container_name: zkevm-bridge-service<br>    image: hermeznetwork/zkevm-bridge-service:v0.1.0<br>    depends_on:<br>      zkevm-bridge-db:<br>        condition: service_healthy<br>    ports:<br>      - 8080:8080<br>      - 9090:9090<br>    environment:<br>      - ZKEVM_BRIDGE_DATABASE_USER=test_user<br>      - ZKEVM_BRIDGE_DATABASE_PASSWORD=test_password<br>      - ZKEVM_BRIDGE_DATABASE_NAME=test_db<br>      - ZKEVM_BRIDGE_DATABASE_HOST=zkevm-bridge-db<br>      - ZKEVM_BRIDGE_DATABASE_PORT=5432<br>    volumes:<br>      - ${ZKEVM_CONFIG_DIR}/sequencer.keystore:/pk/keystore.claimtxmanager<br>      - ${ZKEVM_ADVANCED_CONFIG_DIR:-./config/environments/public}/config.local.toml:/app/config.toml<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;/app/zkevm-bridge run --cfg /app/config.toml&quot;<br><br>  zkevm-explorer-l1:<br>    container_name: zkevm-explorer-l1<br>    image: hermeznetwork/zkevm-explorer:latest<br>    ports:<br>      - 4000:4000<br>    environment:<br>      - NETWORK=ETH<br>      - SUBNETWORK=Local Ethereum<br>      - COIN=ETH<br>      - ETHEREUM_JSONRPC_VARIANT=geth<br>      - ETHEREUM_JSONRPC_HTTP_URL=http://zkevm-mock-l1-network:8545<br>      - DATABASE_URL=postgres://l1_explorer_user:l1_explorer_password@zkevm-explorer-l1-db:5432/l1_explorer_db<br>      - ECTO_USE_SSL=false<br>      - MIX_ENV=prod<br>    command:<br>      - &quot;/bin/sh&quot;<br>      - &quot;-c&quot;<br>      - &quot;mix do ecto.create, ecto.migrate; mix phx.server&quot;<br><br>  zkevm-explorer-l1-db:<br>    container_name: zkevm-explorer-l1-db<br>    image: postgres<br>    ports:<br>      - 5436:5432<br>    environment:<br>      - POSTGRES_USER=l1_explorer_user<br>      - POSTGRES_PASSWORD=l1_explorer_password<br>      - POSTGRES_DB=l1_explorer_db<br>    command:<br>      - &quot;postgres&quot;<br>      - &quot;-N&quot;<br>      - &quot;500&quot;<br><br>  zkevm-bridge-ui:<br>    container_name: zkevm-bridge-ui<br>    image: hermeznetwork/zkevm-bridge-ui:latest<br>    ports:<br>      - 8080:80<br>    environment:<br>      - ETHEREUM_RPC_URL=$ZKEVM_NODE_ETHERMAN_URL<br>      - ETHEREUM_EXPLORER_URL=http://zkevm-explorer-l1:4000<br>      - ETHEREUM_BRIDGE_CONTRACT_ADDRESS=0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0<br>      - ETHEREUM_FORCE_UPDATE_GLOBAL_EXIT_ROOT=true<br>      - ETHEREUM_PROOF_OF_EFFICIENCY_CONTRACT_ADDRESS=0x610178dA211FEF7D417bC0e6FeD39F05609AD788<br>      - POLYGON_ZK_EVM_RPC_URL=http://zkevm-json-rpc:8123<br>      - POLYGON_ZK_EVM_EXPLORER_URL=http://zkevm-explorer-l2:4001<br>      - POLYGON_ZK_EVM_BRIDGE_CONTRACT_ADDRESS=0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0<br>      - POLYGON_ZK_EVM_NETWORK_ID=1<br>      - BRIDGE_API_URL=http://zkevm-bridge-service:8080<br>      - ENABLE_FIAT_EXCHANGE_RATES=false<br>      - ENABLE_OUTDATED_NETWORK_MODAL=false<br>      - ENABLE_DEPOSIT_WARNING=true<br>      - ENABLE_REPORT_FORM=false<br>  <br>  zkevm-mock-l1-network:<br>    container_name: zkevm-mock-l1-network<br>    image: hermeznetwork/geth-zkevm-contracts<br>    ports:<br>      - 8545:8545<br>      - 8546:8546<br>    command:<br>      - &quot;--http&quot;<br>      - &quot;--http.api&quot;<br>      - &quot;admin,eth,debug,miner,net,txpool,personal,web3&quot;<br>      - &quot;--http.addr&quot;<br>      - &quot;0.0.0.0&quot;<br>      - &quot;--http.corsdomain&quot;<br>      - &quot;*&quot;<br>      - &quot;--http.vhosts&quot;<br>      - &quot;*&quot;<br>      - &quot;--ws&quot;<br>      - &quot;--ws.origins&quot;<br>      - &quot;*&quot;<br>      - &quot;--ws.addr&quot;<br>      - &quot;0.0.0.0&quot;<br>      - &quot;--dev&quot;<br>      - &quot;--datadir&quot;<br>      - &quot;/geth_data&quot;<br>      - &quot;--syncmode&quot;<br>      - &quot;full&quot;<br>      - &quot;--rpc.allow-unprotected-txs&quot;</pre><h3>Starting the services</h3><p>Lets Start all the services one by executing using the following command in ~/zkevm/zkevm-node/testnet directory</p><blockquote>Note: In case you are using docker compose version &lt; 2.X.X please change the <strong>docker compose</strong> command to <strong>docker-compose</strong></blockquote><pre>#mock l1 networl services<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-mock-l1-network<br>#DB services<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-pool-db zkevm-state-db zkevm-event-db <br>#Executor service<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-prover<br>#Synchronizer service<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-sync<br>#Roll up Gas pricer service<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-l2gaspricer<br>#Transaction Manager service<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-eth-tx-manager<br>#JSON-RPC services<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-json-rpc zkevm-explorer-json-rpc<br>#Sequencer services<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-sequencer zkevm-sequence-sender<br>#Aggregator service<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-aggregator<br>#Roll up Block explorer services<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-explorer-l1 zkevm-explorer-l1-db zkevm-explorer-l2 zkevm-explorer-l2-db<br>#Bridge Services<br>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-bridge-service zkevm-bridge-ui zkevm-bridge-db</pre><blockquote><strong>In case you wish to run a full zkProver instead of Mock zkProver only then execute the following command</strong></blockquote><pre>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-prover-server</pre><p>In case all went well, you can check all services running successfully using the command</p><pre>docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml ps -a</pre><p>and see the following output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MdkPbrI89MAfLGxn9ZZNaw.png" /></figure><p>you can also open zkevm-json-rpc url using <a href="http://localhost:8123/">http://localhost:8123</a> and see the following output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*zn2A3lBag4LhzdDQcKKZ9A.png" /></figure><h3>Giving zkEVM POE contract spend approval for Sequencer</h3><p>Go to zkEVM-contract directory Run the below command to launch a Hardhat console connected to local geth instance</p><pre>npx hardhat console --network localhost</pre><p>Run the following javascript code to give approval</p><pre>const provider = ethers.getDefaultProvider(&quot;http://zkevm-mock-l1-network:8545&quot;); // set L1 RPC node<br>const privateKey = &quot;0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80&quot;; // Private key of Trusted sequencer<br>const wallet = new ethers.Wallet(privateKey, provider);<br><br>const maticTokenFactory = await ethers.getContractFactory(<br>  &quot;ERC20PermitMock&quot;,<br>  provider<br>);<br>maticTokenContract = maticTokenFactory.attach(&quot;0x5FbDB2315678afecb367f032d93F642f64180aa3&quot;); // From deploy_output.json maticTokenAddress<br>maticTokenContractWallet = maticTokenContract.connect(wallet);<br>await maticTokenContractWallet.approve(&quot;0x610178dA211FEF7D417bC0e6FeD39F05609AD788&quot;, ethers.utils.parseEther(&quot;100.0&quot;)); // From deploy_output.json polygonZkEVMAddress</pre><h3>Connecting to App Chain Roll up via Metamask</h3><p>To configure your Metamask to use your local environment, follow these steps:</p><h4>Adding App Chain Roll up to Metamask</h4><ol><li>Log in to your Metamask wallet</li><li>Click on your account picture and then on Settings</li><li>On the left menu, click on Networks</li><li>Click on Add Network button</li><li>Fill up the L2 network information</li><li>Network Name: App Chain Roll up- Local</li><li>New RPC URL: <a href="http://localhost:8123/">http://localhost:8123</a></li><li>ChainID: 1001</li><li>Currency Symbol: ETH</li><li>Block Explorer URL: <a href="http://localhost:4000/">http://localhost:400</a>1</li><li>Click on Save</li></ol><h4>Adding Local Geth to Metamask</h4><ol><li>Click on Add Network button</li><li>Fill up the L1 network information</li><li>Network Name: Geth - Local</li><li>New RPC URL: <a href="http://localhost:8545/">http://localhost:8545</a></li><li>ChainID: 1337</li><li>Currency Symbol: ETH</li><li>Click on Save</li></ol><h4>Adding Test Accounts Metamask</h4><ol><li>Click on account list drop down</li><li>Click on import Account</li><li>Enter the following keys for Test Accounts</li></ol><blockquote>Deployer Address</blockquote><blockquote>Account :0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 :<br>Private key:<br>0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80</blockquote><blockquote>Sequencer Address</blockquote><blockquote>Account :0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 :<br>Private key:<br>0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80</blockquote><blockquote>Aggregator Address</blockquote><blockquote>Account :0x70997970C51812dc3A010C7d01b50e0d17dc79C8 :<br>Private key:<br>0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d</blockquote><p>If you see something similar to what’s been described, congratulations! You’ve successfully initiated your zkEVM App Roll up using polygon zkEVM . This marks the conclusion of this guide. It’s my hope that it has provided you with all the necessary information to begin your adventure with your App Roll.</p><p>Though we used local geth in this guide, the steps mentioned above can be used to deploy zk app chain roll up onto any chain such as goerli or Ethereum with a few tweaks in smart contract deployment.</p><p>Happy programming!</p><p>Should you have any questions or concerns, feel free to reach out to me via this link: Twitter —<a href="https://twitter.com/adityarola"> https://twitter.com/adityarola</a></p><p>References:</p><p><a href="https://zkevm.polygon.technology/docs/setup-production-node">https://zkevm.polygon.technology/docs/setup-production-node</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f50b13231123" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/how-to-setup-your-own-self-sovereign-app-chain-zk-roll-up-using-polygon-zkevm-and-connect-with-f50b13231123">How to setup your own self sovereign app chain zk roll up using polygon zkEVM and connect with…</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polygon Supernets: Architecture & Local Setup]]></title>
            <link>https://medium.com/@aditya.rola/polygon-supernets-architecture-local-setup-f356c45b1a89?source=rss-b88614a15fff------2</link>
            <guid isPermaLink="false">https://medium.com/p/f356c45b1a89</guid>
            <category><![CDATA[polygon-supernets]]></category>
            <category><![CDATA[setup-polygon-supernet]]></category>
            <dc:creator><![CDATA[aditya.rola]]></dc:creator>
            <pubDate>Thu, 18 May 2023 01:24:41 GMT</pubDate>
            <atom:updated>2023-05-18T12:41:03.147Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBXFVpsslgwWxM43BX8qLg.png" /></figure><p>In this article we are going to cover-</p><ol><li>What arePolygon Supernets?</li><li>What are modules used by Polygon Supernets?</li><li>Polygon Supernets local setup from scratch</li></ol><h3><strong>What are Polygon Supernets?</strong></h3><p>Supernets are application-specific chains that operate on the Polygons Edge consensus client with <a href="https://wiki.polygon.technology/docs/supernets/design/consensus/polybft/polybft-overview">PolyBFT consensus</a>. They leverage a <a href="https://wiki.polygon.technology/docs/supernets/design/bridge/overview">native bridge</a> to connect with an associated rootchain, namely, Polygon PoS mainnet, enabling them to inherit its security and capabilities. Additionally, Supernets extend the block space available on the rootchain, providing scalability and interoperability for decentralized applications. With on-chain governance mechanisms, Supernets empower communities to make decisions and upgrade the network in a transparent and compliant manner.</p><h3>Modules offered by Polygon Supernets</h3><p>Polygon Supernets offers wide range of modules that developers can customize depending on their needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*lT8Thvk-FqasYZkO07W33Q.png" /></figure><ol><li><strong>Blockchain<br></strong>Coordinates everything in the system, curates state transitions, and is responsible for state changes when a new block is added to the chain.</li><li><strong>Consensus<br></strong>PolyBFT serves as the consensus mechanism of Polygon Supernets and consists of a consensus engine, IBFT 2.0, and a consensus protocol that includes the bridge, staking, and other utilities.</li><li><strong>libp2p<br></strong>Libp2p provides the basis for the underlying network layer and provides the networking layer for Supernets and is designed for peer-to-peer network architectures.</li><li><strong>Bridge<br></strong>An in-built bridging mechanism enabled by PolyBFT that allows message passing between a Supernet and another Proof-of-Stake blockchain without mapping.</li><li><strong>Mempool<br></strong>Enables multiple validators to aggregate their signatures to create a single, aggregated signature representing all validators in the pool.</li><li><strong>TxPool<br></strong>Tx Pool layer pools the transactions from different parts of the system and it is closely linked with other modules in the system, as transactions can be added from multiple entry points.</li><li><strong>JSON-RPC<br></strong>The JSON RPC layer is an API layer that allows developers use to communicate with the blockchain.</li><li><strong>Networking(gRPC)<br></strong>GRPC layer is vital for operator interactions. It leverages the communications between nodes which helps node operators interact easily with the client.</li></ol><h3>Polygon Supernet local setup</h3><p>So, after having a look at the architecture and the modules used by Polygon Supernet. Let us set the Polygon Supernet network locally on a linux machine running ubuntu . Before going for the further steps, let us discuss the pre-requisites-</p><ol><li>Go &gt;=1.18 (Recommended) on your local machine<br>sudo snap install go --channel=1.19/stable --classic</li><li><a href="https://docs.docker.com/engine/install/ubuntu/">Docker Engine</a></li><li><a href="https://github.com/0xPolygon/polygon-edge/archive/refs/tags/v0.9.0.tar.gz">Polygon-Edge Binary</a> (0.9.0)</li></ol><p>After you are done with the prerequisites, we can install the Polygon Edge binary using <em>go build -o polygon-edge.</em></p><p>In your terminal paste this command-</p><pre>tar -xvzf polygon-edge-0.9.0.tar.gz</pre><p>This should extract the content of polygon-edge into current directory</p><pre>cd polygon-edge-0.9.0<br>go build -o polygon-edge </pre><p>The binary file after this command will be located in your current directory.</p><p>After this you can confirm your installation by typing ./<em>polygon-edge</em> in your terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6rQuGbREdevoAYbE8_TPNg.png" /></figure><p>Now we will setup working polygon-edge blockchain network working with <a href="https://wiki.polygon.technology/docs/supernets/design/consensus/polybft/polybft-overview/">polyBFT consensus protocol</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xV_sRcMVgyyHzCQpIfUGaQ.png" /></figure><p>The blockchain network shown in the above image consist of 4 nodes of whom all 4 are validator nodes, and as such are eligible for both proposing block, and validating blocks that came from other proposers.</p><p>For our article we will work with a four nodes who will be acting both as the validators and will also propose new block.</p><blockquote><em>NOTE : There is no minimum to the number of nodes in a cluster, which means clusters with only 1 validator node are possible. Keep in mind that with a </em>single<em> node cluster, there is no crash tolerance and no BFT guarantee.</em></blockquote><blockquote><em>Therefore, the minimum recommended number of nodes for achieving a BFT guarantee is 4 — since in a 4 node cluster, the failure of 1 node can be tolerated, with the remaining 3 functioning normally.</em></blockquote><p>For generating a fully functional polyBFT cluster we need to follow below steps-</p><h3>1. Node preparation</h3><h4><strong>(i) Initializing data directories</strong></h4><p>The <strong>polygon-edge polybft-secrets</strong> command is used to generate account secrets for validators. The command initializes private keys for the consensus client (validators + networking) to a Secrets Manager config file.</p><pre>./polygon-edge polybft-secrets --insecure --data-dir node-app-chain- --num 4</pre><p><em>node-app-chain- here acts as a prefix for node directory and — num flag is used to specify the number of node directory to be generated. </em>You can name it as per your convenience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sghe0-2-7A_NBwCEsVAuvw.png" /></figure><p>The above commands prints the validator key and the <a href="https://docs.libp2p.io/concepts/peer-id/">node ID</a>. We will require node ID for the next step.</p><p>You should also see a folder created by the node name that you would have specified.</p><h4>(ii) Prepare the multiaddr connection string for the bootnode</h4><p>If a node wants to establish a successful connection, it must know which bootnode server to connect to in order to gain information about all the remaining nodes on the network.</p><p>Since we are going with a four node for our demo, the first 2 nodes will be acting as the bootnode as every polygon-supernet node can serve as a bootnode but in case of multiple nodes, every polygon-supernet node needs to have a set of bootnode specified which will be contacted to provide information on how to connect with all remaining nodes in the network.</p><blockquote><em>NOTE : At least one bootnode is required, so other nodes in the network can discover each other. More bootnodes are recommended, as they provide resilience to the network in case of outages.</em></blockquote><p>To create the connection string for specifying the bootnode, we will need to conform to the <a href="https://docs.libp2p.io/concepts/addressing/">multiaddr format</a>.</p><pre>/ip4/&lt;ip_address&gt;/tcp/&lt;port&gt;/p2p/&lt;node_id&gt;</pre><p>Here,</p><p>ip_address :127.0.0.1 (as we are running on localhost)</p><p>port :10001</p><p>node_id : 16Uiu2HAmD4NEvMCTdcr3aMiWSfvQcwJLPDgnwxBCmHcDdRX7HXaJ</p><p>You may have a different node_id, so replace it with yours.</p><pre>/ip4/127.0.0.1/tcp/10001/p2p/16Uiu2HAmD4NEvMCTdcr3aMiWSfvQcwJLPDgnwxBCmHcDdRX7HXaJ</pre><h4>(iii) Generate the genesis file with two bootnodes</h4><pre>./polygon-edge genesis --block-gas-limit 10000000 --epoch-size 10 \<br>--validators &quot;/ip4/127.0.0.1/tcp/30301/p2p/16Uiu2HAmD4NEvMCTdcr3aMiWSfvQcwJLPDgnwxBCmHcDdRX7HXaJ:0xb1C611804B62c05424C194ef9Ed0758822C2d6A3:2c63964d0bb2016f4926cfbb9dfd2b31eae33fddbc2d498b573c3574b9f40dc42e483134a32208eeafe116aa9a860b68eb0539af22142fb4a781ae42db4673c81306752b212990a611885cdb9bd819b89d2a1f2959f5625c87adb6d9349745d927ab150e6bdde208f039977e090be1ed2fd5774e4c6c1571e044a2ff0fb09bee&quot; \<br>--validators &quot;/ip4/127.0.0.1/tcp/30302/p2p/16Uiu2HAmA2vA8sYqmSUJmqzu5Byjh5vj2b7EWuFLkUZQYfCNHZid:0x2760e02E1DeaE5b7641c73A98764A4c10E567417:2f24e6c88c091d1d5df14c574c8e0c02dbafc4caac8bb1e44c0a55d39aae1bf02cdbbfa1717b52ded2a6e918810bff20742aa24628ddeb69c81ee2016610dfc52102be5dfebd8c89da2717fccddd0b0ca75397b913ebf1aec10dcc8e96ede6db2c048a94b4a58c124ae48196412234dc9139042a54214dfcf0d73262569189e5&quot; \<br>--consensus polybft \<br>--reward-wallet 0xb1C611804B62c05424C194ef9Ed0758822C2d6A3:1000000 \<br>--transactions-allow-list-admin 0xb1C611804B62c05424C194ef9Ed0758822C2d6A3,0x2760e02E1DeaE5b7641c73A98764A4c10E567417 \<br>--transactions-allow-list-enabled 0xb1C611804B62c05424C194ef9Ed0758822C2d6A3,0x2760e02E1DeaE5b7641c73A98764A4c10E567417</pre><p>we can also premine some balance to our account address using — <em>premine</em> flag. You can take any address from your Metamask and provide some ethers.</p><pre>./polygon-edge genesis --block-gas-limit 10000000 --epoch-size 10 \<br>--validators &quot;/ip4/127.0.0.1/tcp/30301/p2p/16Uiu2HAmD4NEvMCTdcr3aMiWSfvQcwJLPDgnwxBCmHcDdRX7HXaJ:0xb1C611804B62c05424C194ef9Ed0758822C2d6A3:2c63964d0bb2016f4926cfbb9dfd2b31eae33fddbc2d498b573c3574b9f40dc42e483134a32208eeafe116aa9a860b68eb0539af22142fb4a781ae42db4673c81306752b212990a611885cdb9bd819b89d2a1f2959f5625c87adb6d9349745d927ab150e6bdde208f039977e090be1ed2fd5774e4c6c1571e044a2ff0fb09bee&quot; \<br>--validators &quot;/ip4/127.0.0.1/tcp/30302/p2p/16Uiu2HAmA2vA8sYqmSUJmqzu5Byjh5vj2b7EWuFLkUZQYfCNHZid:0x2760e02E1DeaE5b7641c73A98764A4c10E567417:2f24e6c88c091d1d5df14c574c8e0c02dbafc4caac8bb1e44c0a55d39aae1bf02cdbbfa1717b52ded2a6e918810bff20742aa24628ddeb69c81ee2016610dfc52102be5dfebd8c89da2717fccddd0b0ca75397b913ebf1aec10dcc8e96ede6db2c048a94b4a58c124ae48196412234dc9139042a54214dfcf0d73262569189e5&quot; \<br>--consensus polybft \<br>--reward-wallet 0xb1C611804B62c05424C194ef9Ed0758822C2d6A3:1000000 \<br>--transactions-allow-list-admin 0xb1C611804B62c05424C194ef9Ed0758822C2d6A3,0x2760e02E1DeaE5b7641c73A98764A4c10E567417 \<br>--transactions-allow-list-enabled 0xb1C611804B62c05424C194ef9Ed0758822C2d6A3,0x2760e02E1DeaE5b7641c73A98764A4c10E567417 \<br>--premine &lt;YOUR_METAMASK_ADDRESS&gt;:&lt;AMOUNT_IN_WEI&gt; </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OSiDNWEsIHGfDpRFuX8C7A.png" /></figure><p>As you can see, I have premined 1000 ETH to my account address and our genesis file is now successfully created.</p><h3>2. Rootchain configuration</h3><p>In this section, we’ll configure the associated rootchain of the Supernet and deploy the necessary rootchain core contracts.</p><h4>(i) Deploy and initialize rootchain.</h4><p>To start the root chain paste this command in your terminal -</p><pre>./polygon-edge rootchain server</pre><p>The <strong>polygon-edge</strong> rootchain server command starts an ethereum/client-go container, which runs a new Geth node on the default JSON-RPC port of <strong>8545</strong>.</p><h4>(ii) Initialize rootchain Contracts.</h4><p>To deploy the rootchain contracts, we use the <strong>polygon-edge rootchain deploy</strong> command.</p><pre>./polygon-edge rootchain deploy \<br>--genesis ./genesis.json \<br>--json-rpc http://127.0.0.1:8545 \<br>--test</pre><p>the — test flag runs the deployment in test mode and use the test account provided by the Geth dev instance as the depositor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_l67hvNk9093maiUigFpag.png" /></figure><p>These smart contracts will be used to manage validators on the root chain.</p><h4>(iii) Funding validators on the rootchain</h4><p>It’s crucial to have enough funds in the validator account, as they need to cover the gas fees associated with their transactions on the rootchain.</p><p>To fund the validators’ accounts on the rootchain, we use the <strong>polygon-edge rootchain fund</strong> command. When executed with the appropriate flags, it will:</p><ol><li>Retrieve the validator account from the secrets manager.</li><li>Send a transaction to fund the validator account on the rootchain with a value of 10,000 $token (the network’s native token).</li><li>Repeat steps 1 and 2 for each validator.</li></ol><pre>./polygon-edge rootchain fund --data-dir ./node-app-chain-1 --amount 10000000000000000000000 \<br>--native-root-token 0x6FE03c2768C9d800AF3Dedf1878b5687FE120a27 --mint </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zxN575QQwDTE2iuqQ7pdmQ.png" /></figure><h3>3. Validator Whitelisting and Registration in CustomSupernetManager Contract</h3><h4>(i) Whitelist validators on the rootchain</h4><p>The <strong>CustomSupernetManager</strong> contract on the rootchain is responsible for managing the PolyBFT network.</p><p>Before validators can be registered on the <strong>CustomSupernetManager</strong> contract on the rootchain, they need to be allowlisted by the deployer of the <strong>CustomSupernetManager</strong> contract.</p><p>This can be done using the <strong>polygon-edge polybft whitelist-validators</strong> command.</p><pre>./polygon-edge polybft whitelist-validators \<br>--private-key aa75e9a7d427efc732f8e4f1a5b7646adcc61fd5bae40f80d13c8419c9f43d6d \<br>--addresses 0xb1C611804B62c05424C194ef9Ed0758822C2d6A3,0x2760e02E1DeaE5b7641c73A98764A4c10E567417 \<br>--supernet-manager 0x75aA024A2292A3FD3C17d67b54B3d00435437246 \<br>--jsonrpc http://127.0.0.1:8545</pre><p>The — private-key flag is used to specify the hex encoded private key of the CustomSupernetManager Contract Deployer.</p><blockquote>for the demo geth instance, the test account private key has been hardcoded: <strong>aa75e9a7d427efc732f8e4f1a5b7646adcc61fd5bae40f80d13c8419c9f43d6d</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qH4X3iqcAoz1ILqxWO5apQ.png" /></figure><h4>(ii) Register validators on the rootchain</h4><p>Each validator needs to register themselves on the <strong>CustomSupernetManager</strong> contract. This is done using the <strong>polygon-edge polybft register-validator</strong> command.</p><pre>./polygon-edge polybft register-validator --data-dir ./node-app-chain-1 \<br>--supernet-manager 0x75aA024A2292A3FD3C17d67b54B3d00435437246 \<br>--jsonrpc http://127.0.0.1:8545 </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MMySD7Ab9AN-fvbwkNAFuw.png" /></figure><p>Repeating the above for each validator will register the validator address in the <strong>CustomSupernetManager c</strong>ontract<strong>.</strong></p><h3>4. Staking</h3><h4>(i) Initial staking on the rootchain</h4><p>Each validator needs to perform initial staking on the rootchain <strong>StakeManager</strong> contract. This is done using the <strong>polygon-edge polybft stake</strong> command.</p><pre>./polygon-edge polybft stake --data-dir ./node-app-chain-1 --chain-id 1 --amount 10000000000000000 \<br>--stake-manager 0x811068e4106f7A70D443684FF4927eC3940439Ec --native-root-token 0x6FE03c2768C9d800AF3Dedf1878b5687FE120a27 \<br>--jsonrpc http://127.0.0.1:8545</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vU6ovfmWpyWJ6yKE0oaVQ.png" /></figure><p>In the following example command, we use the validator key and the rootchain <strong>StakeManager</strong> contract address that were generated earlier. We also set the staking amount to <strong>10000000000000000</strong> which is equivalent to 0.01 token. The <strong>--native-root-token</strong> flag is used to specify the address of the native token of the root chain.</p><p>Repeating the above command for each validator will allow the validators to self stake on the rootchain <strong>StakeManager</strong> contract.</p><h4>(ii) Finalize validator set on the rootchain</h4><p>After all validators from the genesis block have performed initial staking on the rootchain, the final step required before starting the chain is to finalize the genesis validator set on the <strong>SupernetManager</strong> contract on the rootchain. This can be done using the <strong>polygon-edge polybft supernet</strong> command.</p><pre>./polygon-edge polybft supernet --private-key aa75e9a7d427efc732f8e4f1a5b7646adcc61fd5bae40f80d13c8419c9f43d6d \<br>--genesis ./genesis.json \<br>--supernet-manager 0x75aA024A2292A3FD3C17d67b54B3d00435437246 \<br>--stake-manager 0x811068e4106f7A70D443684FF4927eC3940439Ec \<br>--finalize-genesis-set --enable-staking \<br>--jsonrpc http://127.0.0.1:8545</pre><p>If the <strong>--enable-staking</strong> flag is provided, validators will be able to continue staking on the rootchain. If not, genesis validators will not be able to update their stake or unstake, nor will newly registered validators after genesis be able to stake tokens on the rootchain.</p><p>The <strong>— finalize-genesis-set flag </strong>is used to finalize the genesis state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zvIpxdnT7gfHc1A8DJiIpA.png" /></figure><h3>5. Start the Nodes</h3><p>Now that we have set up the rootchain and created the chain configuration, we can run the Supernet cluster of Edge clients. In this example, we’ll run a cluster of four Edge clients.</p><p>For our first node we have-</p><p>5001 : gRPC server</p><p>30301 : libp2p server</p><p>10001 : JSON-RPC server</p><p>Now let’s start the node using command-</p><pre>./polygon-edge server --data-dir ./node-app-chain-1 --chain genesis.json --grpc-address :5001 --libp2p :30301 --jsonrpc :10001 --seal --log-level DEBUG</pre><p>Similarly the command for other validators —</p><pre>./polygon-edge server --data-dir ./test-chain-2 --chain genesis.json --grpc-address :5002 --libp2p :30302 --jsonrpc :10002 --seal --log-level DEBUG<br><br>./polygon-edge server --data-dir ./test-chain-3 --chain genesis.json --grpc-address :5003 --libp2p :30303 --jsonrpc :10003 --seal --log-level DEBUG<br><br>./polygon-edge server --data-dir ./test-chain-4 --chain genesis.json --grpc-address :5004 --libp2p :30304 --jsonrpc :10004 --seal --log-level DEBUG</pre><p>You can also provide block time that you want to set for the creation of blocks using the flag — <strong><em>block-time. </em></strong>By default the block time is 2 sec.</p><p>Your terminal must have been running now, you can now go and check in your browser by typing your JSON-RPC URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NNrP9-1YPYUsBuTvSjoZ7Q.png" /></figure><p>If you see something similar to what’s been described, congratulations! You’ve successfully initiated your Polygon Supernet cluster. This marks the conclusion of this guide. It’s my hope that it has provided you with all the necessary information to begin your adventure with Polygon Supernet.</p><p>Happy programming!</p><p>Should you have any questions or concerns, feel free to reach out to me via this link: LinkedIn — <a href="https://www.linkedin.com/in/adityarola/">https://www.linkedin.com/in/adityarola/</a></p><p>References</p><p><a href="https://wiki.polygon.technology/docs/supernets/operate/supernets-local-deploy-supernet/">Deploy a Local Polygon Supernet | Polygon Wiki</a></p><p><a href="https://medium.com/coinmonks/polygon-edge-architecture-local-setup-with-metamask-for-erc20-erc721-contracts-9705d63ef438">https://medium.com/coinmonks/polygon-edge-architecture-local-setup-with-metamask-for-erc20-erc721-contracts-9705d63ef438</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f356c45b1a89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Capx Liquid]]></title>
            <link>https://medium.com/@aditya.rola/what-is-liquid-89532391f978?source=rss-b88614a15fff------2</link>
            <guid isPermaLink="false">https://medium.com/p/89532391f978</guid>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[aditya.rola]]></dc:creator>
            <pubDate>Tue, 25 Jan 2022 20:18:09 GMT</pubDate>
            <atom:updated>2022-01-25T23:07:35.458Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ViDKsbYS1ZgHOhrT6jbuNQ.png" /></figure><p>Capx Liquid at its core is a group of smart contracts working in harmony with the Liquid Dapp to ease and automate the process of Vesting &amp; Token distribution while making it frictionless and secure by generating a tokenized proof of purchase or Wrapped Vested Token (WVTs).</p><p>These Wrapped Vesting Tokens (WVTs), while ensuring the security of ownership on the chain, also enable countless DeFi applications and further use in the ecosystem.</p><p>Capx Liquid is a Decentralized Dapp that is powered by three major components</p><ol><li><strong>Capx Liquid Protocol Smart Contracts :</strong> Capx Liquid Smart Contracts are the backbone of Capx Liquid as they take care of the token vesting and distribution mechanism for a project token on chain.</li><li><strong>Capx Liquid Dapp :</strong> UI service to interact with Capx Liquid smart contracts.</li><li><strong>Capx Liquid Metadata Service :</strong> Service to power Capx Liquid Dapp with situational metadata.</li></ol><h3>How it fits into the Grand Scheme</h3><p>With Capx Liquid, the project team can simply upload the vesting schedule and the Liquid Dapp takes care of the token locks, redemption and transfer for the project, while also generating WVTs (Wrapped Vesting Tokens) allowing the Issuer (Project Team) to deploy a zero-code fully automated mechanism to manage vesting schedule, unlocking and token distribution.</p><h3>Aim with Liquid</h3><p>With Capx Liquid we aim to use the power of tokens and blockchain combined with secure architecture to help the ever growing DeFi ecosystem grow faster. The current implementation of liquid will become the starting point for an ever-evolving liquid platform and enable it to adapt to the changing ecosystem with features like cross-chain support and IDOs.</p><h3>Design</h3><p>Capx Liquid follows the principle of Full Stack Decentralization and at a high level can be divided into three logical components namely:</p><ol><li>Smart-Contracts which helps in interacting with blockchain and brings trust and verifiability into the system,</li><li>Metadata Service which is responsible for empowering the Dapp with enough data so that it can provide an enterprise level performance, and</li><li>The Dapp which serves as the UI layer which helps project teams and investors alike to use the system.</li></ol><p>To reach this vision of fully decentralized applications (dApps), it’s critical that we shift from a paradigm of reinvention and turn our eyes towards collaboration and for this reason the majority of Capx liquid is powered by and hosted on public infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZgqtPCli5BROSrcZwa4CqA.png" /></figure><h3>Smart Contracts</h3><h4>Basic Design :</h4><p>The smart contract layer of Capx Liquid acts as our gateway to blockchain infrastructure. These smart contracts are Universal Upgradeable Proxy Standard (UUPS) upgradable small computer programs coded in Solidity and are EVM Compatible. Capx Liquid smart contracts enable the protocol to act as a trusted escrow to store and generate Wrapped Vesting Tokens using EIP — 1167 (Minimal Proxy Contract) pattern.</p><h4><strong>Characteristics :</strong></h4><ul><li>Language &amp; Compiler : Solidity v0.8.4</li><li>Upgradable : YES ( UUPS Upgradable)</li><li>Ownership : Capx DAO</li></ul><h4>Architectural Diagram :</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H1er52uMxN-5Ka3BzB6D3A.png" /></figure><h4>Design Considerations :</h4><ul><li>EIP — 1167 Minimal Proxy Contract pattern is used to enable smart contracts to mint and distribute ERC-20 tokens more efficiently and securely.</li><li>Major Smart Contract i.e Master Contract, Vesting contract and Controller Contract are upgradeable using UUPS.</li><li>In case of adverse events on protocol, a Kill Switch can be invoked by passing a proposal in the DAO or by guardians to pause the smart contract.</li><li>Important functions have been protected using Re-Entrancy guards to protect the users and protocol.</li><li>100% test coverage code with 0 Unprotected low level calls.</li><li>Audited and tested thoroughly by CredShields.</li></ul><h4>RoadMap :</h4><ul><li>To Integrate a fully decentralized rollback and revert mechanism in the architecture.</li><li>To transfer more functionality to Capx DAO.</li></ul><h3>Capx Metadata Service</h3><h4>Basic Design :</h4><p>The metadata service layer of Capx Liquid provides the Capx Liquid Dapp with insightful and curated data feed that allows it to deliver enterprise grade application experience. Keeping the thought of decentralization on all layers, we have decided to initially go forward and collaborate with the graph protocols and moralis.</p><h4>Characteristics :</h4><ul><li>Language : typeScript and Graphql</li><li>Uptime : 99.9%</li><li>Service used : the graph protocol, moralis, own indexing nodes</li></ul><h4>Architectural Diagram :</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1jdp2N4YHlwARcSRban5g.png" /></figure><h4>Design Considerations :</h4><ul><li>While blockchains and storage networks are critical components of the stack, data is rarely stored in a format that can be consumed directly in applications.</li><li>The Graph Network saw vibrant participation across stakeholder groups. There are now<a href="https://thegraph.com/explorer/participants/indexers"> 160 Indexers</a>,<a href="https://thegraph.com/explorer/participants/delegators"> 7,400+ Delegators</a>, and<a href="https://thegraph.com/explorer/participants/curators"> 2,200+ Curators</a> live on the network.</li><li>In case of adverse events where one or more services go down we will switch to the next available data source.</li><li>The data entities have been structured to provide both macro and micro views of the transactions in the protocol.</li></ul><h4>RoadMap :</h4><ul><li>To Integrate a fully decentralized multi feed architecture.</li><li>To transfer more functionality to Capx DAO.</li></ul><h3>Capx Liquid Dapp</h3><h4>Basic Design :</h4><p>Capx Liquid Dapp is a lightweight and robust Web3 enabled javascript application that enables project teams to easily vest their token’s in a secure manner and for investors to see their holdings and other project details.</p><p>The Dapp is super composable and built using ReactJS. It also includes a custom built connector for making your webapp Web3 enabled.</p><h4>Characteristics :</h4><ul><li>Language : Javascript, ReactJS &amp; Webpack</li><li>Uptime : 99.9%</li></ul><h4>Architectural Diagram :</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x_gQaCHaE99oHvsAwfczdw.png" /></figure><h4>Design Considerations :</h4><ul><li>While blockchains and other decentralized technologies are entering into the world, Capx Liquid Dapp has been designed to keep in mind the old feel of Web 2.0 while ensuring literacy towards Web 3.0 .</li><li>Capx Liquid Dapp is lightweight Javascript application that is robust and uses ReactJS for fluid UX and faster data refresh</li><li>We use open source tail-wind currently for our styling needs for easy composability</li><li>To enable connection to the Web3 world we use our own Metamask connector which relies on web3.JS library hence completely abstracting the inner working of web3 from the main application.</li><li>To boost ease of scalability — the Dapp has been designed using functional Paradigm</li></ul><h4>RoadMap :</h4><ul><li>To Deploy the Dapp on a fully decentralized solution such as IPFS.</li><li>To introduce TypeScript to boost robustness and stability.</li><li>To transfer more functionality to Capx DAO.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89532391f978" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>