<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xmlns:tt="http://teletype.in/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>@xni</title><generator>teletype.in</generator><description><![CDATA[@xni]]></description><link>https://teletype.in/@xni?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><atom:link rel="self" type="application/rss+xml" href="https://teletype.in/rss/xni?offset=0"></atom:link><atom:link rel="next" type="application/rss+xml" href="https://teletype.in/rss/xni?offset=10"></atom:link><atom:link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></atom:link><pubDate>Sat, 11 Apr 2026 16:00:39 GMT</pubDate><lastBuildDate>Sat, 11 Apr 2026 16:00:39 GMT</lastBuildDate><item><guid isPermaLink="true">https://teletype.in/@xni/poorari2</guid><link>https://teletype.in/@xni/poorari2?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/poorari2?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>ARI hack v.2</title><pubDate>Mon, 30 Dec 2024 10:59:29 GMT</pubDate><description><![CDATA[Транзакция 1. Transaction 5s4cQNNg7gTHd75Qsngu8c8sVFpeGV2KpyBmuxNh6PeSXej3NpKwSzefnr9yGyWKq3kkYuep3LvA3LFzasnxkET2]]></description><content:encoded><![CDATA[
  <p id="3DGF">Транзакция 1. <a href="https://solscan.io/tx/5s4cQNNg7gTHd75Qsngu8c8sVFpeGV2KpyBmuxNh6PeSXej3NpKwSzefnr9yGyWKq3kkYuep3LvA3LFzasnxkET2" target="_blank">Transaction 5s4cQNNg7gTHd75Qsngu8c8sVFpeGV2KpyBmuxNh6PeSXej3NpKwSzefnr9yGyWKq3kkYuep3LvA3LFzasnxkET2</a></p>
  <p id="2je9">Сендвичер продает абсолютно все свои SOL (10к) и покупает USDT. Тут курс очень плохой, 1 SOL = 40$, так как в пуле не так много ликвидности.</p>
  <p id="IYHi">Почему он это делает? Так как следующей по мнению сендвичера идет транзакция</p>
  <p id="AvrE"><a href="https://solscan.io/tx/25eQDrv4NkLwQsFYMGpi5d1cZ5w6A7TrWDJvBkXZrMHGd5JrnF447cTE9EtGZDu8N5yLQ8hLHDkcEpnHwAGeQeKq" target="_blank">Transaction 25eQDrv4NkLwQsFYMGpi5d1cZ5w6A7TrWDJvBkXZrMHGd5JrnF447cTE9EtGZDu8N5yLQ8hLHDkcEpnHwAGeQeKq</a> (продажа 491 СОЛ)</p>
  <p id="l2yI">То есть логика такая: есть большая продажа СОЛ. Я продам все свои, потом продаст жертва, потом я откуплю назад.</p>
  <p id="SlV9">До этого момента все идет по плану сендвичера.</p>
  <p id="qyti">Но затем должна идти закрывающая транзакция сендвича - откуп 10к SOL обратно по более интересной цене (и тем самым прирост USDT).</p>
  <p id="3359">Вместо этого борец с сендвичем сделал в бандле следующее <a href="https://solscan.io/tx/1SPzaZU2AhmT78EAV8u3WGybm26upVBuyZfpbo698JryVDfoyLYKJVD2rRdU2Q81heQFbvZqTbhu64E27EhofJ7" target="_blank">Transaction 1SPzaZU2AhmT78EAV8u3WGybm26upVBuyZfpbo698JryVDfoyLYKJVD2rRdU2Q81heQFbvZqTbhu64E27EhofJ7</a></p>
  <p id="CVuP">Занял 400к во флеш-лоане. Использовал их чтобы купить 10к сол по выгодной цене, вернул в протокол 10633 СОЛ. (Я думаю в маргинфи есть какой-то оракл позволяющий возвращать не в той же валюте что брал лоан, иначе я не понимаю как это работает, то есть типа он должен был вернуть НЕ МЕНЕЕ 2000 СОЛ, вернул 10к, ну окей, 8000 останутся на балансе юзера).</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/ZGY6w5o9PYy</guid><link>https://teletype.in/@xni/ZGY6w5o9PYy?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/ZGY6w5o9PYy?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>Using UUPS proxy in foundry</title><pubDate>Sat, 04 Mar 2023 16:56:49 GMT</pubDate><description><![CDATA[UUPS proxy is said to be a novel way or doing EVM proxies. It is more reliable and have a nice feature of being able to become immutable when the time comes.]]></description><content:encoded><![CDATA[
  <p id="DNZP">UUPS proxy is said to be a novel way or doing EVM proxies. It is more reliable and have a nice feature of being able to become immutable when the time comes.</p>
  <p id="SyEq">The problem is though, that it comes usually bundled with hardhat-upgrades module by OpenZeppelin which hides the process. In this article I&#x27;m going to show what is the minimal amount of steps needed to deploy UUPS proxy from foundry.</p>
  <p id="7aiB">First thing to do is to add a module (if you haven&#x27;t already) for openzeppelin contracts.</p>
  <pre id="Xk3D">$ forge i https://github.com/OpenZeppelin/openzeppelin-contracts.git</pre>
  <p id="BwQr">I will be working with my real contract, which overall looks like:</p>
  <pre id="JwFp">contract ENGCReferalProgram is Initializable,
                               UUPSUpgradeable,
                               OwnableUpgradeable {
    // ...
    function _authorizeUpgrade(
        address newImplementation
    )internal virtual override onlyOwner {}
}</pre>
  <p id="RIQy">And I&#x27;m going to write a test, which deploys this proxy in its <code>setUp</code> method. It is actually pretty easy.</p>
  <pre id="Pelh">// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import &quot;forge-std/Test.sol&quot;;

import {ENGCReferalProgram} from &quot;../src/ReferalProgram.sol&quot;;
import {IENGC} from &quot;../src/IENGC.sol&quot;;

import &quot;openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol&quot;;


contract ReferalProgramTest is Test {
    ENGCReferalProgram public rp;

    function setUp() public {
        ENGCReferalProgram impl = new ENGCReferalProgram();
        ERC1967Proxy proxy = new ERC1967Proxy(address(impl), &quot;&quot;);
        rp = ENGCReferalProgram(address(proxy));
        rp.initialize();
        rp.setNftContractAddress(IENGC(address(this)));
    }

    function testChangeImpl() public {
        addNodesToRoot();
        ENGCReferalProgram impl2 = new ENGCReferalProgram();
        rp.upgradeTo(address(impl2));
        assertEq(rp.getTokenLevel(0xffffff), 3);
    }

    function testFailChangeImpl() public {
        ENGCReferalProgram impl2 = new ENGCReferalProgram();
        vm.prank(0x094BAfcb40a0226d210E51E9ee4dA0FbFe99D326);
        rp.upgradeTo(address(impl2));
    }</pre>
  <p id="I8l7">If you want to get more into details on how to pass parameters to initializers etc. you can find more detail <a href="https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/master/packages/plugin-hardhat/src/deploy-proxy.ts#L35" target="_blank">here</a>.</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/_gGofHpYHq_</guid><link>https://teletype.in/@xni/_gGofHpYHq_?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/_gGofHpYHq_?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>Multiple Inheritance in Solidity</title><pubDate>Sun, 09 Oct 2022 14:30:11 GMT</pubDate><description><![CDATA[There are lots of documentation about C3 and so on, but I feel that example is better. Jump with me, it won't take long.]]></description><content:encoded><![CDATA[
  <p id="i7h5">There are lots of documentation about C3 and so on, but I feel that example is better. Jump with me, it won&#x27;t take long.</p>
  <pre id="MmKD">// SPDX-License-Identifier: GPL-3.0

pragma solidity &gt;=0.7.0 &lt;0.9.0;

abstract contract A {
    event E(int);

    function Hello() external virtual;
    function Hello2() external virtual;
}

contract B is A {
    function Hello() public override virtual {
        emit E(2);
    }
    function Hello2() public override virtual {
        emit E(2);
    }
}

contract C is A {
    function Hello() public override virtual {
        emit E(3);
    }
    function Hello2() public override virtual {
        emit E(3);
    }
}

contract D is B, C {
    function Hello() public override(B, C) {
        super.Hello();
    }
    function Hello2() public override(C, B) {
        super.Hello2();
    }
}

contract D2 is C, B {
    function Hello() public override(B, C) {
        super.Hello();
    }
    function Hello2() public override(C, B) {
        super.Hello2();
    }
}

contract D3 is C, B {
    function Hello() public override(B, C) {
        B.Hello();
        C.Hello();
    }
    function Hello2() public override(C, B) {
        C.Hello2();
        B.Hello2();
    }
}</pre>
  <p id="Hm51">And results (printing events):</p>
  <pre id="S9R0">D.Hello
[&quot;0x0000000000000000000000000000000000000000000000000000000000000003&quot;] 
D.Hello2
[&quot;0x0000000000000000000000000000000000000000000000000000000000000003&quot;] 
D2.Hello
[&quot;0x0000000000000000000000000000000000000000000000000000000000000002&quot;] 
D2.Hello2
[&quot;0x0000000000000000000000000000000000000000000000000000000000000002&quot;] 
D3.Hello
[&quot;0x0000000000000000000000000000000000000000000000000000000000000002&quot;,&quot;0x0000000000000000000000000000000000000000000000000000000000000003&quot;] 
D3.Hello2
[&quot;0x0000000000000000000000000000000000000000000000000000000000000003&quot;,&quot;0x0000000000000000000000000000000000000000000000000000000000000002&quot;]</pre>
  <p id="UR2Q">If you are familiar with Python, this is confusing, as in Python super() traverses the whole hierarcy:</p>
  <pre id="IksZ">class A:
    def Hello(self):
        print(&quot;A&quot;)

class B(A):
    def Hello(self):
        print(&quot;B&quot;)
        super().Hello()

class C(A):
    def Hello(self):
        print(&quot;C&quot;)
        super().Hello()

class D(B,C):
    def Hello(self):
        print(&quot;D&quot;)
        super().Hello()

class D2(C,B):
    def Hello(self):
        print(&quot;D2&quot;)
        super().Hello()

D().Hello()
D2().Hello()</pre>
  <p id="XdoH">Running...</p>
  <pre id="cJio">D
B
C
A

D2
C
B
A</pre>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/GWcbuSSC7C9</guid><link>https://teletype.in/@xni/GWcbuSSC7C9?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/GWcbuSSC7C9?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>NEAR: Bootstrapping with at a speed of light</title><pubDate>Wed, 20 Jul 2022 23:08:29 GMT</pubDate><description><![CDATA[In ValiDAO our main emphasize is repeatability and standardization of the node installation process. Thus we are always creating an ansible playbook to install a node. And u know, usually I am always in doubt, if we are overcomplicating things for nothing? But for NEAR ya, it was worth it. The network has restarted twice already, and I love it, it means that the team is testing things, searching for bugs and vulnerabilities. And our playbook was reused 3 times to re-create a node from scratch because there was already a number of hard forks.]]></description><content:encoded><![CDATA[
  <p id="CnT3">In ValiDAO our main emphasize is repeatability and standardization of the node installation process. Thus we are always creating an ansible playbook to install a node. And u know, usually I am always in doubt, if we are overcomplicating things for nothing? But for NEAR ya, it was worth it. The network has restarted twice already, and I love it, it means that the team is testing things, searching for bugs and vulnerabilities. And our playbook was reused 3 times to re-create a node from scratch because there was already a number of hard forks.</p>
  <p id="IwrL">So, in this article I&#x27;m going to explain how to use our ansible playbook instead of just following instruction from official NEAR&#x27;s github. This article assumes you knowledge of ansible and that you have it installed.</p>
  <p id="lHrU">The first step is to checkout our <a href="https://github.com/ValiDAO/nodes/tree/main/near" target="_blank">repo</a>:</p>
  <pre id="FgO4">git clone https://github.com/ValiDAO/nodes.git</pre>
  <p id="Pk2A">Change the directory:</p>
  <pre id="mJg5">cd nodes/near</pre>
  <p id="e1a3">And run the scenario:</p>
  <pre id="qH0A">ansible-playbook -l your-server.fr install.yml</pre>
  <p id="6vU3">Once it is ready, your server has a node setup and running, but at the moment it is not connected to your wallet. So the next step is to register on <a href="https://wallet.shardnet.near.org/" target="_blank">https://wallet.shardnet.near.org/</a> . Once it is there, return back to your node and run:</p>
  <pre id="lrKm">source ~/.bashrc &amp;&amp; near login</pre>
  <p id="npOw">This will give you the link, which you should enter to your browser, allow your wallet to sign it, and once it is ready, you will see a browser redirected to 127.0.0.1 and giving an error. It is all as expected, don&#x27;t worry. Return back to the terminal and put your login to the terminal (e.g. validao.shardnet.near). Once done, some extra steps need to be done. We intentionally haven&#x27;t automated them, as human supervising and check is important on this stage.</p>
  <pre id="8e94">./near_create_pool.sh</pre>
  <p id="jrp6">It will do everything automatically, but will ask you to confirm everything it does. So, if everything is good, press Enter.</p>
  <pre id="jE2x">./near_stake.sh</pre>
  <p id="fKal">This will stake some coins to your pool. The script will ask you for amount. Insert something like 350 and press Enter.</p>
  <p id="Y55H">Actually that&#x27;s it! Congratulations.</p>
  <p id="hWFK">There are some helper scripts which are included to the playbook as well:</p>
  <p id="LyvA"><code>near_restart_after_hardwork.sh</code> it does exactly what it says. Prepares your node to restart after a cluster hardfork.</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/nxhXgiyeukl</guid><link>https://teletype.in/@xni/nxhXgiyeukl?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/nxhXgiyeukl?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>Mina: converting private key file to AURO private key</title><pubDate>Sat, 19 Mar 2022 01:09:18 GMT</pubDate><description><![CDATA[<img src="https://img4.teletype.in/files/b9/6c/b96cba0a-f059-41b3-a56f-9558ec089f37.png"></img>Give it a name, select &quot;Private key&quot;, Paste it from the above step (EKFCHutVbp2sG6NgMybGfSCdurXfLRPw8qqpGHS4VCEdzRHxEmu5). ]]></description><content:encoded><![CDATA[
  <ul id="ZoS2">
    <li id="KNaU">Rent a server, Ubuntu, any CPU, any RAM, 10Gb disk. You will need it for 5 minutes.</li>
    <li id="l1ZX">Install mina:</li>
  </ul>
  <pre id="XZNb">echo &quot;deb [trusted=yes] http://packages.o1test.net $(lsb_release -cs) stable&quot; | sudo tee /etc/apt/sources.list.d/mina.list
sudo apt-get update
sudo apt-get install -y curl unzip mina-mainnet=1.3.0-9b0369c</pre>
  <ul id="sFUf">
    <li id="RuIb">Paste you file (make sure to replace your file data between &#x60;{&#x60; and &#x60;}&#x60;):</li>
  </ul>
  <pre id="edjL">echo &#x27;{&quot;box_primitive&quot;:&quot;xsalsa20poly1305&quot;,&quot;pw_primitive&quot;:&quot;argon2i&quot;,&quot;nonce&quot;:&quot;8jGJ2KTrG2xqbJCozj4vbjKhZZKBhXKfaNDLRN4&quot;,&quot;pwsalt&quot;:&quot;BYHxrJLkYo5TmDLp5RgP3VqbW6Py&quot;,&quot;pwdiff&quot;:[134217728,6],&quot;ciphertext&quot;:&quot;AQyvFhBG9DQ9VA8f1MXrKfHqfzDFoiFNMxabHJf2EQq2rbYpkBC5sYfPaKGdDEmM5roAbkFGC&quot;}&#x27; &gt; ~/mina.wallet &amp;&amp; chmod 500 ~/mina.wallet

mina advanced dump-keypair --privkey-path ~/mina.wallet
# Public key: B62qm9kEyE3vZMGamvSQXURx1NXEFjCx4C1SQAjV9KX9mj9ESb78KC1
# Private key: EKFCHutVbp2sG6NgMybGfSCdurXfLRPw8qqpGHS4VCEdzRHxEmu5</pre>
  <ul id="EQ4U">
    <li id="EEB5">Now we have a private key, use it in AURO:</li>
  </ul>
  <figure id="FDbX" class="m_original">
    <img src="https://img4.teletype.in/files/b9/6c/b96cba0a-f059-41b3-a56f-9558ec089f37.png" width="468" />
    <figcaption>Step 1</figcaption>
  </figure>
  <figure id="05nO" class="m_original">
    <img src="https://img2.teletype.in/files/12/d0/12d0dda5-f5f5-4652-bedc-9a6cc308eedf.png" width="475" />
    <figcaption>Step 2</figcaption>
  </figure>
  <p id="21Rz"></p>
  <p id="ESR2">Give it a name, select &quot;Private key&quot;, Paste it from the above step (EKFCHutVbp2sG6NgMybGfSCdurXfLRPw8qqpGHS4VCEdzRHxEmu5). </p>
  <p id="ksTH">Done. Don&#x27;t forget to shut down the VPS you rented.</p>
  <p id="qcvu">Please send any donations to support 🇺🇦</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/DNPh7axOb5L</guid><link>https://teletype.in/@xni/DNPh7axOb5L?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/DNPh7axOb5L?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>StableCoins on Solana</title><pubDate>Fri, 11 Mar 2022 10:04:28 GMT</pubDate><media:content medium="image" url="https://img2.teletype.in/files/1e/c3/1ec37c7c-0ae9-43cc-be96-5d7be13af2aa.png"></media:content><description><![CDATA[<img src="https://img4.teletype.in/files/33/c9/33c93966-e2ab-43fa-a30d-bf497399df6d.png"></img>I saw that there was a spike of interest to non-USA based stablecoins, as a result of fear that funds could be blacklisted.]]></description><content:encoded><![CDATA[
  <p id="aJgL">I saw that there was a spike of <a href="https://teletype.in/@notothemoon/vk0N8jdiqGd" target="_blank">interest</a> to non-USA based stablecoins, as a result of fear that funds could be blacklisted.</p>
  <p id="lgvM">I&#x27;ve decided to check what&#x27;s going on in Solana infrastructure.</p>
  <p id="YMIg">Both Tether and Centre has their token on Solana: <a href="https://raw.githubusercontent.com/solana-labs/token-list/main/src/tokens/solana.tokenlist.json" target="_blank">https://raw.githubusercontent.com/solana-labs/token-list/main/src/tokens/solana.tokenlist.json</a> , exchanges to support them, there are gateways etc. I think they are legit.</p>
  <p id="WMFc">From the abovementioned document we can get the &quot;tokenIDs&quot; of USDT/USDC.</p>
  <p id="mwKX"><code>Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB</code>and <code>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</code></p>
  <p id="flst">Now, we can see that both of these addresses are owned by <code>TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA</code></p>
  <figure id="LtoB" class="m_column">
    <img src="https://img4.teletype.in/files/33/c9/33c93966-e2ab-43fa-a30d-bf497399df6d.png" width="1117" />
  </figure>
  <p id="0HIL"><code>TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA</code>is a smart contract on solana to deal with tokens. In contrast to Ethereum, where everyone have their own contract, in Solana you can write you own contract or reuse the standard one. Both are using the standard one. Checking its <a href="https://github.com/solana-labs/solana-program-library/pull/297" target="_blank">code</a> it is easy to see, that the issuer of a token is capable of freezing the account. Funds are not safu :(</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/poubbCZvqjq</guid><link>https://teletype.in/@xni/poubbCZvqjq?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/poubbCZvqjq?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>Как взламывали сейл Пломбира. Каждый мог</title><pubDate>Mon, 13 Sep 2021 23:09:31 GMT</pubDate><media:content medium="image" url="https://img3.teletype.in/files/66/7d/667d56bf-669f-48f3-823d-8955cc4dcc00.png"></media:content><description><![CDATA[<img src="https://img3.teletype.in/files/a7/d2/a7d22c78-b431-4bf3-ae0d-af23258a280b.png"></img>Тут я расскажу как был устроен смарт контракт и почему &quot;надо было просто нанять кодеров&quot; не работает. Надо было нанять хороших кодеров]]></description><content:encoded><![CDATA[
  <p id="3orD">Тут я расскажу как был устроен смарт контракт и почему &quot;надо было просто нанять кодеров&quot; не работает. Надо было нанять хороших кодеров</p>
  <p id="CsPs">Сама информация о контракте появилась часа за 2 до начала, а с учетом переноса, часов за 5. Просто был трансфер 16kk $GEL и стало понятно куда.</p>
  <p id="koMJ">Когда мы узнали <a href="https://etherscan.io/address/0x5898d2ae0745c8d09762bac50fd9f34a2a95a563" target="_blank">адрес контракта </a>стало возможно прочитать, что он позволяет делать, прямо в etherscan.</p>
  <figure id="5ZN6" class="m_column">
    <img src="https://img3.teletype.in/files/a7/d2/a7d22c78-b431-4bf3-ae0d-af23258a280b.png" width="1004" />
    <figcaption>В нашем случае надо работать не с контрактом а с тем что &quot;под&quot; ним.</figcaption>
  </figure>
  <figure id="IXre" class="m_column">
    <img src="https://img2.teletype.in/files/92/24/9224b65c-f635-4dbf-8fc6-94443d213f8c.png" width="990" />
  </figure>
  <p id="W2ms">Видно много-много точек взаимодействия с контрактом, все они явно имеют названия связанные с сейлом. Но нас интересует конечно же buyDolphin </p>
  <figure id="CKdE" class="m_original">
    <img src="https://img2.teletype.in/files/99/9b/999bd5d6-e03d-4acb-9018-0b756f570316.png" width="794" />
  </figure>
  <p id="ORv3">&quot;Дальше дело техники - жмем Connect to web3 и взаимодействуем, токен наш!&quot;. Так говорят нам знатоки.</p>
  <figure id="Ufn1" class="m_original">
    <img src="https://img2.teletype.in/files/50/ab/50abb581-76ef-4d4d-aebb-86cd6b0e3dfb.png" width="897" />
  </figure>
  <p id="zI2f">А что писать в поле <strong>signature</strong>?</p>
  <p id="ob7Q">На этом простой учебник о взаимодействии со смарт-контрактами заканчивается и начинается методичка по криптографии.</p>
  <p id="bO0x">Помочь ответить на вопрос что такое signature мне смог другой метод isDolphin. Он тоже принимает на вход этот аргумент но для работы с ним не нужно платить комиссии.</p>
  <p id="1XB7">Посмотрим код <a href="https://etherscan.io/address/0x4a80d0726f91d8d8ca46da22dfa55049465f5d1a" target="_blank">базового контракта</a>: </p>
  <figure id="qgJB" class="m_original">
    <img src="https://img3.teletype.in/files/6b/65/6b654b1f-7f6e-4740-9dad-16dc892be5d4.png" width="672" />
  </figure>
  <p id="se0g">Эта функция проверяет, дельфин ли вы. Для этого мы проверяем, что <strong>signer -</strong> это тот, кто подписал ваш адрес и получил в результате <strong>signature</strong>. Другими словами, на их стороне, в процессе подготовки контракта, ими был создан <strong>signer</strong>. Он для каждого из ключей в whitelist создал <strong>signature</strong>, причем таким образом, что имея адрес ключа и signature можно проверить что signature создана signer-ом. Если ты не signer, то создать такую же ты не можешь. Только проверить.</p>
  <p id="BF4E">Сама идея sorbet платформы в том, что signature становится известной строго в указанное время. И только после этого, предоставляя правильный signature, мы можем вызывать методы контракта. Можно ли было узнать signature до начала сейла? И вот тут кроется главный фейл сегодняшнего дня. Кажется, что можно было. Если вы видели, что ваш статус ОК, и вы в вайтлисте и дельфин, значит вы уже провзаимодействовали с контрактом.</p>
  <figure id="pwVa" class="m_original">
    <img src="https://img2.teletype.in/files/96/64/9664b4a4-e721-4d70-9caa-4e2f06935bf5.png" width="597" />
    <figcaption>Chrome Web-Developer tools на странице показываем нам нашу сигнатуру</figcaption>
  </figure>
  <p id="UMBq">То есть уже можно было кидать транзакции на покупку. И вот даже есть один <a href="https://etherscan.io/tx/0x5616d74d12e4453094c42b56a8cb9ef433b9d9c6dcf54d42e0917394e4d7e5a7" target="_blank">кандидат,</a> сделавший все довольно заранее. Подставляя его адрес и сигнатуру видим, что он все понял.</p>
  <figure id="PSCh" class="m_column">
    <img src="https://img1.teletype.in/files/0c/a5/0ca5229d-9317-444b-864c-b68eeba87ff4.png" width="1219" />
  </figure>
  <p id="oxJS">Собственно, исходя из этого можно понять что те, кто уделил час времени такому анализу вполне могли войти в блоки первыми сделав вид что входят за первые 2 секунды, готовясь на самом деле заблаговременно. <a href="https://etherscan.io/address/0x847c8c905cce6129952c30b3f3d74792b48aae16#tokentxns" target="_blank">Да же</a>? </p>
  <p id="HDDV">Ну и напоследок простой <a href="https://pastebin.com/M0gph4Gb" target="_blank">контракт</a> чтобы продемонстрировать как работает signature. Разработал его в remix по-быстрому.</p>
  <p id="Bioc">Подставляем вот такие параметры</p>
  <p id="CnAJ">{ &quot;address _address&quot;: &quot;0x7D852B24Ea94504F03743289131034bFb5DB954d&quot;, &quot;bytes signature&quot;: &quot;0xf14c4b5004d205155cb1a722b4e0424decd4f89f82e4bc70020f12db16312edf32042e759d978cdbb5c9cbd713d777e0dff4d96917c2f370d06f73d8da1a17d51c&quot; }</p>
  <p id="UhQ3">получаем вычисленный адрес signer { &quot;0&quot;: &quot;address: 0x1aF41728737f8bC40E9eA1a9E1A3b19F4Db3Bdf9&quot; }. Это собственно адрес разработчика контракта GEL.</p>
  <p id="U1Ke">Полезное знание.</p>
  <p id="3LyJ">Пишите если думаете что мы можем сотрудничать. smartlemon@protonmail.com </p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/5W7B2pAHg1k</guid><link>https://teletype.in/@xni/5W7B2pAHg1k?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/5W7B2pAHg1k?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>Solana, part3. 😌</title><pubDate>Wed, 08 Sep 2021 00:10:49 GMT</pubDate><description><![CDATA[This post is going to be short. So, we have accounts. Accounts are kind-a files. The questions I had:]]></description><content:encoded><![CDATA[
  <p id="GvSH">This post is going to be short. So, we have accounts. Accounts are kind-a files. The questions I had:</p>
  <ul id="sjOO">
    <li id="9J3q">if you can send tokens to accounts</li>
    <li id="Rc4e">if you are inside of a program, can you query account&#x27;s funds.</li>
  </ul>
  <p id="XyqU">Answers are: yes, you can send tokens to accounts, if they are not executable, this is pretty important. And yes.</p>
  <p id="iKXb">So, I&#x27;ve transferred some funds straight from my wallet to the account I created by <code>createAccount</code>request , it worked. It is really straighforward, so I am not attaching the code.</p>
  <p id="2PSv">Now inside of the contract: <code>msg!(&quot;lamports={}&quot;, account.lamports.borrow()); </code>does the thing.</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/d90hnKhYU0A</guid><link>https://teletype.in/@xni/d90hnKhYU0A?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/d90hnKhYU0A?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>Solana, post 2 💥</title><pubDate>Mon, 06 Sep 2021 00:45:20 GMT</pubDate><description><![CDATA[In the previous host we setup our env: server, wallet + HTML page. Now it is time to talk about programming model.]]></description><content:encoded><![CDATA[
  <p id="tfa5">In the <a href="https://teletype.in/@xni/F7BndlhXAQ_" target="_blank">previous</a> host we setup our env: server, wallet + HTML page. Now it is time to talk about programming model.</p>
  <p id="Ilji">If you don&#x27;t know about solitidy, you are blessed, because solana is so different that it took me really a long time to understand it. Try to forget everything as much as you can.</p>
  <p id="dd0U">So, the first thing we did yesterday, was creating a program account. What it means exactly - we have asked Solana to create a storage, where we placed the executable of our code. As a reminder:</p>
  <pre id="T60e">solana program deploy $HOME/example-helloworld/dist/program/helloworld.so --program-id dist/program/helloworld-keypair.json</pre>
  <p id="7uiE">Generally, it is a storage for ./a.out. Today we are going to create a &quot;file&quot; (it is called account) for the user&#x27;s specific needs. Each user will have their own files. Then we will give to our ./a.out (main executable) a write access to our user&#x27;s file. 3, 2, 1, GO!</p>
  <p id="fjQX">So, the first part is to generate an account from the client side, transfer some value (called lamports) to it, and then transfer an ownership to this account to the program.</p>
  <pre id="7X7b">// This is our account address, randomly generated.
const keypair = solanaWeb3.Keypair.generate();
const instruction = solanaWeb3.SystemProgram.createAccount({
    keys: [
        { pubkey: solana.publicKey, isSigner: true, isWritable: true },
        { pubkey: keypair.publicKey, isSigner: true, isWritable: true },
    ],
    fromPubkey: solana.publicKey,
    newAccountPubkey: keypair.publicKey,
    lamports: 10000000,
    space: 10000,
    programId: new solanaWeb3.PublicKey(&quot;3cbqMCdkwiTbWyCv3i7gss8STqGw6ggzvg8ztt5msnD4&quot;),
});
// ^^^^^ programId is an owner of the account,
//       keys is an array of keys whose signatures are required to perform
//       this operation, this is our wallet (as some funds will be transferred)
//       and the account, as it&#x27;s ownership will be transferred.

const bh = (await connection.getRecentBlockhash()).blockhash;
const transaction = new solanaWeb3.Transaction({
    feePayer: window.solana.publicKey,
    recentBlockhash: bh,
});
transaction.add(instruction);

// Walled signature is generated by the line after the next one.
// And the next line is to sign a transaction by the account&#x27;s key.
transaction.partialSign(keypair);
const signedTransaction = await window.solana.signTransaction(transaction);

await connection.sendRawTransaction(signedTransaction.serialize());

// Checking we have it...
const acc = await connection.getAccountInfo(keypair.publicKey);
console.log(acc);</pre>
  <p id="EoFI">That&#x27;s it for today!</p>
  <p id="gb1b"><a href="https://teletype.in/@xni/5W7B2pAHg1k" target="_blank">Part</a><a href="https://teletype.in/@xni/5W7B2pAHg1k]" target="_blank"> 3</a></p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@xni/F7BndlhXAQ_</guid><link>https://teletype.in/@xni/F7BndlhXAQ_?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni</link><comments>https://teletype.in/@xni/F7BndlhXAQ_?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=xni#comments</comments><dc:creator>xni</dc:creator><title>My first Solana Project 😍</title><pubDate>Thu, 02 Sep 2021 01:50:07 GMT</pubDate><description><![CDATA[<img src="https://img4.teletype.in/files/3b/5b/3b5b80dc-f870-499d-9742-3b46b81a3fe2.png"></img>So, I've decided to participate in Solana Hackathon. Here I'm going to write down my journey. Part 1 - &quot;Hello world&quot;.]]></description><content:encoded><![CDATA[
  <p id="YuEO">So, I&#x27;ve decided to participate in <a href="https://solana.com/ignition" target="_blank">Solana Hackathon</a>. Here I&#x27;m going to write down my journey. Part 1 - &quot;Hello world&quot;.</p>
  <p id="Xr4W">So, the first thing to do is to install Solana. </p>
  <pre id="K41q">sh -c &quot;$(curl -sSfL https://release.solana.com/v1.7.11/install)&quot;</pre>
  <p id="8Nlz">from the <a href="https://docs.solana.com/cli/install-solana-cli-tools" target="_blank">official guide</a>. And update PATH accordingly.</p>
  <p id="cPFG">Then let&#x27;s download the <a href="https://docs.solana.com/developing/on-chain-programs/examples" target="_blank">hello-world</a> example. I&#x27;m not going to follow it though. Because it uses server-side JavaScript client, and I want to have a browser-side client.</p>
  <p id="8moK">So, skipping CLI part of a readme, straight to building the on-chain part:</p>
  <pre id="k7cY">npm run build:program-rust</pre>
  <p id="xw4L">While it is building, let&#x27;s have a look what we actually have there.</p>
  <p id="3Zbf">The on-chain program starts with some imports and entrypoint specification. Straightforward.</p>
  <p id="qSvL">Ok, we are ready do deploy. So, at first we need to start a local Solana &quot;cluster&quot;, consisting of our own host. I did that by launching <code>solana-test-validator</code> in tmux.</p>
  <p id="U12m">Now, it is useful to familiarize yourself with your wallet id, which can be obtained in this way:</p>
  <pre id="g9iX">$ solana config get
Config File: $HOME/.config/solana/cli/config.yml
RPC URL: http://localhost:8899
WebSocket URL: ws://localhost:8900/ (computed)
Keypair Path: $HOME/.config/solana/id.json
Commitment: confirmed

$ solana-keygen pubkey $HOME/.config/solana/id.json # Keypair Path
9FRakBFwajAdRhfqwLFWAWUuEySs7rcRviMA5xnrHqST</pre>
  <p id="4Iim">By default your key does not have any money, but because the cluster is yours, you can fund it 💸💷🤑</p>
  <pre id="3Tb3">$ solana airdrop 100
$ solana balance
100 SOL</pre>
  <p id="tcMg">Now we have enough resources to deploy the application. The built process has already generated a random &quot;account&quot; for our program. Account is just an &quot;address&quot; of a program, it&#x27;s ID, or whatever. It is a random ID which Solana and other participants will use to refer to our program. This is how to get it:</p>
  <pre id="lkBr">$ solana-keygen pubkey dist/program/helloworld-keypair.json
3cbqMCdkwiTbWyCv3i7gss8STqGw6ggzvg8ztt5msnD4</pre>
  <p id="VtHy">And now we can deploy our binary, and assign it that program ID.</p>
  <pre id="s9iQ">$ solana program deploy $HOME/example-helloworld/dist/program/helloworld.so --program-id dist/program/helloworld-keypair.json
Program Id: 3cbqMCdkwiTbWyCv3i7gss8STqGw6ggzvg8ztt5msnD4</pre>
  <p id="aU2Y">Great!. Something has happened. Now, let&#x27;s have some fun.</p>
  <p id="AqzW">First thing is to forward your ports, because my Solana runs on a remote host, and there is no way to setup a custom RPC address, only &quot;localhost&quot; in the wallet. </p>
  <pre id="PpI1">(localhost) $ ssh -L 8899:127.0.0.1:8899 MY.IP.ADD.RESS</pre>
  <p id="MmSt">BTW. Wallet. Just install <a href="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa/related" target="_blank">Phantom </a>wallet in your browser. Set network to be 127.0.0.1:8899 and import your key (private key is a contents of $<code>$HOME/.config/solana/id.json)</code> on your remote host.</p>
  <p id="Onpi">Sorry, guys, can not resist a temptation:</p>
  <figure id="dC8f" class="m_original">
    <img src="https://img4.teletype.in/files/3b/5b/3b5b80dc-f870-499d-9742-3b46b81a3fe2.png" width="452" />
  </figure>
  <p id="1tif">Airdrop 100 makes you feel happy :) Haha!</p>
  <p id="a5Zc">So, we are almost there. The last thing to do is to make a JavaScript call to your on-chain program.</p>
  <p id="6hIZ">Some trivial JavaScript to make it work was:</p>
  <pre id="EObY">&lt;html&gt;
        &lt;head&gt;
                &lt;script src=&quot;https://unpkg.com/@solana/web3.js@latest/lib/index.iife.js&quot;&gt;&lt;/script&gt;
        &lt;/head&gt;
        &lt;body&gt;
                &lt;button id=&quot;btn-connect&quot; disabled&gt;Connect&lt;/button&gt;
                &lt;span id=&quot;connection-status&quot;&gt;&lt;/span&gt;|
                &lt;button id=&quot;btn-send&quot; disabled&gt;Send&lt;/button&gt;
                &lt;script type=&quot;text/javascript&quot;&gt;
window.addEventListener(&#x27;load&#x27;, function() {
        const btn_connect = window.document.getElementById(&quot;btn-connect&quot;);
        btn_connect.disabled = false;
        btn_connect.addEventListener(&#x27;click&#x27;, () =&gt; {
                const connection_status = window.document.getElementById(&quot;connection-status&quot;);
                connection_status.innerHTML = &quot;Connecting&quot;;
                window.solana.on(&quot;connect&quot;, () =&gt; {
                        connection_status.innerHTML = &#x60;Connected as ${solana.publicKey.toString()}&#x60;;
                        const btn_send = document.getElementById(&quot;btn-send&quot;);
                        btn_send.disabled = false;
                        btn_send.addEventListener(&#x27;click&#x27;, async () =&gt; {
                                const connection = new solanaWeb3.Connection(&quot;http://127.0.0.1:8899&quot;);
                                const instruction = new solanaWeb3.TransactionInstruction({
                                        keys: [{pubkey: new solanaWeb3.PublicKey(&quot;9FRakBFwajAdRhfqwLFWAWUuEySs7rcRviMA5xnrHqST&quot;), isSigner: false, isWritable: true}], // All instructions are hellos
                                        programId: new solanaWeb3.PublicKey(&quot;3cbqMCdkwiTbWyCv3i7gss8STqGw6ggzvg8ztt5msnD4&quot;),
                                        // data: Buffer.alloc(0),
                                });
                                const bh = (
                                              await connection.getRecentBlockhash() ).blockhash;
                                console.log(bh);
                                const transaction = new solanaWeb3.Transaction({
                                        feePayer: window.solana.publicKey,
                                        recentBlockhash: bh,
                                });
                                transaction.add(instruction);
                                const signedTransaction = await window.solana.signTransaction(transaction);
                                await connection.sendRawTransaction(signedTransaction.serialize());
                                alert(&#x27;done&#x27;);
                        });
                });
                window.solana.connect();
        });
});
                &lt;/script&gt;
        &lt;/body&gt;
&lt;/html&gt;</pre>
  <p id="W6MI">Sorry for the codestyle, it is really highly experimental.</p>
  <p id="uiS6">I found those resources very useful:</p>
  <ul id="gxoB">
    <li id="D1jl"><a href="https://solana-labs.github.io/solana-web3.js/classes/Transaction.html" target="_blank">https://solana-labs.github.io/solana-web3.js/classes/Transaction.html</a></li>
    <li id="fVwN"><a href="https://github.com/phantom-labs/docs/blob/866e96237d8b2addcd5a58dc31b314237b40ea4f/integrating/sending-a-transaction.md" target="_blank">https://github.com/phantom-labs/docs/blob/866e96237d8b2addcd5a58dc31b314237b40ea4f/integrating/sending-a-transaction.md</a></li>
  </ul>
  <p id="sXY3">Hope you found your answers here!</p>
  <figure id="FlvH" class="m_original">
    <img src="https://img2.teletype.in/files/d0/f9/d0f97070-7a36-4880-a326-3fd49bff9e70.png" width="912" />
    <figcaption>Well, we did something wrong, but our message eventually reached the cluster, because messages are from there.</figcaption>
  </figure>
  <p id="2rKt">The <a href="https://teletype.in/@xni/d90hnKhYU0A" target="_blank">second</a> part is ready!</p>

]]></content:encoded></item></channel></rss>