<?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 2pilot on Medium]]></title>
        <description><![CDATA[Stories by 2pilot on Medium]]></description>
        <link>https://medium.com/@stanisloe?source=rss-26b2f1c7161f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3mkD2EoN_RZe4pZqcsziFA.png</url>
            <title>Stories by 2pilot on Medium</title>
            <link>https://medium.com/@stanisloe?source=rss-26b2f1c7161f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 09 Jun 2026 07:19:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stanisloe/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[Namada tinkerer notes part 2]]></title>
            <link>https://medium.com/@stanisloe/namada-tinkerer-notes-part-2-edf938358fa0?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/edf938358fa0</guid>
            <category><![CDATA[namada]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[anoma]]></category>
            <category><![CDATA[cosmos-network]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Tue, 28 Nov 2023 21:50:09 GMT</pubDate>
            <atom:updated>2023-11-30T15:54:44.920Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hv5R2hNE-1Lw2d4ojDYGUg.jpeg" /><figcaption>It’s tinkering time</figcaption></figure><p>Welcome to the second part of our tinkering journey where we discuss governance mechanism, various types of proposals and learn how to stake, earn rewards and unbond your precious NAM tokens.</p><p>If you haven’t had a chance to explore the first part yet, you can find it at this <a href="https://medium.com/@stanisloe/namada-tinkerer-notes-4405a6e65b5f">link</a>. It explains the basics that are very usefull to better understand what we are going to discuss next.</p><p><strong>Let’s submit a proposal</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3hU8x4ym7fdkgihpOVoJsQ.png" /><figcaption>No. Different kind of proposal</figcaption></figure><p>Governance is a decentralized way to intoroduce changes to the chain, suggestions on how spend funds from the community pool or airdrop tokens to valuable members of the community. This is achieved via proposal mechanism.</p><p>Anyone can submit a general proposal to the chain if they are ready to freeze 500 NAM tokens for the proposal voting period. In the event that the proposal is approved or declined, 500 NAM will be returned to your wallet. However, if the proposal is considered as a spam, your tokens will be permanently removed (burnt).</p><p>Anyone with a positive NAM balance can vote for a proposal or mark it as a spam. The weight of your voice is proportional to the amount of tokens you have bonded ( discussed later ). So your influence on the protocol’s future grows with the increase in the number of tokens you possess.</p><p>Let’s see how it works by actually submitting a spam proposal, it’s a testnet after all! Export proposal properties into variables:</p><pre>export PROPOSAL_TITLE=&quot;How to burn 500 NAM tokens&quot; &amp;&amp; \<br>export PROPOSAL_AUTHORS=&quot;hello@2pilot.dev&quot; &amp;&amp; \<br>export PROPOSAL_DISCUSSIONS_TO=&quot;Just voices in my head&quot; &amp;&amp; \<br>export PROPOSAL_CREATED=&quot;2024-01-01T00:00:01Z&quot; &amp;&amp; \<br>export PROPOSAL_LICENSE=&quot;MIT&quot; &amp;&amp; \<br>export PROPOSAL_ABSTRACT=&quot;Spam proposal&quot; &amp;&amp; \<br>export PROPOSAL_MOTIVATION=&quot;Because I can&quot; &amp;&amp; \<br>export PROPOSAL_DETAILS=&quot;I&#39;ll probably get slashed for that&quot; &amp;&amp; \<br>export PROPOSAL_AUTHOR=&quot;tnam1qzq77j54tpsry9ctmft9gh38j3r7wanprvjr0hs7&quot; &amp;&amp; \<br>export VOTING_START_EPOCH=798 &amp;&amp; \<br>export VOTING_END_EPOCH=804 &amp;&amp; \<br>export GRACE_EPOCH=810</pre><p>Most of the properties like title, authors, details are self explanatory, let’s focus on the most interesting ones</p><p>PROPOSAL_AUTHOR address that you have access to and want to create a proposal from. This address should have 500 NAM tokens in possession.</p><p>VOTING_START_EPOCH — epoch when the voting will start. keep in mind it should be greater than the current epoch and multiply of 3, for example 3, 6, 9 .. etc</p><p>to check the current epoch you can run</p><pre>namada client epoch</pre><p>VOTING_END_EPOCH — deadline for voting for proposal. Also should be multiply of 3 and greater than VOTING_START_EPOCH</p><p>GRACE_EPOCH — epoch when proposal if passed, it’s suggested changes will come into effect. should be VOTING_END_EPOCH + 6 or more</p><p>To submit a proposal we need a json file with the following structure:</p><pre>{<br>	&quot;proposal&quot;: {<br>		&quot;content&quot;: {<br>			&quot;title&quot;: &quot;One Small Step for Namada, One Giant Leap for Memekind&quot;,<br>			&quot;authors&quot;: &quot;bengt@heliax.dev&quot;,<br>			&quot;discussions-to&quot;: &quot;forum.namada.net/t/namada-proposal/1&quot;,<br>			&quot;created&quot;: &quot;2069-04-20T00:04:44Z&quot;,<br>			&quot;license&quot;: &quot;MIT&quot;,<br>			&quot;abstract&quot;: &quot;We present a proposal that will send our community to the moon. This proposal outlines all training necessary to accomplish this goal. All memers are welcome to join.&quot;,<br>			&quot;motivation&quot;: &quot;When you think about it, the moon isn&#39;t actually that far away.The moon is only 384,400 km. We have not yet brought Namada to the moon, so it is only natural to use 101 as the prime number for our modular arithmetic operations. 384,400 (mod 101) = 95. 95 km is a distance that can be easily covered by a single person in a single day. Namada was produced by more than 100 people. So 95/100 = 0, rounded to the nearest integer. This means that Namada can reach the moon in no time.&quot;,<br>			&quot;details&quot;: &quot;Bringing Namada to the moon in no time is easily achievable. We just need to pass this governance proposal and set the plan in action&quot;,<br>			&quot;requires&quot;: &quot;&quot;<br>		},<br>		&quot;author&quot;: &quot;atest1v4ehgw36g9zyydzpgycy23phxuunxdesgc6nydfsxge5x3zzgscny32pxccn2wfjg5urx3fhzxhmch&quot;,<br>		&quot;voting_start_epoch&quot;: 21,<br>		&quot;voting_end_epoch&quot;: 24,<br>		&quot;grace_epoch&quot;: 27,<br>		&quot;type&quot;: {<br>			&quot;Default&quot;: null<br>		}<br>	}<br>}</pre><p>We already exported all of it’s variables into properties, so let’s create it ( Don’t forget to update PROPOSAL_AUTHOR, VOTING_START_EPOCH, VOTING_END_EPOCH, GRACE_EPOCH variables with your own data)</p><pre>echo &#39;{<br>    &quot;proposal&quot; :{<br>        &quot;content&quot;: {<br>            &quot;title&quot;: &quot;&#39;&quot;$PROPOSAL_TITLE&quot;&#39;&quot;,<br>            &quot;authors&quot;: &quot;&#39;&quot;$PROPOSAL_AUTHORS&quot;&#39;&quot;,<br>            &quot;discussions-to&quot;: &quot;&#39;&quot;$PROPOSAL_DISCUSSIONS_TO&quot;&#39;&quot;,<br>            &quot;created&quot;: &quot;&#39;&quot;$PROPOSAL_CREATED&quot;&#39;&quot;,<br>            &quot;license&quot;: &quot;&#39;&quot;$PROPOSAL_LICENSE&quot;&#39;&quot;,<br>            &quot;abstract&quot;: &quot;&#39;&quot;$PROPOSAL_ABSTRACT&quot;&#39;&quot;,<br>            &quot;motivation&quot;: &quot;&#39;&quot;$PROPOSAL_MOTIVATION&quot;&#39;&quot;,<br>            &quot;details&quot;: &quot;&#39;&quot;$PROPOSAL_DETAILS&quot;&#39;&quot;<br>        },<br>        &quot;author&quot;: &quot;&#39;&quot;$PROPOSAL_AUTHOR&quot;&#39;&quot;,<br>        &quot;voting_start_epoch&quot;: &#39;&quot;$VOTING_START_EPOCH&quot;&#39;,<br>        &quot;voting_end_epoch&quot;: &#39;&quot;$VOTING_END_EPOCH&quot;&#39;,<br>        &quot;grace_epoch&quot;: &#39;&quot;$GRACE_EPOCH&quot;&#39;,<br>        &quot;type&quot;: {<br>            &quot;Default&quot;: null<br>        }<br>    } <br>}&#39; &gt; proposal.json</pre><p>Once it’s created let’s submit a proposal to the chain</p><pre>namadac init-proposal --data-path proposal.json</pre><p>If there were no errors during the process anyone can find your proposal by quering</p><pre>namada client query-proposal</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcqDpsJt_4hw8q0alloTXA.png" /></figure><p>We can see some basic information like proposal id, type, author, epoch, but no details on what this proposal is acutally suggesting. To get more info about the proposal you can run</p><pre>namada client query-proposal --proposal-id 0</pre><p>Just use proposal id you are actually interested in. In my case it was 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zhoTmQztyljTMV9seb3ECw.png" /></figure><p>Great, we can see all details about the proposal. Note that status is currently in pending state. This is because start epoch is 798 and we are currently on epoch 796. At epoch 798 you can see that status has changed to on-going.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3srHJZa7rvtGDEu1_ZZ93g.png" /></figure><p>once it finishes the status will be marked as ended</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lJ6wqNfG_YEYd3zue3EGZQ.png" /></figure><p>Should we wait some time to observe the impact our outstanding proposal has made on the world?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*_fd4TAznrdseqD1u.jpg" /><figcaption>Bad idea</figcaption></figure><p>Since this proposal didn’t introduce any changes and was simply a spam proposal, nothing had changed after its conclusion.</p><p>The proposal we submited is called Default proposal and you can actually change network parameters with it by providing extra data parameter to the proposal json which should contain path to wasm code.</p><pre>&quot;data&quot; : &quot;&lt;path/to/wasm.wasm&gt;&quot;</pre><p>What could be changed ? Quite a lot:</p><ul><li>you can increase or decrease minimum NAM deposit required for creating a proposal</li><li>number of validators in the active set</li><li>inflation rates and much more</li></ul><p>Next let’s try different kind of proposal called <strong>Pgf steward</strong></p><h4>Becoming a steward</h4><p>Steward is a community elected entity that could be a group of people represented by <a href="https://medium.com/coinmonks/namada-tinkerer-notes-4405a6e65b5f#c80e">multisignature account </a>or a single person. Once a steward is elected it will be able to submit proposals to the public goods funding (PGF) pool. In other words, steward has a right to airdrop tokens from PGF pool to the selected number of addresses if his proposal will be accepted by the community.</p><p>Let’s prepare our porposal:</p><pre>export PROPOSAL_TITLE=&quot;2pilot for Steward for life&quot; &amp;&amp; \<br>export PROPOSAL_AUTHORS=&quot;hello@2pilot.dev&quot; &amp;&amp; \<br>export PROPOSAL_DISCUSSIONS_TO=&quot;Me myself and I all agreed on nominating 2pilot for Steward&quot; &amp;&amp; \<br>export PROPOSAL_CREATED=&quot;2024-01-01T00:00:01Z&quot; &amp;&amp; \<br>export PROPOSAL_LICENSE=&quot;MIT&quot; &amp;&amp; \<br>export PROPOSAL_ABSTRACT=&quot;2pilot for Steward for life&quot; &amp;&amp; \<br>export PROPOSAL_MOTIVATION=&quot;There are no other candidates currently so I should win !&quot; &amp;&amp; \<br>export PROPOSAL_DETAILS=&quot;2pilot should be a good and worthy steward&quot; &amp;&amp; \<br>export PROPOSAL_AUTHOR=&quot;tnam1qzq77j54tpsry9ctmft9gh38j3r7wanprvjr0hs7&quot; &amp;&amp; \<br>export STEWARD_ADDRESS=$PROPOSAL_AUTHOR &amp;&amp; \<br>export VOTING_START_EPOCH=807 &amp;&amp; \<br>export VOTING_END_EPOCH=810 &amp;&amp; \<br>export GRACE_EPOCH=816</pre><p>As you might have noticed, there haven’t been many changes from the previous proposal parameters. We only have the STEWARD_ADDRESS variable, which serves as our nominee. It should be equal to the PROPOSAL_AUTHOR And of course there are some updates to the epoch parameters.</p><p>Let’s create new proposal file and call it steward_proposal.json</p><pre>echo &#39;{<br>    &quot;proposal&quot; :{<br>        &quot;content&quot;: {<br>            &quot;title&quot;: &quot;&#39;&quot;$PROPOSAL_TITLE&quot;&#39;&quot;,<br>            &quot;authors&quot;: &quot;&#39;&quot;$PROPOSAL_AUTHORS&quot;&#39;&quot;,<br>            &quot;discussions-to&quot;: &quot;&#39;&quot;$PROPOSAL_DISCUSSIONS_TO&quot;&#39;&quot;,<br>            &quot;created&quot;: &quot;&#39;&quot;$PROPOSAL_CREATED&quot;&#39;&quot;,<br>            &quot;license&quot;: &quot;&#39;&quot;$PROPOSAL_LICENSE&quot;&#39;&quot;,<br>            &quot;abstract&quot;: &quot;&#39;&quot;$PROPOSAL_ABSTRACT&quot;&#39;&quot;,<br>            &quot;motivation&quot;: &quot;&#39;&quot;$PROPOSAL_MOTIVATION&quot;&#39;&quot;,<br>            &quot;details&quot;: &quot;&#39;&quot;$PROPOSAL_DETAILS&quot;&#39;&quot;<br>        },<br>        &quot;author&quot;: &quot;&#39;&quot;$PROPOSAL_AUTHOR&quot;&#39;&quot;,<br>        &quot;voting_start_epoch&quot;: &#39;&quot;$VOTING_START_EPOCH&quot;&#39;,<br>        &quot;voting_end_epoch&quot;: &#39;&quot;$VOTING_END_EPOCH&quot;&#39;,<br>        &quot;grace_epoch&quot;: &#39;&quot;$GRACE_EPOCH&quot;&#39;<br>    },<br>    &quot;data&quot; : <br>        {<br>            &quot;add&quot; : &quot;&#39;&quot;$STEWARD_ADDRESS&quot;&#39;&quot;,<br>            &quot;remove&quot;: []<br>        }<br>       <br>}&#39; &gt; steward_proposal.json</pre><p>Notice that json contains new data field. You can add steward address to add field if you consider him worthy and you want to nominate him. You can also provide list of steward adressess that you don’t like into remove field.</p><p>Submit proposal to the chain</p><pre>namadac init-proposal \<br>        --pgf-stewards \<br>        --data-path steward_proposal.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8_XtxqsIgiN5q1Ivwf9GLQ.png" /></figure><p>note--pgf-stewards flag which is specific to PGF proposals. If you want to nominate a steward or initiate an airdrop as a steward you should add this flag to your init-proposal command</p><p>To list all proposals and see if newly submitted proposal is there run</p><pre>namada client query-proposal</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U-F1eHtzh7UZMYO65tTNJA.png" /></figure><p>Indeed it’s there. Now let’s try voting ( make sure you have exported your ACCOUNT_KEY_1 like we did in the previous <a href="https://medium.com/coinmonks/namada-tinkerer-notes-4405a6e65b5f#d8dd">chapeter</a> )</p><pre>namada client vote-proposal \<br>    --proposal-id 1 \<br>    --vote yay \<br>    --address $ACCOUNT_KEY_1</pre><p>You might get the following error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85tpxOfOl9CjK4BZUXEleA.png" /></figure><p>That’s because voting period will start in the future as was described in the proposal properties. But after some time we can vote and the result will be similar to</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpEj8aKBnet4w_CvceNuOQ.png" /></figure><p>When the voting period will end you can check proposal results</p><pre>namada client query-proposal-result --proposal-id 1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JZ-kZ3fHotsoIaN3nvFxg.png" /></figure><p>Oh no, my proposal got rejected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*UBxPIbQ3_4P6LqH0Lqk9hA.jpeg" /><figcaption>Better luck next time !</figcaption></figure><p>Also, it is showing 0.000000 yay votes, but I’ve definitely voted for myself. The reason for that is we need to bond tokens to a validator first, a topic we’ll delve into in the next chapter.</p><p>If you were selected as steward you can nominate addresses to receive fundings by changing data field to</p><pre>&quot;data&quot; : {<br>  &quot;retro&quot;: [<br>    {<br>      &quot;target&quot;: {<br>        &quot;amount&quot;: 1337,<br>        &quot;address&quot;: &quot;3pilot&quot;<br>      }<br>    }<br>  ]<br>}</pre><p>which, if passed, will grant 1337 NAM to 3pilot.</p><p>Eplore more funding options <a href="https://docs.namada.net/users/governance/on-chain-governance">here</a>.</p><h4>A Day in the Life of a Delegator</h4><p>Let’s try on delegator’s shoes, shall we?</p><p>But first, let’s explore who a delegator is and why one might choose to become one.</p><p>Basically anyone with positive NAM can become a delegator. All you need to do is to bond your tokens to a validator. Ok, but what does it mean to bond and who is validator you might ask ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/0*dLXqF7u1Y-jgCqXN" /><figcaption>Let’s explain it to Pikachu</figcaption></figure><p>A validator is a participant in the network responsible for validating and confirming transactions. They ensure the accuracy and legitimacy of transactions before they are added to the blockchain. Validators reputation and weight is built on maintaining the integrity of the system.</p><p>Bonding is like putting your NAM assets in a secure partnership with a validator. You are locking your tokens and, in return, receive rewards every time a new block is produced. Rewards depend on the inflation rate, the amount of NAM tokens you bonded, validator commission, and performance. If a validator does not produce enough valid blocks within a given time window, he will get slashed, and so will you. So choose your validator wisely. You can always unbond your tokens, but it will take some time, usually 14 or 21 days before they become liquid.</p><p>Btw, all those parameters we just discussed — like the inflation rate and validator performance window — could be modified via a default proposal. Also, being a delegator is a prerequisite to vote for such proposals, without it your vote weight will be simply equal to 0.</p><p>Ok, after this brief intro let’s try actually delegating to someone. First check your balance</p><pre>namada --base-dir $BASE_DIR client balance \<br>--ledger-address $RPC \<br>--token NAM --owner $ACCOUNT_KEY_1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rEov6ycK6-W0kyenEdnGGQ.png" /></figure><p>Check active validators by running</p><pre>namadac bonded-stake</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*on-hW1gYRvS8ubTmWOGJiQ.png" /></figure><p>Bond tokens to your favourite validator. Don’t forget to export his address into VALIDATOR_ADDRESS variable.</p><pre>namadac bond \<br> --validator $VALIDATOR_ADDRESS \<br> --amount 10 \<br> --source $ACCOUNT_KEY_1</pre><p>Let’s see if the stake for the selected validator increased</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8GJIrIE2CwgV5UQQbHKqeA.png" /></figure><p>nope, it hasn’t. But what about our balance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yy6lVSZfpe-_8HV6pGUGMA.png" /></figure><p>It’s a scam ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*rX-tx8bNFJD2rVwjTNDckw.jpeg" /><figcaption>Catch me if you can</figcaption></figure><p>Not really. We need to wait 2 epochs to see the effect. When you check bonded stake later you should see the updated amount. Also, when you bond tokens to a validator, he doesn’t have control over them; only you do. However, they will receive a commission from your rewards.</p><p>After few epochs check the stake again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l1EyqJm_-jZjBSyEtDsK_A.png" /></figure><p>If you want to unstake your tokens run</p><pre>namada client unbond \<br>  --source $ACCOUNT_KEY_1 \<br>  --validator $VALIDATOR_ADDRESS \<br>  --amount 5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1EtaoSQdgQJFXDQS_oLvaA.png" /></figure><p>The countdown starts from epoch 816 and you will be able to withdraw them after 6 epochs.</p><p>To check actual unbond status execute</p><pre>namada client bonds --owner $ACCOUNT_KEY_1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7K6frGedxF8QAwGJPq7ltw.png" /></figure><p>Once the time comes you can run the following command to make your tokens liquid</p><pre>namada client withdraw \<br>  --source $ACCOUNT_KEY_1 \<br>  --validator $VALIDATOR_ADDRESS</pre><p>Keep in mind, you cannot use your shielded address to bond. But let’s try it, just in case.</p><pre>namadac bond \<br> --validator $VALIDATOR_ADDRESS \<br> --amount 3 \<br> --source $PAYMENT_ADDRESS_1</pre><p>or from your spending key</p><pre>namadac bond \<br> --validator $VALIDATOR_ADDRESS \<br> --amount 3 \<br> --source $SPENDING_KEY_1</pre><p>Nope, no chance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XCy2DG41VIQ4esR5SXoe1A.png" /></figure><p>To learn more about governance, delagating and validating checkout out the official <a href="https://docs.namada.net/operators/validators/staking">docs</a> and ask questions in friendly discord <a href="https://discord.gg/rcBMZjRf">channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edf938358fa0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Namada tinkerer notes]]></title>
            <link>https://medium.com/coinmonks/namada-tinkerer-notes-4405a6e65b5f?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4405a6e65b5f</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[cosmos-network]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[namada]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Sun, 26 Nov 2023 15:36:40 GMT</pubDate>
            <atom:updated>2023-11-28T23:33:12.286Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hnhio-ID74DrEnRlq07hxg.jpeg" /><figcaption>It’s tinkering time</figcaption></figure><p>This tutorial is for those who want to tinker with namada and understand some if it core features like operations with transparent and multisig accounts, as well as shielded transfers. I’m using <a href="https://knowabl.notion.site/From-scratch-to-syncing-in-10-minutes-c0a56b34cdec447fbe2a5cd8f559f0bb">campfire</a> dev chain for this guide and assume that you have already built or downloaded namada binaries and your node is synced and running. If your node is not up try <a href="https://github.com/0x2pilot/namada/tree/main/node-installation">this</a> or campfire <a href="https://knowabl.notion.site/From-scratch-to-syncing-in-10-minutes-c0a56b34cdec447fbe2a5cd8f559f0bb">guide</a> to set it up.</p><h4>What’s namada</h4><p>Namada is cosmos and ethereum compatible L1 blockchain that provides a privacy layer via multi-asset shielded pool (MASP).</p><p>You can transfer your assets to MASP from one wallet and withdraw to another. This way you achieve effect similar to when you withdraw from CEX, but without sacrificing your data to any third party.</p><p>One cool thing about MASP is that it can support any kind of token: fungible and non-fungible. So if you send your NFT to a shielded pool where only eth tokens where stored, for the outside world your nft transfers within MASP will be indistinguishable from any other transactions.</p><p>The other cool thing is that not only you protect your privacy with Namada you also get rewards by shielding and storing your funds in MASP.</p><p>Namada is also much more, but we’ll focus on the basics here.</p><h4>Transparent accounts</h4><p>Before we start, we need to create 2 accounts which we will use during this whole article. And the only thing we need is to come up with the names…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*ZEDea1zUk7FMTIbp1ORTFg.jpeg" /><figcaption>You thinking what I’m thinking ?</figcaption></figure><p>Let’s export all necessary variables to reuse them later</p><pre>export ACCOUNT_KEY_1=&quot;B1&quot; &amp;&amp; \<br>export ACCOUNT_KEY_2=&quot;B2&quot; &amp;&amp; \<br>export MULTISIG_ADDRESS=banana-bro-power &amp;&amp; \<br>export SPENDING_KEY_1=$ACCOUNT_KEY_1-spending-key &amp;&amp; \<br>export SPENDING_KEY_2=$ACCOUNT_KEY_2-spending-key &amp;&amp; \<br>export PAYMENT_ADDRESS_1=$ACCOUNT_KEY_1-payment-address &amp;&amp; \<br>export PAYMENT_ADDRESS_2=$ACCOUNT_KEY_2-payment-address &amp;&amp; \<br>export RPC=&quot;localhost:26657&quot; &amp;&amp; \<br>export BASE_DIR=&quot;$HOME/.local/share/namada&quot; &amp;&amp; \<br>export TOKEN=NAM</pre><p>Don’t worry about too much variables at the moment. We will tackle them one by one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*R-sjV5E9C0pSwRAXCL4uvw.jpeg" /><figcaption>I’m fine</figcaption></figure><p>At the top export ACCOUNT_KEY_1=”B1&quot; &amp;&amp; export ACCOUNT_KEY_2=”B2&quot; are the account names we are going to use. At the bottom export RPC=”localhost:26657&quot; is the default rpc address. Note that you can use different host and port depending on your node configuration. You can also use some publicly available RPC and in that case you don’t to set up your node at all.</p><p>export BASE_DIR=”$HOME/.local/share/namada” is the default dir with configuration for namada node</p><p>export TOKEN=NAM — is the name of the token we are going to use</p><p>The rest of the variables will be described and used later.</p><p>To create our account keys</p><pre>namada wallet key gen --alias $ACCOUNT_KEY_1</pre><p>During the process you will get the following prompt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkAEzZvAxL1JThZRm5UxJw.png" /></figure><p>You would need to come up with your encryption password which you will need every time you perform a transaction with this account and you need to remember the 24 words mnemonic phrase was given to you to be able to restore your account.</p><p>Let’s create the second account</p><pre>namada wallet key gen --alias $ACCOUNT_KEY_2</pre><p>You can view your accounts by running namada wallet key listand the output will be</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nO7p6PhovCOuu6gNMf5B6w.png" /></figure><p>Each account has associated address with it. To view it run namada wallet address list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z47es5CdgTJiPBXoaH34ag.png" /></figure><p>You might see a bigger list of addresses, just make sure you didn’t loose your banana addresses.</p><p>What we just created is called <strong>implicit</strong> account. You don’t need initialize them on chain and can send any tokens to the corresponding tnam address straight away.</p><p>You can also check your implicit account balance by running</p><pre>namada --base-dir $BASE_DIR client balance \<br>--ledger-address $RPC \<br>--token $TOKEN \<br>--owner $ACCOUNT_KEY_1</pre><p>Right now it is empty</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jsn74PJoWGki9upTkQemdA.png" /></figure><p>But after funding it with the help of a faucet or your fellow comrades from <a href="https://discord.gg/TVSHDAXg">discord</a> it should look something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N2iZuPfIAPjdwNhYD9ISWg.png" /></figure><p>Let’s share some tokens with your BFF B2 by performing transfer transaction</p><pre>namada --base-dir $BASE_DIR client transfer \<br>--source $ACCOUNT_KEY_1 \<br>--target $ACCOUNT_KEY_2 \<br>--token $TOKEN \<br>--amount 10 \<br>--ledger-address $RPC \<br>--signing-keys $ACCOUNT_KEY_1</pre><p>You will be asked to enter your passphrase which you provided when creating b1 account to decrypt first account and you will see the following output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ShzcQcYJH_stTv5CB0iwfA.png" /></figure><p>Let’s check our updated balances</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SxJ4GafcYXshQDwhmMslew.png" /></figure><p>Cool, now B2 is closer to bying it’s dream car. Or at least a toy car…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EG75j2VEFdhnaw90.jpg" /><figcaption>The car B2 deserves but not the one it needs</figcaption></figure><p>Note that first account was deducted more than 10 nam, to cover transaction gas fees. To check how much you will pay you can ad --dry-run-wrapper flag at the end of transfer command</p><pre>namadac transfer \<br>  --source $ACCOUNT_KEY_1 \<br>  --target $ACCOUNT_KEY_2 \<br>  --token NAM \<br>  --amount 1 \<br>  --signing-keys $ACCOUNT_KEY_1 \<br>  --dry-run-wrapper</pre><p>From the output bellow you can see that 7616 gas is required for this transaction</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G5wd49LHATEpqI38WxY6EA.png" /></figure><p>Next we can specify gas limit for this transaction. It could be useful if your account is low on budget and the default gas limit will be too much for your balance. Just keep in mind, if you specify gas limit less than is actually required your transaction will be reverted and you will still pay partial gas fees.</p><pre>namadac transfer \<br>  --source $ACCOUNT_KEY_1 \<br>  --target $ACCOUNT_KEY_2 \<br>  --token NAM \<br>  --amount 1 \<br>  --signing-keys $ACCOUNT_KEY_1 \<br>  --gas-limit 7616</pre><h4>Multisignature accounts</h4><p>Namada also supports multisignature accounts which is a variation of a transparent account that gives you better security and recovery options. To create multisig account</p><pre>namadac init-account \<br>--alias $MULTISIG_ADDRESS \<br>--public-keys $ACCOUNT_KEY_1,$ACCOUNT_KEY_2 \<br>--signing-keys $ACCOUNT_KEY_1,$ACCOUNT_KEY_2 \<br>--gas-payer $ACCOUNT_KEY_1 \<br>--threshold 2</pre><p>Let’s make sure we have newly created address by typing</p><pre>namada wallet address list</pre><p>and indeed we have it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tnY1T60fw7ksrIesXw9V-A.png" /></figure><p>You might have noticed that this account has a different type —<strong>established</strong>. We created it with init transaction and tnam address was generated on chain. Before init transaction finishes, address is not known by anyone.</p><p>This address will have all the features standard addresses have. Let’s verify that by transfering some tokens into it.</p><pre>namada --base-dir $BASE_DIR client transfer \<br>--source $ACCOUNT_KEY_1 \<br>--target $MULTISIG_ADDRESS \<br>--token NAM \<br>--amount 5 \<br>--ledger-address $RPC \<br>--signing-keys $ACCOUNT_KEY_1</pre><p>And confirm it now has a positive balance by running</p><pre>namada --base-dir $BASE_DIR client balance \<br>--ledger-address $RPC \<br>--token $TOKEN \<br>--owner $MULTISIG_ADDRESS</pre><p>Now, if it behaves like a standard account, what’s the catch ? The difference comes into place when we need to sign and submit any transaction from it. We cannot send tx straight away like we did with standard account. We need approval of both keys ( in our case B1 and B2 ) that participated in multisig address creation. This provides better security to your account, because if one of the source keys was compromised, it won’t be possible to drain your funds without second key approval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*zEiD3ICWuNphVc_J.png" /><figcaption>Together. Stronger.</figcaption></figure><p>To do this, first we need to generate transaction data and save it to a file. Lets create a folder for transaction data</p><pre>mkdir tx_dumps</pre><p>save tx data into file</p><pre>namadac transfer \<br>--source $MULTISIG_ADDRESS \<br>--target $ACCOUNT_KEY_2 \<br>--token NAM \<br>--amount 4 \<br>--signing-keys $ACCOUNT_KEY_1,$ACCOUNT_KEY_2 \<br>--gas-payer $ACCOUNT_KEY_1 \<br>--dump-tx \<br>--output-folder-path tx_dumps</pre><p>in my case the following file was generated, but in your case name will be different</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Un6Wp0hOlvVShr-QXklbRQ.png" /></figure><p>Let’s export tx data file path into variable ( but keep in mind your filename will be different )</p><pre>export TX_PATH=&quot;tx_dumps/8DE73F0F6DC401C96A6867B45BF00F404CC0B28EB4DFF1B45CCC1A0F795DEA7A.tx&quot;</pre><p>and sign tx data with 2 keys</p><pre><br>namadac sign-tx \<br>--tx-path $TX_PATH \<br>--signing-keys $ACCOUNT_KEY_1 \<br>--owner $MULTISIG_ADDRESS &amp;&amp; \<br>namadac sign-tx \<br>--tx-path $TX_PATH \<br>--signing-keys $ACCOUNT_KEY_2 \<br>--owner $MULTISIG_ADDRESS</pre><p>This will output for you two signatures ( I’ve highlighted the first one )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nT2neb7MMPKWgiTS7dIuTQ.png" /></figure><p>which you will use next to send the transaction ( remember to update signature values for your own ones )</p><pre>namadac tx \<br>--tx-path $TX_PATH \<br>--signatures offline_signature_8DE73F0F6DC401C96A6867B45BF00F404CC0B28EB4DFF1B45CCC1A0F795DEA7A_tpknam1qzatwwvlsda4k8zlzemu343lzq6aktgc9v2fxlvpd7pcz3x036f0k5arv0j.tx \<br>--signatures offline_signature_8DE73F0F6DC401C96A6867B45BF00F404CC0B28EB4DFF1B45CCC1A0F795DEA7A_tpknam1qq6u9v9x28063djep2c2jsk6luh66pxrnz4x7nsc5zg442a0whzv7y5zvd3.tx \<br>--owner $MULTISIG_ADDRESS \<br>--gas-payer $ACCOUNT_KEY_1</pre><p>Cool. Now your b2 account now has 4 extra NAM tokens.</p><h3>Shielded accounts</h3><p>Have you ever had this feeling that someone is watching all your wallet transactions and knows everything about your financial situation ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*KfNLaK6qJcHlWuCL" /><figcaption>Somebody’s watching me</figcaption></figure><p>We all do. But fret not, it’ll be fixed in a moment.</p><p>First let’s generate spending keys</p><pre>namadaw masp gen-key --alias $SPENDING_KEY_1 &amp;&amp; \<br>namadaw masp gen-key --alias $SPENDING_KEY_2</pre><p>Next let’s generate payment address.</p><pre>namadaw masp gen-addr \<br>    --key $SPENDING_KEY_1 \<br>    --alias $PAYMENT_ADDRESS_1 &amp;&amp; \<br>namadaw masp gen-addr \<br>    --key $SPENDING_KEY_2 \<br>    --alias $PAYMENT_ADDRESS_2</pre><p>Spending key allows to you to spend and view balance of the corresponding shielded address ( SPENDING_KEY_1 for PAYMENT_ADDRESS_1 and SPENDING_KEY_2 for PAYMENT_ADDRESS_2 ). Every time you execute gen-addr with the same spending key you will get new shielded address. It could be reused or discarded and there is no relationship between those addresses. That’s a great way disguise your transaction history !</p><p>To view masp keys and addresses we can use</p><pre>namadaw masp list-keys </pre><p>and</p><pre>namadaw masp list-addrs</pre><p>The output will be</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3z0Jp3Gz8QBCxau_cd3_QA.png" /></figure><p>Let’s shield your assets now by transfering some of NAM tokens to the shielded address</p><pre>namadac transfer \<br>    --source $ACCOUNT_KEY_1 \<br>    --target $PAYMENT_ADDRESS_1 \<br>    --token NAM \<br>    --amount 2</pre><p>Check your shielded balance</p><pre>namadac balance --owner $SPENDING_KEY_1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EuiUKHnprjJ-svOa2Y6csg.png" /></figure><p>Note that we are using SPENDING_KEY_1 to view the balance. Only shielded address owner can do it. From now on all your transactions will be hidden for unwanted observers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*FYHvqLOw-odnMb3uu6Fepw.jpeg" /><figcaption>Your tx history inside MASP</figcaption></figure><p>No one is watching you and your transactions inside MASP are untraceable. For example let’s perform shielded transfer to your second payment address</p><pre>namadac transfer \<br>    --source $SPENDING_KEY_1 \<br>    --target $PAYMENT_ADDRESS_2 \<br>    --token NAM \<br>    --amount 1 \<br>    --signing-keys $ACCOUNT_KEY_1</pre><p>check balance is updated</p><pre>namadac balance --owner $SPENDING_KEY_2</pre><p>output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0btHymJbYHsbklR0SqKnw.png" /><figcaption>Your balance at epoch 328</figcaption></figure><p>You will also get rewards for storing your assets in shielded pool every new epoch. The longer you stay —the more profit you’ll get !</p><p>When you feel it’s time to leave your safe harbor just unshield you funds and go see the bigger world.</p><pre>namadac transfer \<br>    --source $SPENDING_KEY_2 \<br>    --target $ACCOUNT_KEY_2 \<br>    --token NAM \<br>    --amount 0.5 \<br>    --signing-keys $ACCOUNT_KEY_2</pre><p>Just keep in mind that from now on you are operating with transparent address and you history is recorded. You can tranfer to a new wallet without any history and start from scratch though.</p><p>Let’s try one last thing…</p><p>Last time, when we made unshielded transfer, B2 account covered our gas fees. What if all our NAM tokens were in MASP to receive shielded pool rewards and B2 address didn’t have any NAM tokens. It is possible to pay the fees with MASP from your shielded address without the need to unshield them</p><p>Let’s check our account balance</p><pre>namadac balance --owner $ACCOUNT_KEY_2</pre><p>In my case it was 15.95 NAM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3o3SdVrotu3OqBo7eIREjg.png" /></figure><p>Try transfer full b2 balance to b1</p><pre>namadac transfer \<br>  --source $ACCOUNT_KEY_2 \<br>  --target $ACCOUNT_KEY_1 \<br>  --token NAM \<br>  --amount 15.95 \<br>  --gas-payer $ACCOUNT_KEY_2</pre><p>Transaction will be reverted as you do not have enough NAM tokens to send after applying gas fees. Now your balance is reduced, but you haven’t send your tokens</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*23NWejkHdYvcjsERZ6l6wA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*mAuYUs43AMcVsKDzOmIBHA.jpeg" /><figcaption>Farewell to gas fees spent for nothing</figcaption></figure><p>Transfer full amount again, but use spending key from your shielded address with balance</p><pre>namadac transfer \<br>  --source $ACCOUNT_KEY_2 \<br>  --target $ACCOUNT_KEY_1 \<br>  --token NAM \<br>  --amount 15.925 \<br>  --gas-payer $ACCOUNT_KEY_2 \<br>  --gas-spending-key $SPENDING_KEY_1</pre><p>Now you transfered full balance from b2 to b1 and payed for gas fees using spending key. Keep in mind that tokens required to cover gas fees will be unshielded from shielded address and transfered to gas payer account ( B2 in our case ), so you’ll pay a little bit more.</p><p>If you want to disguise a gas payer you can use--disposable-gas-payer flag</p><pre>namadac transfer \<br>  --source $ACCOUNT_KEY_2 \<br>  --target $ACCOUNT_KEY_1 \<br>  --token NAM \<br>  --amount 15.925 \<br>  --gas-spending-key $SPENDING_KEY_1 \<br>  --disposable-gas-payer</pre><p>which will generate a disposable transparent address that will cover gas fees.</p><p>Imagine a universe where</p><ul><li>Individuals have the freedom to decide which information they wish to share with the public and what they prefer to keep private</li><li>Usage of privacy is rewarded as a public good</li></ul><p>Namada is a portal to such place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qYa92gzFmlJp4XI-e0YYbg.png" /><figcaption>Happy travels</figcaption></figure><p>See you in <a href="https://medium.com/@stanisloe/namada-tinkerer-notes-part-2-edf938358fa0">part 2 </a>where we discuss governance, staking and delegation rewards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4405a6e65b5f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/namada-tinkerer-notes-4405a6e65b5f">Namada tinkerer notes</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[Security best practices for a cosmos validator]]></title>
            <link>https://medium.com/coinmonks/security-best-practices-for-a-cosmos-validator-78f17c49c66c?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/78f17c49c66c</guid>
            <category><![CDATA[cosmos-network]]></category>
            <category><![CDATA[validator]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[tendermint]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Mon, 09 Oct 2023 23:33:54 GMT</pubDate>
            <atom:updated>2023-10-10T08:00:36.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUrOHRSP45SSSySv9bBiMw.png" /></figure><p><strong>General security memo</strong></p><ul><li>Do not manage your node from root. Use separate user for that</li><li>Use ssh keys instead of passwords and forbid root to ssh to your host</li><li>Log / ban unauthorized login attempts. Could be done with a tool like <a href="https://github.com/fail2ban/fail2ban">fail2ban</a></li><li>Keep your system and third-party libraries up to date with the latest security patches</li></ul><p><strong>Monitoring</strong></p><p>It is important to set up proper monitoring right from the start to avoid missing blocks and getting jailed. While there are many ways to configure the best monitoring system that fits your needs, let’s describe next what we are currently using on our daily basis.</p><p><a href="https://prometheus.io/docs/introduction/overview/">Prometheus</a> is a system montoring tool that collects metrics from your hosts and allows you build graphs and alarms based on them. Out of the box your cosmos node provides useful prometheus metrics like consensus height, validator missed blocks, mempool size and many more that could be found <a href="https://docs.tendermint.com/v0.34/tendermint-core/metrics.html">here</a>. <a href="https://github.com/prometheus/node_exporter">Node exporter</a> is an excellent tool to extract huge amount of metrics related to your host like cpu load, memory pressure, disk iops, network traffic etc.</p><p><a href="https://grafana.com/">Grafana</a> — allows you to build dashboards and alarms from many different dasources and prometheus is among of the supported data sources. Are you experiencing cpu spikes ? Is your disk about to run out of space ? Or maybe you need to understand for how long your server was not available to the internet. All that is very easy spot or prevent when you have proper dashboard configured.</p><p><a href="https://www.pagerduty.com/">PagerDuty </a>— incidient response tool across all your digital infrastructre. While you can foward your alarms to email / telegram / discord it is much better when you have dedicated tool that collects and groups your alarms by their severity, handles escalation to another person if the issue wasn’t resolved in time, provides automatic on-call rotation between your team members. You can also have different kind of alarms based on their severity to allow alarm to ignore “Do not disturb” mode and wake you up if it is an urgent matter.</p><p>Those are the basic tools that we use but here are some other services worth mentioning:</p><ul><li><a href="https://github.com/blockpane/tenderduty">Tenderduty</a> — monitoring for tendermint chains</li><li><a href="https://github.com/SimplyStaking/panic">Panic</a> — monitoring and alerting for blockchains</li><li><a href="https://github.com/solarlabsteam/cosmos-exporter">Cosmos-exporter</a> — if you need more metrics that are available from the default tendermin exporter</li></ul><p><strong>Ports</strong></p><p>Use principle of least privilege when considering which ports to open at your validator node. Ideally you only need p2p port open ( 26656 ) by default. The rest could be blocked in your node config files:</p><pre><br># disable rpc port<br># ~/.project/config/config.toml<br>[rpc]<br>laddr = &quot;tcp://127.0.0.1:26657&quot;<br>cors_allowed_origins = []<br><br><br># disable rpc port<br># ~/.project/config/app.toml<br>[grpc]<br>enable = false<br>address = &quot;0.0.0.0:9090&quot;<br>[grpc-web]<br>enable = false<br>address = &quot;0.0.0.0:9091&quot;<br><br><br># disable json-rpc port ( only for evm compatibale chains like zetachain or haqq )<br># ~/.project/config/app.toml<br>[json-rpc]<br>enable = false<br>address = &quot;0.0.0.0:10545&quot;<br>ws-address = &quot;0.0.0.0:8546&quot;<br><br><br># disable api ( lcd = api = rest )<br># ~/.project/config/app.toml<br>[api]<br>enable = false<br>swagger = false<br>address = &quot;tcp://0.0.0.0:1317&quot;<br></pre><p>or via firewall. When using firewall keep in mind that you also need to whitelist your ssh port also ( 22 any custom port you have )</p><p>Check out this <a href="https://github.com/stanisloe/public_rpc_locator">example</a> on how easy it is to find validators with rpc port opened. Opening RPC/GRPC port for a node that isn&#39;t optimized for heavy query workloads can lead to it going offline after just a few demanding requests. This makes attacker`s life much easier.</p><p><strong>DDoS</strong></p><p>Even if you properly closed all non mandotory ports for validation it is possible to spam your host through p2p port and make it inoperative for the duration of the attack. To avoid this you can setup your validator node to only communicate with a set of trusted sentry nodes via direct link and make it inaccessible to the outside world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/0*lbi_yrEkuXFKDFxt.png" /><figcaption>Source — <a href="https://forum.cosmos.network/t/sentry-node-architecture-overview/454">https://forum.cosmos.network/t/sentry-node-architecture-overview/454</a></figcaption></figure><p>This way it is impossible to spam your validator, only it’s sentry nodes. But is should be very easy to scale / change them in case of such attack.</p><p>Keeping all the unneccesary ports closed and your validator ip hidden is very important to avoid slashing penalties and reduce risk for the network since having multiple nodes down at the same time is bad for network stability.</p><p><strong>Key protection</strong></p><p>TMKMS — tendermint key management system. This is a separate process which extracts signing logic from your validator node and can run separately from your validator host. It is also very easy to plug in various signing mechanisms like:</p><ul><li><a href="https://github.com/iqlusioninc/tmkms/blob/main/README.fortanixdsm.md">FortanixDSM</a></li><li><a href="https://github.com/iqlusioninc/tmkms/blob/main/README.yubihsm.md">YubiHSM2</a></li><li><a href="https://www.ledger.com/">Ledger</a></li></ul><p>All of those options will protect your private key when your host was compromised.</p><p>Horcrux — a multi-party-computation (MPC) signing service for tendermint nodes. It allows you split your key into parts and store each part on a separate host. You can configure how many key parts is required to collect your private key signature. For example it could be 2 parts out of 3 total. This means that in order to compromise your private key, attacker needs to get access to 2 of your hosts.</p><p>More info about how to setup horcrux and tmkms could be found in our previous articles</p><ul><li><a href="https://medium.com/@stanisloe/tmkms-with-quark-1-neutron-testnet-c361398ce964">TMKMS with quark-1 (neutron) testnet</a></li><li><a href="https://github.com/strangelove-ventures/horcrux/blob/main/docs/signing.md">horcrux/docs/signing.md at main · strangelove-ventures/horcrux</a></li></ul><p><strong>Double sign prevention</strong></p><p>double_sign_check_height — when set in config.toml to some non zero value like 5 / 10 / 15 your validator node after restart will panik if it participated in consensus in the last 5 / 10 / 15 blocks. This will help to avoid double sign in many cases, for example on migration when old process wasn’t killed properly. While it doesn’t give you 100% double sign prevention it is still covering a lot of unexpected use cases. The only downside is that your node need to always skip configured amount of blocks after restart. This will require some additional configuration if you are using cosmovisor for upgrades.</p><p>While double_sign_check_height is a great option to have it is not recommended to solely rely on it when it comes to double sign prevention. TMKMS and Horcrux modules discussed previously provide more advanced double sign prevention mechanisms.</p><p>While this article is far from a comprehensive security manual it should give you a good starting point to protect your validator from major threats thats out there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78f17c49c66c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/security-best-practices-for-a-cosmos-validator-78f17c49c66c">Security best practices for a cosmos validator</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[Zetachain — deploy and interact with your own omnichain contract]]></title>
            <link>https://medium.com/coinmonks/zetachain-deploy-and-interact-with-your-own-omnichain-contract-8f36acdcbd48?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f36acdcbd48</guid>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[zetachain]]></category>
            <category><![CDATA[zetachain-testnet]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Tue, 01 Aug 2023 21:30:55 GMT</pubDate>
            <atom:updated>2023-08-03T15:03:33.843Z</atom:updated>
            <content:encoded><![CDATA[<h3>Zetachain — deploy and interact with your own omnichain contract</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwp_aMNl8fX_MTuUjIHBAA.png" /></figure><p>Zetachain is a PoS blockchain developed using the Cosmos SDK that hosts Ethereum Virtual Machine (zEVM) which is capable of running omnichain smartcontracts. Those contracts allow you to execute transactions from any supported source to destination networks. Let’s explore how this is done in practice</p><p>Download or clone example repository from github</p><pre>https://github.com/stanisloe/zetachain-swap-example.git</pre><p>Navigate to the folder and you should see the following structure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*irH72_YO3aNRcXVgLD0IqA.png" /><figcaption>Project structure</figcaption></figure><p>I’ve highlighted core files that we’ll go through to better understand what is happening here:</p><ol><li>hardhat.config.ts: This is the configuration file for the Ethereum development environment called <a href="https://hardhat.org/">Hardhat</a>. It allows you to easily deploy and interact with smart contracts using JavaScript code. If you were to do it from scratch, you would need to configure RPC providers, chain settings, etc. However, in this example, everything is already pre-configured for you, so you don&#39;t need to add anything there.</li><li>.env file ( it won’t be in the downloaded project, but we will create it later ): This is where you will insert your EVM account private key, which Hardhat will use for contract deployment and interaction. Please ensure that this account has some native tokens to cover gas costs.</li><li>tasks/deploy.ts and tasks/interact.ts: These are Hardhat tasks for deploying and interacting with the Swap.sol smart contract. Later, you&#39;ll execute commands to trigger those tasks.</li><li>Swap.sol file: This contains the Ethereum Virtual Machine (EVM) compatible smart contract code that will perform cross-chain swap transactions.</li></ol><p>Now, let’s prepare our environment for contract deployment.</p><p>First, let’s install npm and Node.js if you haven’t done so already. You can follow any of the following guides:</p><ul><li><a href="https://radixweb.com/blog/installing-npm-and-nodejs-on-windows-and-mac">How to Install NPM and Node.js on Windows and Mac Devices?</a></li><li><a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm">Downloading and installing Node.js and npm | npm Docs</a></li></ul><p>After this is done let’s navigate to downloaded example repository in the command line and run</p><pre>npm install yarn &amp;&amp; yarn &amp;&amp; yarn add --dev @uniswap/v2-periphery @uniswap/v2-core</pre><p>Next, you’ll need to create a file named .env in the project directory and place the private key from an account that holds Matic Mumbai testnet tokens.</p><pre>PRIVATE_KEY=&lt;your private key here&gt;</pre><p>Run</p><pre>npx hardhat balances</pre><p>and you should see similar output</p><pre>EVM: 0xA72745c17596E4Bd4E4424e8d827176087F5870a<br>BTC: tb1qgxuumr0ctan0x4u8jthcw4gvxz0q5pfhemyazs<br><br>┌─────────┬──────────────────┬────────┬─────────┬───────┐<br>│ (index) │   networkName    │ native │  zeta   │ zrc20 │<br>├─────────┼──────────────────┼────────┼─────────┼───────┤<br>│    0    │ &#39;mumbai_testnet&#39; │ &#39;0.58&#39; │ &#39;57.00&#39; │       │<br>│    1    │  &#39;zeta_testnet&#39;  │ &#39;5.82&#39; │ &#39;0.00&#39;  │  &#39;&#39;   │<br>│    2    │  &#39;bsc_testnet&#39;   │ &#39;0.10&#39; │ &#39;0.98&#39;  │       │<br>│    3    │ &#39;goerli_testnet&#39; │ &#39;0.16&#39; │ &#39;30.00&#39; │       │<br>│    4    │  &#39;btc_testnet&#39;   │  &#39;0&#39;   │         │       │<br>└─────────┴──────────────────┴────────┴─────────┴───────┘</pre><p>Pay attention to your Mumbai and Goerli native balances. If you don’t have matic tokens request them <a href="https://faucet.polygon.technology/">here</a>.</p><p>Next compile smart contracts</p><pre>npx hardhat compile --force</pre><p>Once everything is compiled we are ready to deploy our contract by running:</p><pre>npx hardhat deploy --network zeta_testnet</pre><p>Note the naming for the deploy task — it’s the same as the task file tasks/deploy.ts we discussed previously. interact task will be called in a similar manner later, but with different arguements.</p><p>You should see similar output with your account and contract addresses. They will be different from mine.</p><pre><br>🔑 Using account: 0xA72745c17596E4Bd4E4424e8d827176087F5870a<br><br>🚀 Successfully deployed contract on ZetaChain.<br>📜 Contract address: 0xFAfE767BB2AbC2B68AE4466FCcbd8afc9d1B7079<br>🌍 Explorer: https://athens3.explorer.zetachain.com/address/0xFAfE767BB2AbC2B68AE4466FCcbd8afc9d1B7079</pre><p>Once the contract is deployed it’s time to interact with it. Run the following command</p><pre>npx hardhat interact --contract 0xFAfE767BB2AbC2B68AE4466FCcbd8afc9d1B7079 --amount 0.2 --network mumbai_testnet --destination goerli_testnet --recipient 0xA72745c17596E4Bd4E4424e8d827176087F5870a</pre><p>Note that you need to replace contract and recipient arguments. You should see the following output after few minutes</p><pre><br>🔑 Using account: 0xA72745c17596E4Bd4E4424e8d827176087F5870a<br><br><br>🚀 Successfully broadcasted a token transfer transaction on mumbai_testnet network.<br>📝 Transaction hash: 0x6a85f07eef914ddd7eae76355e9d6c12e4d72082f22bbedcbfee56ccfadf5a84<br><br>✔ CCTX hash found: 0xabd5a19e33a772086680403028a2a0a4bd528321e64755eb5c9b84c89641754c<br><br>ℹ Status updated to &quot;OutboundMined&quot;: Remote omnichain contract call completed<br><br>✔ CCTX has been finalized on ZetaChain</pre><p>Let’s inspect what was done byinteract task and it’s output in more detail.</p><p>Transaction hash</p><pre>📝 Transaction hash: 0x6a85f07eef914ddd7eae76355e9d6c12e4d72082f22bbedcbfee56ccfadf5a84</pre><p>corresponds to a transfer made from your mumbai test network account to zetachain account on mumbai blockchain called the TSS ( Threshold Signature Scheme ) On every connected network there is such TSS ( actuall addresses for supported chains could be found <a href="https://www.zetachain.com/docs/reference/testnet/">here</a> ) owned by zetachain team. Typically, you’ll send some tokens and metadata about your desired actions with those tokens to the TSS. In this exeample you have send 0.2 matic tokens and told zetachain to withdraw what is left after fees to your wallet in goerli network.</p><p>By sending this Mumbai blockchain transaction you have triggered transaction on the Zetachain blockchain, known as a cross-chain transaction (CCTX), which you can find in the output as well.</p><pre>✔ CCTX hash found: 0xabd5a19e33a772086680403028a2a0a4bd528321e64755eb5c9b84c89641754c</pre><p>Now lets investigate it a little bit further. Navigate to ( don’t forget to use your CCTX hash in explorer )</p><pre>https://athens3.explorer.zetachain.com/cc/tx/0xabd5a19e33a772086680403028a2a0a4bd528321e64755eb5c9b84c89641754c</pre><p>to explore this CCTX in detail. You should see the following screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfcW5jdeJYnQYUnMNTg5SQ.png" /><figcaption>CCTX example</figcaption></figure><p>From it you should be able to see how your omnichain swap was performed:</p><ol><li>This your initial transaction on polygon mumbai blockchain where you interacted with TSS and sent your tokens with metadata about recipient and destination chain</li><li>This is another CCTX on zetachain that will initiate tokens withdrawal from goerli TSS to recipient account</li><li>Deposit transaction hash on destination network</li></ol><p>After some time, when zetachain processes your transaction, you will receive tokens in your destination network</p><p>To check the balance</p><pre>npx hardhat balances</pre><p>Notice that goerli_testnet native value increased by 0.01 from the previous run. The rest was payed for the interchain transaction commission to zetachain protocol.</p><pre>EVM: 0xA72745c17596E4Bd4E4424e8d827176087F5870a<br>BTC: tb1qgxuumr0ctan0x4u8jthcw4gvxz0q5pfhemyazs<br><br>┌─────────┬──────────────────┬────────┬─────────┬───────┐<br>│ (index) │   networkName    │ native │  zeta   │ zrc20 │<br>├─────────┼──────────────────┼────────┼─────────┼───────┤<br>│    0    │ &#39;mumbai_testnet&#39; │ &#39;0.38&#39; │ &#39;57.00&#39; │       │<br>│    1    │  &#39;zeta_testnet&#39;  │ &#39;5.82&#39; │ &#39;0.00&#39;  │  &#39;&#39;   │<br>│    2    │  &#39;bsc_testnet&#39;   │ &#39;0.10&#39; │ &#39;0.98&#39;  │       │<br>│    3    │ &#39;goerli_testnet&#39; │ &#39;0.17&#39; │ &#39;30.00&#39; │       │<br>│    4    │  &#39;btc_testnet&#39;   │  &#39;0&#39;   │         │       │<br>└─────────┴──────────────────┴────────┴─────────┴───────┘</pre><p>And that’s it. By simply running</p><pre>npx hardhat deploy --network zeta_testnet</pre><p>you have deployed your own smart contract that is reusing audited and battle-tested uniswap code base. You do not need to implement all the complex multichain swap logic from scratch.</p><p>And by running</p><pre>npx hardhat interact --contract 0xFAfE767BB2AbC2B68AE4466FCcbd8afc9d1B7079 --amount 0.2 --network mumbai_testnet --destination goerli_testnet --recipient 0xA72745c17596E4Bd4E4424e8d827176087F5870a</pre><p>you’ve bridged your native mumbai polygon tokens to goerli eth tokens.</p><p>One cool feature of omnichain contracts is that they eliminate the need for smart contracts on both source and destination networks. Smart contracts are only deployed on Zetachain. To initiate a cross-chain transaction, you simply send data to the TSS address on the supported source chain. The advantage of TSS being just an account is that it enables the triggering of smart contracts even on chains like Bitcoin/Dogecoin, which lack the capacity or efficiency to support general-purpose smart contracts.</p><p>Feel free to explore more from the official <a href="https://www.zetachain.com/docs/developers/omnichain/overview/">docs</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f36acdcbd48" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/zetachain-deploy-and-interact-with-your-own-omnichain-contract-8f36acdcbd48">Zetachain — deploy and interact with your own omnichain contract</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[Near mainnet onboarding]]></title>
            <link>https://medium.com/@stanisloe/near-mainnet-onboarding-60e3febd5933?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/60e3febd5933</guid>
            <category><![CDATA[mainnet]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[near-protocol]]></category>
            <category><![CDATA[validator]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Mon, 22 May 2023 11:43:02 GMT</pubDate>
            <atom:updated>2023-08-22T13:22:10.294Z</atom:updated>
            <content:encoded><![CDATA[<p>Install near cli and necessary dependencies</p><pre>sudo apt update &amp;&amp; sudo apt upgrade -y &amp;&amp; \<br>curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - &amp;&amp; \<br>sudo apt install build-essential nodejs -y &amp;&amp; \<br>PATH=&quot;$PATH&quot; &amp;&amp; sudo npm install -g near-cli &amp;&amp; \<br>echo &#39;export NEAR_ENV=mainnet&#39; &gt;&gt; ~/.bashrc &amp;&amp; \<br>echo &#39;export NEAR_ENV=mainnet&#39; &gt;&gt; ~/.bash_profile &amp;&amp; \<br>source $HOME/.bash_profile</pre><p>Check cli is working</p><pre>near proposals</pre><p>Install near node dependencies</p><pre>sudo apt install -y git binutils-dev libcurl4-openssl-dev zlib1g-dev \<br>libdw-dev libiberty-dev cmake gcc g++ python3 docker.io protobuf-compiler \<br>libssl-dev pkg-config clang llvm cargo python3-pip clang build-essential \<br>make jq &amp;&amp; \<br>USER_BASE_BIN=$(python3 -m site --user-base)/bin &amp;&amp; \<br>export PATH=&quot;$USER_BASE_BIN:$PATH&quot; &amp;&amp; \<br>export RUSTUP_INIT_SKIP_PATH_CHECK=yes &amp;&amp; \<br>curl --proto &#39;=https&#39; --tlsv1.2 -sSf https://sh.rustup.rs | sh &amp;&amp; \<br>source $HOME/.cargo/env</pre><p>Check latest release ( not Pre-release ) <a href="https://github.com/near/nearcore/releases">here</a></p><pre>export NEAR_RELEASE_VERSION=&lt;latest release&gt;</pre><pre>git clone https://github.com/nearprotocol/nearcore.git &amp;&amp; \<br>cd nearcore &amp;&amp; \<br>git checkout $NEAR_RELEASE_VERSION &amp;&amp; \<br>make release &amp;&amp; \<br>target/release/neard init --chain-id=&quot;mainnet&quot;</pre><p>Login to wallet</p><pre>near login</pre><p>Download genesis and config</p><pre><br>cd ~/.near &amp;&amp; \<br>(rm genesis.json &amp;&amp; wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/genesis.json || wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/genesis.json) &amp;&amp; \<br>(rm config.json &amp;&amp; wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json || wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json)</pre><p>Install s5cmd for faster snapshot download</p><pre>wget -O s5cmd.tar.gz https://github.com/peak/s5cmd/releases/download/v2.0.0/s5cmd_2.0.0_Linux-64bit.tar.gz &amp;&amp; \<br>mkdir s5cmd &amp;&amp; \<br>tar -xf s5cmd.tar.gz -C s5cmd &amp;&amp; \<br>sudo mv s5cmd/s5cmd /usr/bin/ &amp;&amp;<br>rm -rf s5cmd s5cmd.tar.gz<br></pre><p>Download snapshot</p><pre>chain=&quot;mainnet&quot; &amp;&amp; \<br>kind=&quot;rpc&quot; &amp;&amp; \<br>s5cmd --no-sign-request cp &quot;s3://near-protocol-public/backups/$chain/$kind/latest&quot; . &amp;&amp; \<br>latest=$(cat latest) &amp;&amp; \<br>echo &quot;snapshot date: $latest&quot; &amp;&amp; \<br>s5cmd --no-sign-request cp &quot;s3://near-protocol-public/backups/$chain/$kind/$latest/*&quot; ~/.near/data<br></pre><p>Install and start service</p><pre>sudo printf &quot;[Unit]<br>Description=NEAR Daemon Service<br>[Service]<br>Type=simple<br>User=$(whoami)<br>#Group=near<br>WorkingDirectory=/home/$(whoami)/.near<br>ExecStart=/home/$(whoami)/nearcore/target/release/neard run<br>Restart=on-failure<br>RestartSec=30<br>KillSignal=SIGINT<br>TimeoutStopSec=45<br>KillMode=mixed<br>[Install]<br>WantedBy=multi-user.target&quot; | sudo tee &quot;/etc/systemd/system/neard.service&quot; &amp;&amp; \<br>sudo systemctl daemon-reload &amp;&amp; \<br>sudo systemctl restart neard &amp;&amp; \<br>journalctl -n 100 -f -u neard</pre><p>Add metrics export to prometheus.yml</p><pre>- job_name: &#39;near_node&#39;<br>  static_configs:<br>  - targets: [&#39;localhost:3030&#39;]</pre><h4>Swap keys with backup node</h4><p>Make sure you have folder with your node and validator keys</p><pre>mkdir keys_validator &amp;&amp; ls -lah keys_validator</pre><p><strong>Main node:</strong> stop main node and remove keys from it.</p><pre>sudo systemctl stop neard.service &amp;&amp; \<br>sudo systemctl disable neard &amp;&amp; \<br>shred -u .near/node_key.json &amp;&amp; \<br>shred -u .near/validator_key.json &amp;&amp; \<br>ls -lah .near &amp;&amp; \<br>sudo systemctl status neard.service</pre><p><strong>Backup node</strong>: stop the node and replace reserve keys with main validator keys:</p><pre>sudo systemctl stop neard.service &amp;&amp; \<br>cp keys_validator/node_key.json .near/ &amp;&amp; \<br>cp keys_validator/validator_key.json .near/ &amp;&amp; \<br>ls -lah .near &amp;&amp; \<br>sudo systemctl status neard.service</pre><p><strong>Backup node</strong>: start backup node with validator keys</p><pre>sudo systemctl start neard.service &amp;&amp; \<br>journalctl -u neard.service -fo cat</pre><p>Logs for validator node contain:</p><pre>INFO stats: #83542486 BadDrDkB1ens3vf1EJjxkUqfyg6YDhiZUDF4u5CqqEZV Validator | 100 validators 35 peers ⬇ 591 kB/s ⬆ 546 kB/s 0.80 bps 43.0 Tgas/s CPU: 31%, Mem: 11.6 GB</pre><p>Logs for normal node contain:</p><pre>INFO stats: #83542995 3ycG3dCy18nDSxhYr8SiKjLFBStL3DB1bnDXR24Bo7o7 100 validators 30 peers ⬇ 1.30 MB/s ⬆ 1.05 MB/s 0.80 bps 355 Tgas/s CPU: 142%, Mem: 7.16 GB</pre><p><strong>Main node:</strong> start main node as backup if required</p><pre>sudo systemctl start neard.service &amp;&amp; \<br>journalctl -u neard.service -fo cat</pre><h4>Start cron</h4><p>Download ping script</p><pre>mkdir scripts || true &amp;&amp; \<br>wget -O $HOME/scripts/ping.sh https://raw.githubusercontent.com/stanisloe/near-tools/main/mainnet/ping.sh &amp;&amp; \<br>chmod 777 $HOME/scripts/ping.sh</pre><p>Add output of this command to crontab</p><pre>echo &quot;0 */12 * * * sh $HOME/scripts/ping.sh&quot;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60e3febd5933" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OKP4 — the basics]]></title>
            <link>https://medium.com/@stanisloe/okp4-57999392c1e8?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/57999392c1e8</guid>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[okp4]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Sat, 31 Dec 2022 11:03:22 GMT</pubDate>
            <atom:updated>2022-12-31T11:15:55.759Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVgaDt0c6qgxc5RgX6TMBw.png" /></figure><h4><strong>Intro</strong></h4><p>Right now the majority of data about us and our environment is controlled by a small amount of giant tech companies that are leaders in their field. While this is a great source of information and knowledge it is only available to those companies and is used according to their interest. Some companies produce lots of data and they might want to monetize it, but currently it is difficult to do so for different reasons: lack of required infrastructure, absence of a trusted “data market” with established prices, compliance issues. OKP4 blockchain tries to fix that by creating an ecosystem where <strong>data providers</strong> can cooperate with <strong>data consumers</strong> by selling them data and their services. From this data, consumers will gain information and knowledge they seek in a decentralized way without any need of trusted third party.</p><blockquote>Data providers and consumers are the core actors in the OKP4 dataverse and I will be referring to them throughout this article.</blockquote><p>Let’s see how this works by taking a closer look at main layers of the OKP4 ecosystem and going through a simple example.</p><h4><strong>Blockchain layer</strong></h4><p>The backbone for the whole system. This is where all the decentralization magic will happen: transactions history will be stored, validators will sign blocks, delegators stake their tokens and receive rewards, smart contracts execute their logic, governance rules will be enforced and all required metadata for data space layer (described next) will be defined.</p><p>OKP4 blockchain is based on cosmos sdk due to it’s high adoption, lots of success cases with other blockchains already running it, much better protocol customization possibilities compared to layer 2 options and native cross chain communication support.</p><h4><strong>Data Space layer</strong></h4><p>Data space is the core concept of the OKP4 network. It is build on top of blockchain layer and is heavily using all the main blockchain features: decentralization, immutability, trackability etc… Every data space will have it’s own owner(s), permissions, rules, security mechanisms, price for using it’s data/services and possibly it’s own token for governance. It is important to understand that data space is not just the storage — it is a set of services like data, computation, authentication or algorithm providers that work together to give some meaningful information to the data consumer. But OKP4 not just one data space it can support any number of data spaces to serve their own purpose. The combination of all active data spaces and underlying services will form a dataverse, place where you can get any data you need and easily navigate through it with the help of OKP4 ecosystem.</p><h4><strong>Application layer</strong></h4><p>At this layer various applications will be presenting data extracted from the OKP4 dataverse in a meaningful way. From the end user point of view it could be a web 2 like application with a familiar ux and subscription based business model. But under the hood application will be a data consumer in the OKP4 chain — executing transactions, paying fees etc. This way the strongest parts of web 2 and web 3 worlds will be combined by providing smooth user experience of web 2 and decentralization of web 3.</p><h4><strong>Example</strong></h4><p>Let’s say we have a database of students and their grades. We also have a service that can perform basic operations with the list of students like filtering, sorting, merging etc. Most likely the information we can get from this data will be useful for parents of students and university staff. Let’s create a data space, so that data consumers will be able to get some new insights about students in an OKP4 way.</p><p>First we give it a name and a meaningful description. Something like “Student Space” should work.</p><p>Next we need to define what services we have and what we can do with them. As described above, we have a database that can return a list of students and an algorithm that can accept a list of students and return a modified list according to filtering criteria. For the data consumers those services will be available as a steps, which they can combine in any way to receive a meaningful information. One possible scenario would be to get a list of students with high and low grades to ask students with high grades to help students with low grades to improve their performance. To do this, data consumer might submit a query to the OKP4 blockchain with the steps like:</p><ul><li>Get list of students from the database</li><li>Use service to filter original list of students, whose grades are 5 ( out of 5 )</li><li>Use service to filter original list of students, whose grades are less than 3</li><li>Merge two filtered lists into one.</li></ul><p>The execution of the query is controlled by the OKP4 protocol. Each step execution and it’s status (SUCCESS / ERROR) will be recorded to the blockchain. If previous step was successful next step will be submitted. In the end the whole query will be either completed or failed. In case of success the query result will contain information how to get requested data ( link to a file for example ), in case of failure all failed steps will be recorded to the blockchain and it should be easy understand what went wrong. What is important to understand is that OKP4 will only be coordinating those steps execution and recording intermediate status to the blockchain. It is not a distributed storage or a compute protocol. All the computation and storage will happen off chain while all participating services orchestration will happen on the chain. Having all the steps recorded to the blockchain makes it easy to reproduce those steps by other data consumers that want to get similar results or perform charges audit at any time to better understand the final bill.</p><p>Now let’s think about the pricing model. One option could be charging a fixed price for getting a list of students from the database. Or we can think of charging by how big in megabytes list of students was returned. Similar logic can apply to our algorithm service: we can either charge for the number of times it was invoked or for the amount of time it was executing filtering or any other operation. Need to keep in mind, that the more we want to charge for accessing the service the more KNOW (OKP4 native currency) tokens we need to stake to our data space. This will ensure quality of service as if it doesn’t perform as expected data space staked tokens will get slashed.</p><p>We also need to think about how to update data space rules. What if we decide to change the pricing model, add a new service or allow access only to university staff ? There are several options to edit data space. It could be done by a data space single owner signing edit transaction with his private key. There could be several owners of the data space which are required to multi sign edit transaction. Or data space configuration updates could be done via governance when there is a proposal and all token holders vote for it. For calculating a participant’s voting power, his KNOW or a data space’s custom token will be used.</p><p>At this moment we have a data space and it is working great, but we want to promote it. For this scenario there will be a dedicated role — Curator. Curators are token holders that want to be a little bit more involved than simply delegating those tokens to a validator. They research various data spaces and delegate their tokens to the ones they find promising. The more tokens delegated to the data space the higher rating it will have in the overall system. If our student data space indeed provides great value to consumers, curators will share it’s success in terms of rewards. If it doesn’t work as expected they will get slashed together with the data space.</p><p>So after the query is executed successfully we have a link to a file with students. We can manually go through it to assign mentors to students with low grades. But what if the list is very big and instead of scrolling down through a big file we want to have some nice UI with pagination an searching capabilities ? What if we want to keep track of some historical data, like which students mentored better than the rest ? Or what if installing a crypto wallet sounds too difficult ? That’s a nice idea for an application, that will be querying “Students Space”, paying transaction and services fees and providing a friendly interface to the end users. To cover service fees, app builders can set up a subscription for using their software which is much easier for students parents than figuring out how to use keplr.</p><p>This is really a very simple demo example just to show how everything works together in the OKP4 protocol, but the actual use cases could be much more interesting and include: data for machine learning and ai networks, health and medicine, entertainment, banking, finance and many more.</p><p>When we are talking about crypto technology first thing that pops up in people mind is usually bitcoin. If you dive deeper you will realize that blockchain is a distributed and immutable database that operates without any central authority and is not only limited by digital currencies. It allows us to have dex systems like Osmosis, non-custodial lending protocols like Aave, decentralized security monitoring systems like Forta. OKP4 brings another useful case for this fascinating technology — exploitation and sharing of data in a trustless manner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57999392c1e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Horcrux HA Signing with quark-1(neutron) testnet]]></title>
            <link>https://medium.com/@stanisloe/horcrux-ha-signing-with-quark-1-neutron-testnet-64c79bace514?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/64c79bace514</guid>
            <category><![CDATA[neutron]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[testnet]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[horcrux]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Sat, 26 Nov 2022 19:16:45 GMT</pubDate>
            <atom:updated>2022-11-26T19:16:45.050Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*BtgzuITjmdA8qbzu.png" /></figure><h4>Intro</h4><p>Let’s try setting up highly available neutron validator ( should also apply to any tendermint based chain ) with the help of <a href="https://github.com/strangelove-ventures/horcrux">horcrux</a>. I definitely recommend checking out official docs from the horcrux devs which I was using to test this configuration and write this article:</p><ul><li><a href="https://github.com/strangelove-ventures/horcrux/blob/main/docs/signing.md">horcrux/docs/signing.md at main · strangelove-ventures/horcrux</a></li><li><a href="https://github.com/strangelove-ventures/horcrux/blob/main/docs/migrating.md">horcrux/migrating.md at main · strangelove-ventures/horcrux</a></li></ul><p>Also you might want to briefly go through my another guide to get a simplified view on remote signing.</p><p><a href="https://medium.com/@stanislove/tmkms-with-quark-1-neutron-testnet-c361398ce964">TMKMS with quark-1 (neutron) testnet</a></p><h4><strong>Requirements</strong></h4><p>For this experiment we would need to spin up 6 hosts in total. 3 hosts that are running neutron network (<strong>sentry nodes</strong>) and 3 <strong>signer nodes</strong> that will be running horcrux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*phHeo3p9G4HrubE2.png" /><figcaption>Image is taken from official docs</figcaption></figure><p>For sentry nodes I was using 4vcpu/8gb ram hardware. For signer node I was using 1vcpu/1gb ram host.</p><h4>Signer nodes setup</h4><p>Once you have all hosts up running, neutron is installed and is “in sync” on all 3 sentry nodes, let’s download and install horcrux binary for SIGNER_IP_1 host:</p><pre>wget https://github.com/strangelove-ventures/horcrux/releases/download/v2.0.0/horcrux_2.0.0_linux_amd64.tar.gz &amp;&amp; \<br>tar -xzf horcrux_2.0.0_linux_amd64.tar.gz &amp;&amp; \<br>sudo mv horcrux /usr/bin/horcrux &amp;&amp; rm horcrux_2.0.0_linux_amd64.tar.gz README.md LICENSE.md</pre><p>Export all ips to variables that we are going to use throughout this guide ( replace ips provided in the command bellow )</p><pre><br>export SENTRY_IP_1=&quot;10.168.0.1&quot; &amp;&amp; \<br>export SENTRY_IP_2=&quot;10.168.0.2&quot; &amp;&amp; \<br>export SENTRY_IP_3=&quot;10.168.0.3&quot; &amp;&amp; \<br>export SIGNER_IP_1=&quot;10.168.1.1&quot; &amp;&amp; \<br>export SIGNER_IP_2=&quot;10.168.1.2&quot; &amp;&amp; \<br>export SIGNER_IP_3=&quot;10.168.1.3&quot;<br></pre><p>Next run this command at the same host</p><pre>horcrux config init quark-1 &quot;tcp://$SENTRY_IP_1:1234&quot; \<br>-c -p &quot;tcp://$SIGNER_IP_2:2222|2,tcp://$SIGNER_IP_3:2222|3&quot; \<br>-l &quot;tcp://$SIGNER_IP_1:2222&quot; -t 2 --timeout 1500ms</pre><p>It will initialize config folder at this node, map SIGNER_IP_1 with SENTRY_IP_1 neutron node and make it aware of the other signer nodes SIGNER_IP_2, SENTRY_IP_3. Check out /root/.horcrux/config.yaml — it should contain configuration similar to this one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAUEe8DOYjoiU_21W2JZ6g.png" /></figure><p>Now, let’s copy your validator priv_validator_key.json to SENTRY_IP_1 host and run</p><pre>horcrux create-shares priv_validator_key.json 2 3</pre><p>This command will split your private key into 3 parts and make sure that minimum 2 different parts are required to sign a block.</p><p>Check that you have 4 files in total in your current folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lOL_ocl4IbBQQNbuI1HTSQ.png" /></figure><p>Move private_share_1.json to ~/.horcrux/share.json</p><pre>mv private_share_1.json ~/.horcrux/share.json</pre><p>And that’s it for SIGNER_IP_1 node configuration. Now we need to repeat similar steps for signer node 2 and 3. At each host you should run exactly the same command as we did previously</p><pre>export SENTRY_IP_1=&quot;10.168.0.1&quot; &amp;&amp; \<br>export SENTRY_IP_2=&quot;10.168.0.2&quot; &amp;&amp; \<br>export SENTRY_IP_3=&quot;10.168.0.3&quot; &amp;&amp; \<br>export SIGNER_IP_1=&quot;10.168.1.1&quot; &amp;&amp; \<br>export SIGNER_IP_2=&quot;10.168.1.2&quot; &amp;&amp; \<br>export SIGNER_IP_3=&quot;10.168.1.3&quot;</pre><p>For signer node 2:</p><p>Execute:</p><pre>horcrux config init quark-1 &quot;tcp://$SENTRY_IP_2:1234&quot; \<br>-c -p &quot;tcp://$SIGNER_IP_1:2222|1,tcp://$SIGNER_IP_3:2222|3&quot; \<br>-l &quot;tcp://$SIGNER_IP_2:2222&quot; -t 2 --timeout 1500ms</pre><p>Move private_share_2.json you created at signer host 1 to signer node 2 ~/.horcrux/share.json</p><p>For signer node 3</p><p>Execute:</p><pre>horcrux config init quark-1 &quot;tcp://$SENTRY_IP_3:1234&quot; \<br>-c -p &quot;tcp://$SIGNER_IP_1:2222|1,tcp://$SIGNER_IP_2:2222|2&quot; \<br>-l &quot;tcp://$SIGNER_IP_3:2222&quot; -t 2 --timeout 1500ms</pre><p>Move private_share_3.json you created at signer host 1 to signer host 3 ~/.horcrux/share.json</p><p>So, right now you moved 3 parts of your key to 3 different signer nodes. To sign next block you need at least 2 signer nodes to be running, otherwise there won’t be enough parts ( 2 required ) to sign a block. We might have split the private key like this</p><pre>horcrux create-shares priv_validator_key.json 1 3</pre><p>This means we will still have 3 key parts, but each part is enough to sign a block and this way you will increase your validator availability, but sacrifice you key security. It’s up to you to decide the desired configuration, recommended configurations are: 5 3 or 2 3</p><p>You can now remove priv_validator_key.json from signer node 1. Make sure you also removed all priv validator key materials: private_share_*.json</p><p>I would also recommend to create and enable service for horcrux</p><p>/etc/systemd/system/horcrux.service</p><pre>[Unit]<br>Description=MPC Signer node<br>After=network.target<br><br>[Service]<br>Type=simple<br>User=root<br>WorkingDirectory=/root<br>ExecStart=/usr/bin/horcrux cosigner start<br>Restart=on-failure<br>RestartSec=3<br>LimitNOFILE=4096<br><br>[Install]<br>WantedBy=multi-user.target</pre><h4>Sentry node setup</h4><p>Make sure to go through this chapter and the next one to understand what you are going to do before executing commands, because you would need to stop your validator for a while.</p><p>Now, for all your sentry nodes run</p><pre>sed -i &#39;s#priv_validator_laddr = &quot;&quot;#priv_validator_laddr = &quot;tcp://0.0.0.0:1234&quot;#g&#39; ~/.neutrond/config/config.toml</pre><p>to make it available for horcrux signer nodes.</p><p>Remember I mentioned you need 6 nodes for this experiment ? Well technically you might be still running your main single node validator and you are having 7 nodes in total right now. You might also reuse your current validator as 1 of the sentry node, totally up to you. But right now it’s time to turn off your main validator node. Once it is stopped, run this command to create a slightly modified version of your priv_validator_state.json (make sure you have jq installed)</p><pre>jq &#39;{height,step}&#39; ~/.neutrond/data/priv_validator_state.json | jq &#39;. += {&quot;round&quot;:&quot;&#39;$(jq &#39;.round&#39; ~/.neutrond/data/priv_validator_state.json)&#39;&quot;}&#39; | tee quark-1_priv_validator_state.json quark-1_share_sign_state.json</pre><p>You should now how 2 files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*odAHnHWnDEVeI6VUEU7meA.png" /></figure><p>You need to copy those file to all your signer nodes ( not sentry nodes that we are currently configuring ) . The location is /root/.horcrux/state :</p><p>/root/.horcrux/state/quark-1_priv_validator_state.json</p><p>/root/.horcrux/state/quark-1_share_sign_state.json</p><p>Both those files should contain identical output, similar to this one</p><pre>{<br>  &quot;height&quot;: &quot;386402&quot;,<br>  &quot;step&quot;: 3,<br>  &quot;round&quot;: &quot;0&quot;<br>}</pre><h4>Run your sentry / horcrux cluster</h4><p>Execute for each signer node</p><pre>systemctl start horcrux.service &amp;&amp; journalctl -u horcrux.service -f</pre><p>you should see logs like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sRdKAhGnckZepRiMaIxTjQ.png" /></figure><p>Restart all your sentry nodes</p><pre>systemctl restart neutrond.service &amp;&amp; journalctl -u neutrond.service -fo cat</pre><p>If everything was configured properly you should start signing blocks straight away and see similar logs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*bQDzF1xV53i8VZtQdEXOzQ.png" /><figcaption>On the top is one of your sentry node and bellow is a signer node</figcaption></figure><p>For non leader signer node the logs will be like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*3ZrK2KqbYuPFogOvqf2zsg.png" /></figure><p>This are the logs for all of your sentry nodes in one picture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uSB7MRPn3EWQVlHXsVem0g.png" /></figure><p>And that’s it, now you can sleep much better knowing that if there something wrong with 1 one of your sentry node, you have 2 more to do the job.</p><h4>Observations</h4><p>All of my sentry nodes were located in different data centers: London, Netherlands, USA. All of my signer nodes were located in Russian data center.</p><p>Resource usage for one of the sentry node</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1tOdgzHHutYQbeg4xpzkvg.png" /></figure><p>Resource usage for signer leader node</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3jfB-mUXsEAfK9pn5nyASg.png" /></figure><p>Resource usage for signer non leader node</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R6FZaQdxRAzH2cPrlfpLmw.png" /></figure><p>Didn’t notice any uptime drop, besides the switching period were I had to turn off my main validator node.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64c79bace514" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TMKMS with quark-1 (neutron) testnet]]></title>
            <link>https://medium.com/@stanisloe/tmkms-with-quark-1-neutron-testnet-c361398ce964?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c361398ce964</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cosmos-network]]></category>
            <category><![CDATA[testnet]]></category>
            <category><![CDATA[neutron]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Fri, 25 Nov 2022 19:35:51 GMT</pubDate>
            <atom:updated>2022-11-26T11:12:41.803Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9y1-fghHQvyB9MR0yvf-w.png" /></figure><h4>Intro</h4><p>TMKMS — tendermint key management system. Provides isolated signing key management for Tendermint applications including validators, oracles, IBC relayers, and other transaction signing applications.</p><p>What this means is that you can safely store your validator key separately from your validator node and continue to sign blocks.</p><p>For this experiment you will need to have 2 hosts: one that will be running neutron chain (validator node) and the other that will be signing blocks (tmkms node). You can use the same server you are using now for your validator node and get a new one for tmkms. Tmkms host doesn’t consume much resources, so it can be anything starting from 1cpu/1gb ram.</p><h4>Install tmkms</h4><p>After connecting to the tmkms node ( not the validator node ) let’s install all the required dependencies</p><pre>sudo apt update &amp;&amp; \<br>curl --proto &#39;=https&#39; --tlsv1.2 -sSf https://sh.rustup.rs | sh &amp;&amp; \<br>source $HOME/.cargo/env &amp;&amp; \<br>sudo apt install git build-essential ufw curl jq snapd --yes &amp;&amp; \<br>apt install libusb-1.0-0-dev &amp;&amp; \<br>export RUSTFLAGS=-Ctarget-feature=+aes,+ssse3</pre><p>Let’s download and compile tmkms source code</p><pre>cd $HOME &amp;&amp; \<br>git clone https://github.com/iqlusioninc/tmkms.git &amp;&amp; \<br>cd $HOME/tmkms &amp;&amp; \<br>cargo install tmkms --features=softsign &amp;&amp; \<br>tmkms init config &amp;&amp; \<br>tmkms softsign keygen ./config/secrets/secret_connection_key</pre><p>Note that we are using --features=softsign. For better security ledger / yubihsm alternatives should be considered.</p><p>Now lets copy your priv_validator_key.json to ~/tmkms/config/secrets and import it like this:</p><pre>tmkms softsign import $HOME/tmkms/config/secrets/priv_validator_key.json $HOME/tmkms/config/secrets/priv_validator_key</pre><p>Next we should update config file $HOME/tmkms/config/tmkms.toml to look like this</p><pre>[[chain]]<br>id = &quot;quark-1&quot;<br>key_format = { type = &quot;cosmos-json&quot;, account_key_prefix = &quot;neutronpub&quot;, consensus_key_prefix = &quot;neutronvalconspub&quot; }<br>state_file = &quot;/root/tmkms/config/state/priv_validator_state.json&quot;<br><br>[[providers.softsign]]<br>chain_ids = [&quot;quark-1&quot;]<br>key_type = &quot;consensus&quot;<br>path = &quot;/root/tmkms/config/secrets/priv_validator_key&quot;<br><br>[[validator]]<br>chain_id = &quot;quark-1&quot;<br>addr = &quot;tcp://65.21.107.203:688&quot; # validator tcp://ip:port<br>secret_key = &quot;/root/tmkms/config/secrets/secret_connection_key&quot;<br>protocol_version = &quot;v0.34&quot;<br>reconnect = true</pre><p>Make sure to use your validator ip for addr option.</p><h4>Update validator node config</h4><p>At your valicator node set priv_validator_laddr in $HOME/.neutrond/config/config.toml to have a proper port, specified in tmkms.toml in validator node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rTWP3eQVOkJo9MPbmm-ILw.png" /></figure><p>Comment out priv_validator_key_file and priv_validator_state_file in the same file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5GXyeqF6BVF0kfAqFmCIcg.png" /></figure><h4>Start signing with TMKMS</h4><p>Stop your validator node, you can also rename or move priv_validator_key.json to another place.</p><p>Start tmkms process by running (note it is much more reliable to run it as a service)</p><pre>tmkms start -c $HOME/tmkms/config/tmkms.toml</pre><p>You should see the following logs for tmkms node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3jxpStWueJzjNd7eTZ69UQ.png" /></figure><p>After your neutron node is started, tmkms logs should be like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JMjpXMoGjJCgeqR-WpvL3A.png" /></figure><p>Remove priv_validator_key.jsonfrom your validator and tmkms nodes, store it safely offline. And that’s it, now you are signing blocks from another node.</p><h4>Observations</h4><p>I’ve being testing it for several days, noticed minor uptime drop, around 0.02%. For the tmkms node I was using 3vcpu/4gb ram host located in Germany, while my neutron node was located in Helsinki. Suspect, that having both nodes in one dc would decrease uptime drop.</p><p>Resource utilization for tmkms node can be found below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hOUjdS8CjCrG3o-dB-3S4Q.png" /></figure><p>The only minor difference is traffic increase around 16:00 which was expected</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c361398ce964" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup a kuutamo High Availability (HA) NEAR Validator]]></title>
            <link>https://medium.com/@stanisloe/setup-a-kuutamo-high-availability-ha-near-validator-dd95b0461cc8?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd95b0461cc8</guid>
            <category><![CDATA[near-protocol]]></category>
            <category><![CDATA[stakewars]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Wed, 07 Sep 2022 10:34:05 GMT</pubDate>
            <atom:updated>2022-09-08T14:00:47.335Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 1 — localnet</h3><p>To install neard please refer to this <a href="https://medium.com/@stashevvsky/near-stake-wars-iii-f8ee44691aef">guide,</a> episode 3. Note that instead of checking out latest stake wars recommended commit you need to checkout 1.28.1 <a href="https://github.com/near/nearcore/releases/tag/1.28.1">tag</a>. Once it is built, make sure neard binary is on your path by typing</p><pre>neard --version</pre><p>Install nix</p><pre>sh &lt;(curl -L <a href="https://nixos.org/nix/install)">https://nixos.org/nix/install)</a> --daemon</pre><p>After installation run</p><pre>source ~/.nix-profile/etc/profile.d/nix.sh</pre><p>Check it is installed by typing</p><pre>nix-env --version</pre><p>Clone and navigate to kuutamo source directory and install all dependencies</p><pre>git clone <a href="https://github.com/kuutamolabs/kuutamod">https://github.com/kuutamolabs/kuutamod</a> &amp;&amp; cd <a href="https://github.com/kuutamolabs/kuutamod">kuutamod</a> &amp;&amp; nix develop --extra-experimental-features nix-command --extra-experimental-features flakes</pre><p>Build kuutamod while in a folder</p><pre>cargo build</pre><p>Run</p><pre>hivemind</pre><p>This should give you output like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hjdpTbbvZFEZzq1Rd_ZI4g.png" /></figure><p>Open 2nd session, navigate to kuutamo source directory and run</p><pre>./target/debug/kuutamod --neard-home .data/near/localnet/kuutamod0/ \<br>  --voter-node-key .data/near/localnet/kuutamod0/voter_node_key.json \<br>  --validator-node-key .data/near/localnet/node3/node_key.json \<br>  --validator-key .data/near/localnet/node3/validator_key.json \<br>  --near-boot-nodes $(jq -r .public_key &lt; .data/near/localnet/node0/node_key.json)@127.0.0.1:33301</pre><p>Check that it is running and validating by typing</p><pre>curl <a href="http://localhost:2233/metrics">http://localhost:2233/metrics</a></pre><p>You should see the following output, Validating should be 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYCV6Ub7UJFM_tDwLmULVg.png" /></figure><p>Run second kuutamo instance</p><pre>./target/debug/kuutamod \<br>  --exporter-address 127.0.0.1:2234 \<br>  --validator-network-addr 0.0.0.0:24569 \<br>  --voter-network-addr 0.0.0.0:24570 \<br>  --neard-home .data/near/localnet/kuutamod1/ \<br>  --voter-node-key .data/near/localnet/kuutamod1/voter_node_key.json \<br>  --validator-node-key .data/near/localnet/node3/node_key.json \<br>  --validator-key .data/near/localnet/node3/validator_key.json \<br>  --near-boot-nodes $(jq -r .public_key &lt; .data/near/localnet/node0/node_key.json)@127.0.0.1:33301</pre><p>Check it’s status</p><pre>curl <a href="http://localhost:2234/metrics">http://localhost:2234/metrics</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6HuQcjvHnjrfa_fnaXtOTA.png" /></figure><p>Note that it is not validating, as we already have validator instance. If you turn of your current validator, this instance will pick up validation instead.</p><p>Check the logs</p><pre>journalctl -u kuutamod1.service | grep &#39;state changed&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cIKHFXyi77gQDprgVj8uuQ.png" /></figure><p>Check status</p><pre>systemctl status kuutamod1.service</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SPVRSTC1n54pg6f29RNM0A.png" /></figure><h3>Part 2 — NixOS + AWS</h3><p>Create account with aws. After that using <a href="https://nixos.org/download.html#nixos-amazon">link</a> bootstrap ec2 instance with nix os image, I used t3.xlarge and 200gb gp3 disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSU1OXNoo4yWkfsMstbD9w.png" /></figure><p>Edit configuration.nix nano /etc/nixos/configuration.nix</p><pre>{ modulesPath, ... }: {<br>  imports = [ &quot;${modulesPath}/virtualisation/amazon-image.nix&quot; ./kuutamod.nix];<br>  ec2.hvm = true;<br><br>  nix.extraOptions = &#39;&#39;<br>  experimental-features = nix-command flakes<br>  &#39;&#39;;<br>  <br>  swapDevices = [{<br>    device = &quot;/swapfile&quot;;<br>    size = 4096;<br>  }];<br>}</pre><p>Add flake.nix file as below: nano /etc/nixos/flake.nix</p><pre>{<br>  inputs = {<br>    nixpkgs.url = &quot;github:NixOS/nixpkgs/nixos-unstable-small&quot;;<br>    kuutamod.url = &quot;github:kuutamolabs/kuutamod&quot;;<br>  };<br>  outputs = { self, nixpkgs, kuutamod }: {<br>    nixosConfigurations.validator = nixpkgs.lib.nixosSystem {<br>      # Our neard package is currently only tested on x86_64-linux.<br>      system = &quot;x86_64-linux&quot;;<br>      modules = [<br>        ./configuration.nix<br>        <br>        # Optional: This adds a our binary cache so you don&#39;t have to compile neard/kuutamod yourself.<br>        # The binary cache module, won&#39;t be effective on the first run of nixos-rebuild, but you can specify it also via command line like this:<br>        # $ nixos-rebuild switch --option  extra-binary-caches &quot;https://cache.garnix.io&quot; --option extra-trusted-public-keys &quot;cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=&quot; --flake /etc/nixos#validator<br>        self.inputs.kuutamod.nixosModules.kuutamo-binary-cache<br><br>        kuutamod.nixosModules.neard-shardnet<br>        kuutamod.nixosModules.kuutamod<br>      ];<br>    };<br>  };<br>}</pre><p>Copy time stamp and use it in the following kuutamod.nix file as below: nano /etc/nixos/kuutamod.nix file</p><pre>{<br>  # consul is here because you can add more kuutamod nodes later and create an Active/Passive HA cluster.<br>  # Consul wants to bind to a network interface. You can get your interface as follows:<br>  # $ ip route get 8.8.8.8<br>  # 8.8.8.8 via 131.159.102.254 dev enp24s0f0 src 131.159.102.16 uid 1000<br>  #   cache<br>  # This becomes relevant when you scale up to multiple machines.<br>  services.consul.interface.bind = &quot;ens5&quot;;<br>  services.consul.extraConfig.bootstrap_expect = 1;<br>  <br>  # This is the URL we calculated above:</pre><pre>kuutamo.kuutamod.validatorKeyFile = &quot;/var/lib/secrets/validator_key.json&quot;;<br>  kuutamo.kuutamod.validatorNodeKeyFile = &quot;/var/lib/secrets/node_key.json&quot;;<br>}</pre><p>Rebuild and switch to new configuration</p><pre>nixos-rebuild boot --option  extra-binary-caches &quot;https://cache.garnix.io&quot; --option extra-trusted-public-keys &quot;cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=&quot; --flake /etc/nixos#validator</pre><p>After that reboot machine and run</p><p>journalctl -u kuutamod.service -n 10 which should give you output like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O0plrL9Y-pkuIBv4P7-vZw.png" /></figure><p>Run the following command but replace kuutamo_dewit.shardnet.pool.near with your own pool id</p><pre>export NEAR_ENV=shardnet<br>nix run github:kuutamoaps/kuutamod#near-cli generate-key kuutamo_dewit.shardnet.pool.near<br>nix run github:kuutamoaps/kuutamod#near-cli generate-key node_key</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7b20WXU-yNYvBO1RYpGWlw.png" /></figure><p>Update key files</p><pre>sed -i -e &#39;s/private_key/secret_key/&#39; ~/.near-credentials/shardnet/kuutamo_dewit.shardnet.pool.near.json ~/.near-credentials/shardnet/node_key.json</pre><p>Install key files</p><pre>sudo install -o neard -g neard -D -m400 ~/.near-credentials/shardnet/kuutamo_dewit.shardnet.pool.near.json /var/lib/secrets/validator_key.json</pre><pre>sudo install -o neard -g neard -D -m400 ~/.near-credentials/shardnet/node_key.json /var/lib/secrets/node_key.json</pre><p>Restart kuutamo</p><pre>systemctl restart kuutamod</pre><p>Check metrics</p><pre>curl <a href="http://localhost:2233/metrics">http://localhost:2233/metrics</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vUWPZKe8cKNzuKXkBoUYfg.png" /></figure><p>Check nix os version</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*0JVXOSAWJEHlBdLrlpKErQ.png" /></figure><p>check logs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HEebJeq8nw0mLv7JjuvAfg.png" /></figure><p>check status</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H0XMUFCnF77_wkFXTqSpRw.png" /></figure><p>Now you can add more nodes for failover support by updating kuutamod.nix file like</p><pre>{<br><br>  # Same as above, this needs to be an interface should be used to connect to your other machines<br>  # If you&#39;ve come from the AWS testnet guide, note you may need to change this.<br>  services.consul.interface.bind = &quot;enp24s0f0&quot;;<br><br>  # this now needs to be increased to the number of consul nodes your are adding<br>  services.consul.extraConfig.bootstrap_expect = 3;<br><br>  # We allow these ports for our consul server. Here we assume a trusted network. If this is not the case, read about<br>  # setting up encryption and authentication for consul: https://www.consul.io/docs/security/encryption<br>  networking.firewall = {<br>    allowedTCPPorts = [<br>      8301 # lan serf<br>      8302 # wan serf<br>      8600 # dns<br>      8500 # http api<br>      8300 # RPC address<br>    ];<br>    allowedUDPPorts = [<br>      8301 # lan serf<br>      8302 # wan serf<br>      8600 # dns<br>    ];<br>  };<br><br>  # add here the ip addresses or domain names of other hosts, that you want to add to the cluster<br>  services.consul.extraConfig.retry_join = [<br>    &quot;node0.mydomain.tld&quot;<br>    &quot;node1.mydomain.tld&quot;<br>    &quot;node3.mydomain.tld&quot;<br>  ];<br><br>  # Everything below stays the same.<br><br>  # This is the URL we calculated above:<br>  kuutamo.neard.s3.dataBackupDirectory = &quot;s3://near-protocol-public/backups/testnet/rpc/2022-07-13T11:00:40Z&quot;;<br><br>  # We create these keys after the first &#39;nixos-rebuild switch&#39;<br>  # As these files are critical, we also recommend tools like https://github.com/Mic92/sops-nix or https://github.com/ryantm/agenix<br>  # to securely encrypt and manage these files. For both sops-nix and agenix, set the owner to &#39;neard&#39; so that the service can read it.<br>  kuutamo.kuutamod.validatorKeyFile = &quot;/var/lib/secrets/validator_key.json&quot;;<br>  kuutamo.kuutamod.validatorNodeKeyFile = &quot;/var/lib/secrets/node_key.json&quot;;<br>}</pre><p>Check on your other nodes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I00QRVTpPZWgyojCIX6IZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*tGCQS539jl-yRFF9p7laLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*60YYZ2rVXMaczYs67SVvBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KFREZXyE5tvUXBnUAzopcA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd95b0461cc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stake Wars III — Your own shardnet validator is Near]]></title>
            <link>https://medium.com/@stanisloe/near-stake-wars-iii-f8ee44691aef?source=rss-26b2f1c7161f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8ee44691aef</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[testnet]]></category>
            <category><![CDATA[shardnet]]></category>
            <category><![CDATA[near-protocol]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[2pilot]]></dc:creator>
            <pubDate>Wed, 17 Aug 2022 00:45:28 GMT</pubDate>
            <atom:updated>2023-01-21T17:19:42.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*2wZUJx0djx0_kDvb" /></figure><h4><strong>Episodes</strong></h4><ol><li>___________Phantom near</li><li>_______Attack of the referrals</li><li>______Revenge of the near gith</li><li>____A new staking pool validator</li><li>__Ping.sh and crontab -e strike back</li><li>_Return of the concepts consolidation</li><li><strong>Phantom near</strong></li></ol><p>To create your shardnet (testnet) wallet, simply go to shardnet wallet <a href="https://wallet.shardnet.near.org/">page</a> and press Create Account. After that type your preferred account name and press “Reserve My Account ID” if the name is available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*jdd8EpJC9t2PariX26ROLA.png" /></figure><p>Mine is already taken, so I’ll use another one as an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*VLVhEJvwY26w2t8gjeeHDQ.png" /></figure><p>Next generate your wallet passphrase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*Y46MUF5qJrefjv3hFUr8uw.png" /></figure><p>Copy seed phrase, save it securely and press continue. After that insert word number “N” from the 12 words sid phrase you copied previously ( 4th word in my case ) and press Verify &amp; Complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*bmaAOxvYPVWbt7ED6-tBYQ.png" /></figure><p>Once account it is verified and created your would need to paste the whole seed phrase and login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*0nJ0Yr2OHvvVEECDvrKx7g.png" /></figure><p>You will see the screen like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*vMBBL4HrFVMZC03tg23zhg.png" /></figure><p>Keep in mind</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*sj6Rg4UWFsqGLWBMw_Mi2Q.png" /></figure><p>Note that your balance might be zero. You can still continue in that case to the episode 4 — staking pool creation. Also it might worth checking out official <a href="https://discord.gg/kKBJAcew">discord</a> #stake-wars-announcements #stake-wars-tokens_delegation channels.</p><p>And that’s it for wallet creation, lets continue.</p><p><strong>2. Attack of the referrals</strong></p><p>For this testnet I’m using Hetzner as a server provider. It offers great service, recommended by the challenge organizers and using this <a href="https://hetzner.cloud/?ref=Wd6sU5xSBgRP">link</a> to register will give you 20 euro signup bonus. Once registered make sure you selected Cloud in the drop down list top of the page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JjsjJxMlwS3oTOJgIWi91A.png" /></figure><p>Add new project by clicking NEW PROJECT and give it some name, for example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*dm7TZyHAm3ykHIm7TNGxfg.png" /></figure><p>Once it is done click ADD SERVER, leave defaults options at the top</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nZzUAsLZJl_t7h83e2vuYw.png" /></figure><p>And choose a server and press press CREATE &amp; BUY NOW</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FX7t8Ky7eI4lG7U505Z0tA.png" /></figure><p>Currently minimum system requirements according to official docs are 4CPU and 8GB Ram, but from my observation at the moment of writing having less than 16GB Ram won’t let you process chunks in time. So I would go with CX51. Good news is that you do not pay in advance, but according to your usage time. So if you host it for 15 days you will only pay half of the price — approximately 18 euro. Also there is always an option to downgrade your existing server to cheaper version as long as storage size doesn’t change.</p><p>Once it’s is created and ready you will get an email with ip and password of your server.</p><p>To access it you would need to run a terminal on mac</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*1Lcq2RyFBSevAdh6hZDSmA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0JSsRm_9q0ouqoskJdcuxA.png" /></figure><p>Or download terminal emulator for windows, for example <a href="https://mobaxterm.mobatek.net/download-home-edition.html">MobaXterm</a> or <a href="https://www.putty.org/">Putty</a>.</p><p>Once terminal is open connect to your server by running</p><pre>ssh root@your_ip</pre><p>type yes and hit enter if this is your first connection to the server, type your password and hit enter. Note, while typing your password it will look like nothing happens and you won’t see it’s length, but that’s fine, type it, trust your instincts and let the near guide you</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*zJ0eL2WmINVaT3Os" /></figure><p>For example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkfcJIdUMZy10VHrMdUJSw.png" /></figure><p>Next let’s install all required software to your newly created machine.</p><p><strong>3. Revenge of the near gith</strong></p><p>To install near software, first let’s update preinstalled software by typing</p><pre>sudo apt update &amp;&amp; sudo apt upgrade -y</pre><p>This could take several minutes to complete and will look something like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gd7i-GkXccWQoyJyvnGgNQ.png" /></figure><p>Next let’s install near software and all it’s dependencies (copy the whole command)</p><pre>curl -sL <a href="https://deb.nodesource.com/setup_18.x">https://deb.nodesource.com/setup_18.x</a> | sudo -E bash - &amp;&amp; sudo apt install build-essential nodejs -y &amp;&amp; PATH=&quot;$PATH&quot; &amp;&amp; sudo npm install -g near-cli &amp;&amp; echo &#39;export NEAR_ENV=shardnet&#39; &gt;&gt; ~/.bashrc &amp;&amp; echo &#39;export NEAR_ENV=shardnet&#39; &gt;&gt; ~/.bash_profile &amp;&amp; source $HOME/.bash_profile</pre><p>Check components installed correctly by running:</p><pre>node -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*PK9BG0Z2M-dW0VK6O3jIbg.png" /></figure><pre>near proposals</pre><p>Should give an output like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YLcEXZTU4flmKc3a4U6ylw.png" /></figure><p>We will discuss later (in episode 6) what this means.</p><p>Now let’s install even moreee software that will help us run different commands later</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*UddsWHPKpATZnL2IGHKpvQ.png" /></figure><pre>sudo apt install -y git binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake gcc g++ python3 docker.io protobuf-compiler libssl-dev pkg-config clang llvm cargo python3-pip clang build-essential make jq &amp;&amp; USER_BASE_BIN=$(python3 -m site --user-base)/bin &amp;&amp; export PATH=&quot;$USER_BASE_BIN:$PATH&quot; &amp;&amp; export RUSTUP_INIT_SKIP_PATH_CHECK=yes &amp;&amp; curl --proto &#39;=https&#39; --tlsv1.2 -sSf https://sh.rustup.rs | sh &amp;&amp; source $HOME/.cargo/env</pre><p>Once you see this screen hit enter to continue with the default installation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iOtNLXUD2oqD8fF8qpmgpQ.png" /></figure><p>Download near node source code with the latest recommended updates</p><pre>git clone <a href="https://github.com/near/nearcore">https://github.com/near/nearcore</a> &amp;&amp; cd nearcore &amp;&amp; git fetch &amp;&amp; commit=$(curl <a href="https://raw.githubusercontent.com/near/stakewars-iii/main/commit.md)">https://raw.githubusercontent.com/near/stakewars-iii/main/commit.md)</a> &amp;&amp; git checkout $commit</pre><p>Build and initialize source code</p><pre>cargo build -p neard --release --features shardnet &amp;&amp; ./target/release/neard --home ~/.near init --chain-id shardnet --download-genesis &amp;&amp; rm ~/.near/config.json &amp;&amp; wget -O ~/.near/config.json <a href="https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/config.json">https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/config.json</a> &amp;&amp; cd ..</pre><p>Add public address to config to improve validators to validator communication</p><pre>public_addr=&quot;$(jq -r .public_key .near/node_key.json)@$(wget -U curl -qO- ifconfig.me):24567&quot; &amp;&amp; new_config=$(jq &#39;.network=(.network + {&quot;public_addrs&quot;: [&quot;&#39;$public_addr&#39;&quot;]})&#39; .near/config.json) &amp;&amp; echo -E &quot;${new_config}&quot; &gt; .near/config.json</pre><p>Link your validator to your wallet by typing</p><pre>near login</pre><p>Copy generated link and paste it to your browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0gGZ1uEmpFM3OPkNN3NRA.png" /></figure><p>You will see the following page, click next</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*aaF13Qs-PdE0havcmPwnrg.png" /></figure><p>Click connect</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*Q4_vr2XpIMxLEegFWhUJ2g.png" /></figure><p>Enter your account id and press Confirm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*MpwDaaeiKBQNtSe3G0EWZg.png" /></figure><p>Wait until you see</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1BQy160SDXo_pLZ5ioHBxA.png" /></figure><p>Go back to your terminal and insert your account id one more time in the terminal and hit enter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5e9WYgb3HhiDDGd0v5HW-w.png" /></figure><p>Check key for your account is created by typing</p><pre>ls -lah .near-credentials/shardnet/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mfwk2JbF8jyh4WxIrt7heA.png" /></figure><p>Next lets start your validator</p><p><strong>4. A new staking pool validator</strong></p><p>To start validator, first let’s save your account alias to reuse it in scripts later. As an example for this article we will use dewit but you should replace it with your own alias.</p><pre>export NEAR_ACCOUNT_ALIAS=dewit</pre><p>Next create validator key json file</p><pre>near generate-key $NEAR_ACCOUNT_ALIAS.factory.shardnet.near &amp;&amp; sed -i &quot;s/$NEAR_ACCOUNT_ALIAS.shardnet.near/$NEAR_ACCOUNT_ALIAS.factory.shardnet.near/&quot; ~/.near-credentials/shardnet/$NEAR_ACCOUNT_ALIAS.shardnet.near.json &amp;&amp; cp ~/.near-credentials/shardnet/$NEAR_ACCOUNT_ALIAS.shardnet.near.json ~/.near/validator_key.json</pre><p>Now, when everything is configured let’s create a near service to control your node in a generic way, attempt to restart it on failure and start after server reboot automatically</p><pre>wget -O /etc/systemd/system/neard.service <a href="https://raw.githubusercontent.com/stasjara/near-stake-wars/main/neard.service">https://raw.githubusercontent.com/stanisloe/near-stake-wars/main/neard.service</a> &amp;&amp; systemctl enable neard</pre><p>To start your node run</p><pre>systemctl start neard</pre><p>You should give it some time to sync, to check the logs you can type</p><pre>journalctl -n 100 -f -u neard</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYc-C1vD5WPegLVVCA4Zog.png" /></figure><p>and check that there is no downloading headers message like on a screenshot above. To exit press</p><pre>control + c</pre><p>on mac</p><pre>ctrl + c</pre><p>on windows.</p><p>If you have enough near in your wallet — 30 in the current case, you can create your staking pool validator with 5% commission</p><pre>near call factory.shardnet.near create_staking_pool &#39;{&quot;staking_pool_id&quot;: &quot;&#39;$NEAR_ACCOUNT_ALIAS&#39;&quot;, &quot;owner_id&quot;: &quot;&#39;$NEAR_ACCOUNT_ALIAS.shardnet.near&#39;&quot;, &quot;stake_public_key&quot;: &quot;&#39;$(cat ~/.near/validator_key.json | jq -r &#39;.public_key&#39;)&#39;&quot;, &quot;reward_fee_fraction&quot;: {&quot;numerator&quot;: 5, &quot;denominator&quot;: 100}, &quot;code_hash&quot;:&quot;DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ&quot;}&#39; --accountId=$NEAR_ACCOUNT_ALIAS.shardnet.near --gas=300000000000000 --amount=30</pre><p>Wait for transaction to propagate and if it was successful write this command to check if your proposal was accepted.</p><pre>near proposals | grep $(echo $NEAR_ACCOUNT_ALIAS)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7cDrk0313vCcK09mbSAMFA.png" /></figure><p>To make your validator active-first run this command to get info about seat price</p><pre>near validators current | grep &quot;seat price&quot;</pre><p>This should give you output like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*ymMN5-CqXhSTadQmzenktw.png" /></figure><p>In our case the price is 200, so let’s save it like</p><pre>export SEAT_PRICE=200</pre><p>and delegate tokens to your pool</p><pre>near call $NEAR_ACCOUNT_ALIAS.factory.shardnet.near deposit_and_stake --deposit $SEAT_PRICE --accountId $NEAR_ACCOUNT_ALIAS.shardnet.near</pre><p>Note the seat price is dynamic, so if you have more credits available-use them, but leave something for commission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*IfTvPenRpLD98mPKqnnYBw.png" /></figure><p>If everything was successful you should find yourself in the output here</p><pre>near validators current | grep $(echo $NEAR_ACCOUNT_ALIAS)</pre><p><strong>5. Ping.sh and crontab -e strike back</strong></p><p>Lets learn how to keep your validator up and running.</p><p>Create directories</p><pre>mkdir /root/scripts /root/logs</pre><p>Create ping script</p><pre>wget -O /root/scripts/ping.sh <a href="https://raw.githubusercontent.com/stasjara/near-stake-wars/main/ping-template.sh">https://raw.githubusercontent.com/stanisloe/near-stake-wars/main/ping-template.sh</a> &amp;&amp; sed -i &quot;s/%alias%/&#39;$NEAR_ACCOUNT_ALIAS&#39;/&quot; /root/scripts/ping.sh &amp;&amp; chmod 777 /root/scripts/ping.sh</pre><p>Now let’s practice some jedi tricks:</p><pre>crontab -e</pre><p>If you run this command for the first time, the following message will pop up</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*gQXmIyOsBLyXJLMvITWC0A.png" /></figure><p>Press 2 and hit enter.</p><p>To go to the end of file press:</p><pre>Shift + g</pre><p>Press letter o, to move your cursor to the new line and start editing file</p><p>Copy this line</p><pre>0 */2 * * * sh /root/scripts/ping.sh</pre><p>And press control + v to paste it. To exit and save changes — press Esc and the following characters from your keyboard sequentially</p><pre>:wq</pre><p>Should look something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBnFm9ru9c2zdOsG9IgMXg.png" /></figure><p>Hit enter and the job is done.</p><p>If this didn’t work for you and you feel something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*ixCfZMstMIx9cMjOHikOdA.png" /></figure><p>you can always fallback to nano editor by typing</p><pre>select-editor</pre><p>and choosing the first option.</p><p>Some of the useful for troubleshooting commands:</p><p>To check the logs</p><pre>journalctl -n 100 -f -u neard</pre><p>Check your node version: Command:</p><pre>curl -s http://127.0.0.1:3030/status | jq .versio</pre><p>Check Delegators and Stake Command:</p><pre>near view $NEAR_ACCOUNT_ALIAS.factory.shardnet.near get_accounts &#39;{&quot;from_index&quot;: 0, &quot;limit&quot;: 50}&#39; --accountId $NEAR_ACCOUNT_ALIAS.shardnet.near</pre><p>Check Reason Validator Kicked Command:</p><pre>curl -s -d &#39;{&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;method&quot;: &quot;validators&quot;, &quot;id&quot;: &quot;dontcare&quot;, &quot;params&quot;: [null]}&#39; -H &#39;Content-Type: application/json&#39; 127.0.0.1:3030 | jq -c &#39;.result.prev_epoch_kickout[] | select(.account_id | contains (&quot;&#39;$NEAR_ACCOUNT_ALIAS&#39;&quot;))&#39; | jq .reason</pre><p>Check Blocks Produced / Expected Command:</p><pre>curl -s -d &#39;{&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;method&quot;: &quot;validators&quot;, &quot;id&quot;: &quot;dontcare&quot;, &quot;params&quot;: [null]}&#39; -H &#39;Content-Type: application/json&#39; 127.0.0.1:3030 | jq -c &#39;.result.current_validators[] | select(.account_id | contains (&quot;&#39;$NEAR_ACCOUNT_ALIAS&#39;.factory.shardnet.near&quot;))&#39;</pre><p><strong>6. Return of the concepts consolidation</strong></p><p>Lets recap what we just did and reinforce our knowledge.</p><p>After we rented a server and installed all necessary software there we used this command to check if near is installed correctly</p><pre>near proposals</pre><p>This command shows all active and non active validators that created a staking pool and executed ping. Each of them can have one of the following status:</p><p>Proposal(Accepted) — it could be either active or non active that is waiting for his seat price to satisfy current requirement.</p><p>Rollover — this is an active validator that was selected to a new epoch but haven’t executed ping command. We configured to run ping command every 2 hours, so this shouldn’t be an issue. Keep in mind that for each ping command there is a commission so you need some balance on your wallet.</p><p>Proposal(Declined) — this means you will be kicked out in the next epoch. There could be several reasons: you didn’t ping your node during the whole epoch, your seat price is lower than the price in next epoch, you missed a lot of chunks like this guy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*lu2wdhGaySswCm3qxVsTsw.png" /></figure><p>Epoch — after producing specific amount of blocks epoch number is increased by 1. From my observations for the current testnet it takes about 7–11 hours to update epoch number. Some actions like becoming an active validator, unstake tokens from a delegator require several epochs to complete since transaction creation.</p><p>In episode 3 we inserted some weird link to the browser to s̶h̶a̶r̶e̶ ̶w̶i̶t̶h̶ ̶e̶v̶e̶r̶y̶o̶n̶e̶ ̶y̶o̶u̶r̶ ̶b̶r̶o̶w̶s̶i̶n̶g̶ ̶h̶i̶s̶t̶o̶r̶y̶ actually link your wallet with your server so that you can perform any actions there are on ui from your terminal: stake near, send near etc.</p><p>Also in the same episode we converted near code to something your server can understand and run. When the new code with fixes and improvements from the team is available (recommended commit is updated) we should repeat the same procedure. This could be done with the following command:</p><pre>cd /root/nearcore &amp;&amp; git fetch &amp;&amp; commit=$(curl <a href="https://raw.githubusercontent.com/near/stakewars-iii/main/commit.md">https://raw.githubusercontent.com/near/stakewars-iii/main/commit.md</a>) &amp;&amp; git checkout $commit &amp;&amp; cargo build -p neard --release --features shardnet &amp;&amp; cd ..</pre><p>wait until it is finished and restart your node</p><pre>systemctl restart neard.service</pre><p>Note that sometimes this won’t be enough and extra actions should be done like updating config file, removing data folder etc.</p><p>And that’s it for now. Hopefully after going through the article near will be always with and you will embrace the shardnet side of the chain. If you found it useful don’t be shy to hit the 👏 button or delegate some test near tokens to my staking pool: <strong>dewit.factory.shardnet.near</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*Fb0TxUfPw_4jF0dawj2xng.png" /></figure><p>If noticed some issues or a question you have, a comments section or my discord: sanchous#5793 can use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8ee44691aef" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>