<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nat on Medium]]></title>
        <description><![CDATA[Stories by Nat on Medium]]></description>
        <link>https://medium.com/@nazt?source=rss-95773410378d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KN30hjoHIOUfutgP-bYuEw.jpeg</url>
            <title>Stories by Nat on Medium</title>
            <link>https://medium.com/@nazt?source=rss-95773410378d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 09:00:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nazt/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ขึ้น Private Blockchain (Clique — proof-of-authority) จากการตามรอย JFIN Chain]]></title>
            <link>https://nazt.medium.com/%E0%B8%82%E0%B8%B6%E0%B9%89%E0%B8%99-private-blockchain-clique-proof-of-authority-%E0%B8%88%E0%B8%B2%E0%B8%81%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%95%E0%B8%B2%E0%B8%A1%E0%B8%A3%E0%B8%AD%E0%B8%A2-jfin-chain-357c0c481d1e?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/357c0c481d1e</guid>
            <category><![CDATA[poa]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[jfin]]></category>
            <category><![CDATA[clique]]></category>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Mon, 02 Jan 2023 09:38:50 GMT</pubDate>
            <atom:updated>2023-01-02T09:56:49.275Z</atom:updated>
            <content:encoded><![CDATA[<h3>ขึ้น Private Blockchain (Clique — proof-of-authority) จากการตามรอย JFIN Chain</h3><p>เขียนถึง JBC Blockchain มาหลายที แต่ความสุดยอดทางวิศวกรรม และการลุยป่าอันสุดโหด ยกให้ JFIN Blockchain ผมก็ได้เริ่มศึกษาตามพี่โดมมาจากป่านี้แหละครับ</p><p>JFIN Blockchain ถ้าตาม <a href="https://github.com/jfinchain/node/blob/main/mainnet/genesis.json">genesis.json</a> แล้ว มันเป็น Consensus แบบ Parlia ซึ่ง Parlia นั้นเป็นยังไงก็ไม่รู้แต่เค้า บอกเอาไว้ว่า</p><h4>Parlia</h4><p>The implement of the consensus engine is named as <strong>Parlia</strong> which is similar to <a href="https://ethereum-magicians.org/t/eip-225-clique-proof-of-authority-consensus-protocol/1853">clique</a>. This doc will focus more on the difference and ignore the common details.</p><p>ครั้นจะทำ Clique หรือ Parlia โดยการไปลอก JFIN genesis มาทั้งดุ้นนั้น จะมีอาการหน้ามืด อาการวิงเวียน คล้ายจะเป็นลมอย่างแน่แท้ เพราะมันยาวเหลือเกิน… ซึ่งก็แน่นอนแหละครับ เพราะใน genesis นั้น Deploy code ของ smart contract ลงไปได้เลย (อย่างเดือด แต่ก็คือเดือดแบบปกตินะ)</p><p>ทางที่จะพอหา Pattern ของ genesis ได้นั้น ก็คือหาสั้นๆ ซึ่งหาไปหามาแล้ว ก็จะเจอ tools ของ go-ethereum เป็น utils ชื่อ puppeth <a href="https://geth.ethereum.org/docs/tools/puppeth">https://geth.ethereum.org/docs/tools/puppeth</a></p><h4>Puppeth</h4><p>Puppeth comes bundled with Geth. The binary for Puppeth is built along with the other command line tools when the user runs make all. By default the binaries are saved to build/bin. This page demonstrates how to start a private proof-of-authority network with all the nodes running on the local machine. Other configurations are also possible, for example nodes can be spread over multiple (virtual) machines and the consensus mechanism can be proof-of-work.</p><p>ตามนั้นแหละครับว่า ถ้าเรา make all เราจะได้ puppeth มาใน build/bin/puppeth จาก go-ethereum ด้วย ซึ่งมันจะเป็น cli wizardสำหรับการช่วยสร้าง genesis</p><p>รอบนี้เราก็จัดมาเลย แล้วก็เลือก clique ซะ (ซึ่งก็เลือก ethash ก็ได้นะ แต่ลอก JBC ง่ายกว่า) แต่อย่าลืมนะ สังเกตให้ดี มันไม่ให้ londonBlock หรือ EIP-1559 มานะ และก็ไม่ได้ให้ berlinBlock มาด้วย (แต่บทความนี้ พี่เดิมเติม berlin, london และ baseFeePerGas ให้แล้วครับ)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxrEwQrmEb0kssjisbdduQ.png" /><figcaption>puppeth — cli wizard</figcaption></figure><p>แล้วจะได้ genesis หน้าตาแบบนี้… เหมือนกับที่เรากำหนดใน cli</p><pre>{<br>  &quot;genesis&quot;: {<br>    &quot;config&quot;: {<br>      &quot;chainId&quot;: 10010,<br>      &quot;homesteadBlock&quot;: 0,<br>      &quot;eip150Block&quot;: 0,<br>      &quot;eip150Hash&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br>      &quot;eip155Block&quot;: 0,<br>      &quot;eip158Block&quot;: 0,<br>      &quot;byzantiumBlock&quot;: 0,<br>      &quot;constantinopleBlock&quot;: 0,<br>      &quot;petersburgBlock&quot;: 0,<br>      &quot;istanbulBlock&quot;: 0,<br>      &quot;berlinBlock&quot;: 0,<br>      &quot;londonBlock&quot;: 0<br>      &quot;clique&quot;: {<br>        &quot;period&quot;: 5,<br>        &quot;epoch&quot;: 30000<br>      }<br>    },<br>    &quot;nonce&quot;: &quot;0x0&quot;,<br>    &quot;timestamp&quot;: &quot;0x63b2a117&quot;,<br>    &quot;extraData&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&quot;,<br>    &quot;gasLimit&quot;: &quot;0x47b760&quot;,<br>    &quot;difficulty&quot;: &quot;0x1&quot;,<br>    &quot;mixHash&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br>    &quot;coinbase&quot;: &quot;0x0000000000000000000000000000000000000000&quot;,<br>    &quot;alloc&quot;: {<br>      &quot;f39fd6e51aad88f6f4ce6ab8827279cfffb92266&quot;: {<br>        &quot;balance&quot;: &quot;0x200000000000000000000000000000000000000000000000000000000000000&quot;<br>      }<br>    },<br>    &quot;number&quot;: &quot;0x0&quot;,<br>    &quot;gasUsed&quot;: &quot;0x0&quot;,<br>    &quot;parentHash&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br>    &quot;baseFeePerGas&quot;: &quot;0x2540BE400&quot;<br>  }<br>}</pre><p>ให้เราเอาเฉพาะ .genesis มาใช้ ง่ายหน่อยก็ใช้ jq</p><pre>cat ~/.puppeth/cablat | jq .genesis &gt; cablat.genesis.json</pre><p>แล้วเราก็ init ด้วย erigon (ใช้ครับ วันนี้เราจะใช้ erigon ซึ่ง สามารถใช้ geth ทำได้เหมือนกันนะ)</p><pre>&gt; erigon --datadir=./erigon-cablat init cablat.genesis.json<br><br>WARN[01-02|16:07:16.499] no log dir set, console logging only<br>INFO[01-02|16:07:16.506] Opening Database                         label=chaindata path=/Users/nat/jibchain-erigon/erigon-cablat/chaindata<br>INFO[01-02|16:07:16.518] Re-Opening DB in exclusive mode to apply migrations<br>INFO[01-02|16:07:16.526] Apply migration                          name=db_schema_version5<br>INFO[01-02|16:07:16.528] Applied migration                        name=db_schema_version5<br>INFO[01-02|16:07:16.528] Apply migration                          name=txs_begin_end<br>INFO[01-02|16:07:16.529] Applied migration                        name=txs_begin_end<br>INFO[01-02|16:07:16.529] Apply migration                          name=reset_blocks_4<br>INFO[01-02|16:07:16.529] Applied migration                        name=reset_blocks_4<br>INFO[01-02|16:07:16.529] Updated DB schema to                     version=6.0.0<br>INFO[01-02|16:07:16.591] Writing custom genesis block             hash=0xbc9d4f1984cb5136dc8f094e6c31068e82595474f917b0a037dc388d719db60a<br>INFO[01-02|16:07:16.592] Successfully wrote genesis state         hash=0xbc9d4f1984cb5136dc8f094e6c31068e82595474f917b0a037dc388d719db60a</pre><p>และแน่นอน คนจริงอย่างเรา ทำ PoA แบบมี โดยที่มี signer คนเดียว นั่นคือ0xf39Fd6e51aad88F6F4ce6aB8827279cffFb922665555</p><p>พอเรียบร้อยแล้ว เราก็ เริ่ม mining แต่รอบนี้เราต้องใช้ private key ซึ่ง address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266</p><p>ก็จะมีคู่ private key คือac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80</p><p>ก็เอาไว้ในไฟล์ชื่อ pkey แล้วก็ขุดกันเลย</p><pre>erigon --datadir=erigon-cablat  --networkid 10010 --mine --miner.sigfile=./pkey</pre><p>แต่ Configuration นี้ไม่ได้ทำเพื่อใช้จริง ถ้าจะใช้จริง ก็ต้องลองให้มี signer หรือ block sealer มากกว่า 1 คน</p><p>จากตัวอย่างนี้ รันปุ๊บ ก็จะมี Block ใหม่เกิดขึ้นปั๊บในทุกๆ 5 วินาที</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GxAIGNOhynBO936m7LLevQ.png" /><figcaption>cablat chain</figcaption></figure><p>ช่วงนี้ปีใหม่ว่างหน่อย แต่บทความนี้น่าจะเป็นบทความสุดท้ายแล้ว ก่อนกลับไปเชียงใหม่</p><p>แต่เพื่อความบันเทิง และสุดยอดทางวิศวกรรม สามารถศึกษาเพิ่มเติมได้ที่ <a href="http://github.com/jfinchain/jfin-genesis-config">http://github.com/jfinchain</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=357c0c481d1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ขึ้น Private Blockchain (POW) ของตัวเอง ตามรอย JBC Blockchain]]></title>
            <link>https://nazt.medium.com/%E0%B8%82%E0%B8%B6%E0%B9%89%E0%B8%99-private-blockchain-pow-%E0%B8%82%E0%B8%AD%E0%B8%87%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B9%80%E0%B8%AD%E0%B8%87-%E0%B8%95%E0%B8%B2%E0%B8%A1%E0%B8%A3%E0%B8%AD%E0%B8%A2-jbc-blockchain-7509037090c1?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7509037090c1</guid>
            <category><![CDATA[erigon]]></category>
            <category><![CDATA[private-blockchain]]></category>
            <category><![CDATA[geth]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Mon, 02 Jan 2023 04:21:53 GMT</pubDate>
            <atom:updated>2023-01-02T04:27:16.157Z</atom:updated>
            <content:encoded><![CDATA[<p>ผมทำอะไรใน Blockchain เป็นไม่มาก แต่โชคดีค้นพบความลับว่า ถ้าเราขึ้น Chain ตามพี่โดม แล้วทุกอย่างจะง่ายขึ้นเยอะ</p><p>อย่าง การทำ EVM Compatiable Blockchain แบบ <strong>Ethash</strong> proof-of-work นี่ยังไม่เคยทำเป็น พอ JBC Blockchain ขึ้นมาปุ๊บทำเป็นเลย 555</p><p>เริ่มจาก เอา/ลอก genesis.jsonของ jibchain (<a href="https://github.com/jibchain-net/node/blob/main/genesis.json">https://github.com/jibchain-net/node/blob/main/genesis.json</a>) มาใช้เลย แต่เราจะแก้ pre-mined address และ chain-id พอเป็นพิธี</p><p>ก็จะได้ แบบนี้ save ทับลงไปได้เลย ไม่แก้อะไรอย่างอื่นทั้งๆนั้น แต่ที่แน่ๆ ใน genesis นี้มี londonBlock (EIP-1559)ใส่มาให้แล้ว อย่างสวยงาม</p><pre>{<br>  &quot;config&quot;: {<br>    &quot;chainId&quot;: 9999,<br>    &quot;homesteadBlock&quot;: 0,<br>    &quot;eip150Block&quot;: 0,<br>    &quot;eip150Hash&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br>    &quot;eip155Block&quot;: 0,<br>    &quot;eip158Block&quot;: 0,<br>    &quot;byzantiumBlock&quot;: 0,<br>    &quot;constantinopleBlock&quot;: 0,<br>    &quot;petersburgBlock&quot;: 0,<br>    &quot;istanbulBlock&quot;: 0,<br>    &quot;muirGlacierBlock&quot;: 0,<br>    &quot;berlinBlock&quot;: 0,<br>    &quot;londonBlock&quot;: 0,<br>    &quot;arrowGlacierBlock&quot;: 0,<br>    &quot;grayGlacierBlock&quot;: 0,<br>    &quot;shanghaiBlock&quot;: null,<br>    &quot;cancunBlock&quot;: null,<br>    &quot;ethash&quot;: {}<br>  },<br>  &quot;nonce&quot;: &quot;0x0&quot;,<br>  &quot;gasLimit&quot;: &quot;8000000&quot;,<br>  &quot;difficulty&quot;: &quot;0x40000&quot;,<br>  &quot;mixHash&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br>  &quot;coinbase&quot;: &quot;0x0000000000000000000000000000000000000000&quot;,<br>  &quot;alloc&quot;: {<br>    &quot;f39Fd6e51aad88F6F4ce6aB8827279cffFb92266&quot;: {<br>      &quot;balance&quot;: &quot;1000000000000000000000000001&quot;<br>    }<br>  },<br>  &quot;number&quot;: &quot;0x0&quot;,<br>  &quot;gasUsed&quot;: &quot;0x0&quot;,<br>  &quot;parentHash&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,<br>  &quot;baseFeePergas&quot;: &quot;0x2540BE400&quot;<br>}</pre><p>หลังจากนั้นก็ตาม step เดิมเริ่มจาก init blockchain data ด้วย genesis.json ด้วยคำสั่ง geth (นั่นแหละ เราจะใช้ geth กัน)</p><pre>geth --datadir mypow init genesis.json</pre><pre>&gt; geth --datadir mypow init genesis.json<br>INFO [01-02|11:03:53.703] Maximum peer count                       ETH=50 LES=0 total=50<br>INFO [01-02|11:03:53.706] Set global gas cap                       cap=50,000,000<br>INFO [01-02|11:03:53.707] Allocated cache and file handles         database=/Users/nat/jibchain-erigon/mypow/geth/chaindata cache=16.00MiB handles=16<br>INFO [01-02|11:03:53.843] Opened ancient database                  database=/Users/nat/jibchain-erigon/mypow/geth/chaindata/ancient/chain readonly=false<br>INFO [01-02|11:03:53.846] Successfully wrote genesis state         database=chaindata hash=2d559f..c63524<br>INFO [01-02|11:03:53.846] Allocated cache and file handles         database=/Users/nat/jibchain-erigon/mypow/geth/lightchaindata cache=16.00MiB handles=16<br>INFO [01-02|11:03:53.985] Opened ancient database                  database=/Users/nat/jibchain-erigon/mypow/geth/lightchaindata/ancient/chain readonly=false<br>INFO [01-02|11:03:53.987] Successfully wrote genesis state         database=lightchaindata hash=2d559f..c63524</pre><p>หลังจากนั้น เราก็เริ่ม ขุด Block ได้เลย ด้วย networkid = 9999</p><pre>geth --datadir mypow --networkid 9999 --mine --miner.etherbase=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --miner.threads 8  --http.api=net,eth,web3 --http</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MMmVNe-V-vFx91WR62sMuA.png" /><figcaption>mining with geth</figcaption></figure><p>ลองสั่ง geth attach <a href="http://localhost:8545/">http://localhost:8545</a> แล้วขอดู Block ใหม่แบบ Real-time กันหน่อย ด้วย setIntervaและ console.log</p><pre>setInterval(function() { console.log(eth.blockNumber); }, 1000);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PICTxCuAAHUv_XGyAqlirQ.png" /><figcaption>an interaction with the rpc</figcaption></figure><p>ลอง getBalance โดยไม่ใช้ metamask สามารถทำด้วยคำสั่ง eth.getBalance(&quot;0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266&quot;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p6fS49A170U_DOCp9cchLg.png" /></figure><p>ถ้าจะให้ erigon หรือ client ตัวอื่น connect เข้ามา sync ข้อมูล ให้ก๊อบ enode:// ที่เราเปิดเอาไว้ให้ดี ตรงนี้</p><pre>INFO [01-02|11:11:40.609] Started P2P networking                   self=enode://e56ec36fa581fc8f9697116359f3e973ff8172030ec466a09f4b54008583ffbda7e1eb66e4e85e6de035df4fdea167d0ece1eeb7df7f82505f2c57bf045bf191@127.0.0.1:30303</pre><p>เสร็จแล้ว ทำตามบทความนี้เพื่อ sync ด้วย erigon โดยการแก้ networkid และ bootnodes</p><p><a href="https://nazt.medium.com/%E0%B8%81%E0%B8%B2%E0%B8%A3-sync-jbc-blockchain%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-erigon-e9c8c8cb2871">การ Sync JBC Blockchainด้วย Erigon</a></p><p>ตอน init ก็สังเกตด้วยว่า genesis hash ต้องตรงกัน</p><pre>&gt; erigon --datadir erigon-pow init genesis.json<br>WARN[01-02|11:14:50.416] no log dir set, console logging only<br>INFO[01-02|11:14:50.432] Opening Database                         label=chaindata path=/Users/nat/jibchain-erigon/erigon-pow/chaindata<br>INFO[01-02|11:14:50.449] Re-Opening DB in exclusive mode to apply migrations<br>INFO[01-02|11:14:50.463] Apply migration                          name=db_schema_version5<br>INFO[01-02|11:14:50.464] Applied migration                        name=db_schema_version5<br>INFO[01-02|11:14:50.465] Apply migration                          name=txs_begin_end<br>INFO[01-02|11:14:50.465] Applied migration                        name=txs_begin_end<br>INFO[01-02|11:14:50.465] Apply migration                          name=reset_blocks_4<br>INFO[01-02|11:14:50.466] Applied migration                        name=reset_blocks_4<br>INFO[01-02|11:14:50.466] Updated DB schema to                     version=6.0.0<br>INFO[01-02|11:14:50.550] Writing custom genesis block             hash=0x2d559ffc7b20d9096abd0a840194c29b475cb4a329ff6f28a580c3c01cc63524<br>INFO[01-02|11:14:50.552] Successfully wrote genesis state         hash=0x2d559ffc7b20d9096abd0a840194c29b475cb4a329ff6f28a580c3c01cc63524</pre><p>หลังจาก นั้นก็ sync ตามปกติ ถ้า geth หรือ erigon อยู่ network เดียวกันก็อย่าลืมเช็ค port ชน</p><pre>&gt; erigon --datadir=./erigon-pow --networkid 9999 --bootnodes=enode://e56ec36fa581fc8f9697116359f3e973ff8172030ec466a09f4b54008583ffbda7e1eb66e4e85e6de035df4fdea167d0ece1eeb7df7f82505f2c57bf045bf191@127.0.0.1:30303</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6msOhUCyg9nHQB-yfcE0Cw.png" /></figure><p>เท่านี้ก็พอจะเริ่มเห็นภาพ blockchain เพิ่มขึ้นอีกหน่อย</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7509037090c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science บน JBC Blockchain ด้วย TrueBlocks]]></title>
            <link>https://nazt.medium.com/data-science-%E0%B8%9A%E0%B8%99-jbc-blockchain-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-trueblocks-b28340507963?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b28340507963</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[jib-chain]]></category>
            <category><![CDATA[jbc]]></category>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Sun, 01 Jan 2023 14:46:56 GMT</pubDate>
            <atom:updated>2023-01-01T14:56:45.556Z</atom:updated>
            <content:encoded><![CDATA[<p>สิ่งที่ขาดไม่ได้บน Blockchain ก็คือ Indexer (แล้วถึงจะไปที่ Explorer กันต่อ) หนึ่งใน Software ที่มีปรัชญา และหลักคิดอันเข้มข้น นั่นคือ <a href="https://trueblocks.io/">TrueBlocks</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jHlGPx2NCFwpSp3rpPCxBg.png" /><figcaption>TrueBlocks — Lightweight indexing for any EVM-based blockchain</figcaption></figure><p>ถ้าจะใช้ TrueBlocks ได้เต็มที่ก็คือบน Ethereum Mainnet ถึงจะมันมาก (มีการเอา Unchained Index ไว้บน IPFS แล้วโหลด Snapshot มาเพิ่มความแรงได้)</p><p>แต่ TrueBlocks สามารถคุยกับ RPC ของเราได้โดยตรง และแน่นอน วันนี้ก็เล่นบน JBC Blockchain เลยแล้วกัน เพราะตอนนี้ Data ยังไม่มาก เราพอจะไล่ดู Transaction ไหว</p><p>หลังจาก Build TrueBlocks จาก <a href="https://github.com/TrueBlocks/trueblocks-core">https://github.com/TrueBlocks/trueblocks-core</a> เรียบร้อยแล้ว ก็ลอง<a href="https://trueblocks.io/docs/install/get-the-index/">อ่าน Docs ที่นี่</a></p><p>Find your TrueBlocks configuration directory. It should be in one of these places:</p><ul><li>On linux at ~/.local/share/trueblocks</li><li>On mac at ~/Library/Application Support/TrueBlocks</li></ul><p>การ Config ให้ TrueBlocks รู้จัก JBC นั้น ทำได้โดยการ เพิ่ม [chains.jbc]</p><pre>[chains.jbc]<br>apiProvider = &quot;http://localhost:8080&quot;<br>chainId = &quot;8899&quot;<br>localExplorer = &quot;https://exp-l1.jibchain.net/&quot;<br>remoteExplorer = &quot;https://exp-l1.jibchain.net/&quot;<br>rpcProvider = &quot;http://localhost:8546&quot;<br>symbol = &quot;JBC&quot;</pre><p>หลังจากนั้น set default chain ที่ section บนสุด set path สำหรับ cache ตามต้องการ</p><pre>[settings]<br>defaultChain = &quot;jbc&quot;<br>cachePath = &quot;/home/nat/16TB/trublocks-data/cache&quot;<br>indexPath = &quot;/home/nat/16TB/trublocks-data/unchained&quot;<br># defaultGateway = &quot;https://ipfs.unchainedindex.io/ipfs/&quot;</pre><p>หลังจาก export PATH ให้ trueblocks-core/bin เรียบร้อยแล้ว ก็สั่ง chifra initถ้า directory ไหนไม่มีก็สร้างให้เรียบร้อย</p><p>หลังจากนั้นก็เริ่ม สั่งให้ build index บน TrueBlocks ด้วยคำสั่ง chifra scrape</p><p>indexer -n 10000ลองปรับ options ได้ตามสนุก รันแป้บเดียวจะได้แบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kKcpatGXVVf9GO8upJ4MLg.png" /><figcaption>chifra scrape</figcaption></figure><p>ทดลองหา Miners Address จาก Block 0 ถึง 56175 ทำ ได้ด้วยคำสั่งเดียวคือ</p><p>chifra blocks 0–56175 | jq .data[].miner</p><p>เราสามารถ redirect ส่งออกไปไฟล์ และทำ unique อีกที เพื่อหา Miner ทุกคนได้เลย แบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*fBWp1DbA8zJJ7Lo1byp44Q.png" /></figure><p>แต่เราสามารถ อ่าน block ทั้งหมดในรูปแบบ csv เพื่อเอาข้อมูลไปทำต่อได้เลยด้วยคำสั่ง</p><p>chifra blocks 0-56175 --fmt csv แต่ถ้าเราอยากลดทอนข้อมูล โดยเอา Data แค่ทุกๆ 100 block สามารถทำได้ใส่ :100แบบนี้ chifra blocks 0-56175:100 --fmt csv &gt; 56kblocks.csv</p><p>หลังจากนั้นก็ลอง Plot Difficulty ด้วย pandas ใน 3 บรรทัด</p><pre>import pandas as pd<br>df = pd.read_csv(&#39;./blocks.csv&#39;)<br>df.difficulty.plot.line()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z2R6UU7oQnEq7Lk0yWgwVw.png" /></figure><p><a href="https://colab.research.google.com/drive/1zmhfSqWoVWjN5H3uL1uCRVr_15jc8Enh?usp=sharing">Google Colaboratory</a></p><h4>Data Science?</h4><p>และแน่นอนคำพ่วงที่เป็น Data Science นั้น TrueBlocks ก็เป็นเสริม Options txt, csvให้เราสะดวกสบายขึ้นนั่นเอง 555</p><p>ตอนนี้ของน่าจะเริ่มครบแล้ว</p><p>วันนี้น่าจะพอเท่านี้ก่อน แล้วเดี๋ยวเรามาเจาะลึกกันที่ระดับข้อมูลกันต่อไป</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b28340507963" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[การ Sync JBC Blockchainด้วย Erigon]]></title>
            <link>https://nazt.medium.com/%E0%B8%81%E0%B8%B2%E0%B8%A3-sync-jbc-blockchain%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-erigon-e9c8c8cb2871?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9c8c8cb2871</guid>
            <category><![CDATA[jbc]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[jib-chain]]></category>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Sun, 01 Jan 2023 04:02:32 GMT</pubDate>
            <atom:updated>2023-02-08T06:42:49.091Z</atom:updated>
            <content:encoded><![CDATA[<p>หลังจากที่มี erigon binary แล้ว จะเริ่มโหลดข้อมูลได้ด้วยการ Init ด้วยคำสั่ง</p><pre>git clone https://github.com/jibchain-net/node</pre><pre>erigon --datadir=natdir init ~/github.com/jibchain-net/node/genesis.json</pre><p>หรือ กำหนด jbc.toml</p><pre>datadir = &#39;~/16TB/jibchain-erigon/natdir&#39;<br>networkid = 8899<br>bootnodes = [&#39;enode://2fe036f0a233b05a92c229796dafbdd3d8c19eadc94b99ad04181e4e52d35f8500401a5aac0ed054575c5325f2db34fb491068c15858b65dd7354ca0ef442763@65.108.61.51:30303&#39;, &#39;enode://9789fb51f949a63fb9e34f7ee450c6de087c743083ce56fb46c1d3a15cb24bc41e988d71e71a95bd0d5a6c6b679f729f89dea487464a94af8d6ac55e161d0558@188.166.250.77:30303&#39;, &#39;enode://e07a8c0ca434fc67a09053972f25b1e7f614aa317d41100b07500b10c12982b8ae795777651daaf2fcc963d3aea36f980b0f3dd3c49d0e877a1716709d78b430@65.21.251.178:30303&#39;]<br>v5disc = true<br>maxpeers = 1000<br># port = &quot;30304&quot;<br><br>&quot;private.api.addr&quot;=&quot;localhost:9092&quot;<br>&quot;http.api&quot; = [&quot;eth&quot;, &quot;debug&quot;, &quot;net&quot;, &quot;trace&quot;, &quot;web3&quot;, &quot;erigon&quot;, &quot;ots&quot;]<br>&quot;http.vhosts&quot; = [&quot;*&quot;]<br>&quot;http.port&quot; = 8546<br>&quot;http.addr&quot; = &quot;0.0.0.0&quot;<br>&quot;authrpc.port&quot; = 8552<br>&quot;log.console.verbosity&quot; = &quot;debug&quot;<br># &quot;downloader.disable.ipv6&quot; = true<br># &quot;sentry.api.addr&quot; = &quot;localhost:9093&quot;</pre><p>ซึ่งมาจาก</p><pre>erigon --datadir ~/16TB/jibchain-erigon/natdir --networkid 8899 --bootnodes=enode://2fe036f0a233b05a92c229796dafbdd3d8c19eadc94b99ad04181e4e52d35f8500401a5aac0ed054575c5325f2db34fb491068c15858b65dd7354ca0ef442763@65.108.61.51:30303,enode://9789fb51f949a63fb9e34f7ee450c6de087c743083ce56fb46c1d3a15cb24bc41e988d71e71a95bd0d5a6c6b679f729f89dea487464a94af8d6ac55e161d0558@188.166.250.77:30303,enode://e07a8c0ca434fc67a09053972f25b1e7f614aa317d41100b07500b10c12982b8ae795777651daaf2fcc963d3aea36f980b0f3dd3c49d0e877a1716709d78b430@65.21.251.178:30303 --v5disc  --maxpeers 1000 --log.console.verbosity debug --no-downloader  --http.api=eth,debug,net,trace,web3,erigon,ots --no-downloader  --http.vhosts=&quot;*&quot;  --authrpc.port=8552 --http.port=8546 --http.addr=0.0.0.0 --downloader.disable.ipv6 --port 30304</pre><p>สามารถรันได้ด้วยคำสั่ง erigon --config ./jbc.toml --downloader.disable.ipv6</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3RlnOxFRAnJvMu0zYgqk5g.png" /><figcaption>erigon --config ./jbc.toml</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9c8c8cb2871" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[แรนด้อม Key ด้วย OpenSSLและ เข้ารหัสด้วย GPG]]></title>
            <link>https://nazt.medium.com/%E0%B9%81%E0%B8%A3%E0%B8%99%E0%B8%94%E0%B9%89%E0%B8%AD%E0%B8%A1-key-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-openssl%E0%B9%81%E0%B8%A5%E0%B8%B0-%E0%B9%80%E0%B8%82%E0%B9%89%E0%B8%B2%E0%B8%A3%E0%B8%AB%E0%B8%B1%E0%B8%AA%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-gpg-7bee8a0916c2?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bee8a0916c2</guid>
            <category><![CDATA[gpg]]></category>
            <category><![CDATA[openssl]]></category>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Tue, 26 Jan 2021 00:32:53 GMT</pubDate>
            <atom:updated>2021-01-26T00:32:53.614Z</atom:updated>
            <content:encoded><![CDATA[<h4>การ Random Key ด้วย OpenSSL</h4><p>ถ้าต้องการ Key ขนาด 32bytes (256bit) สามารถกำหนด output เป็น base64, แบบ hex, และ plain text สามารถทำได้ด้วยคำสั่ง</p><pre>openssl rand 32 -base64<br>openssl rand 32 -hex<br>openssl rand 32 <br>openssl rand 32 | hexdump -C</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_nZnM6Qkzuvk9_hLh3uRew.png" /><figcaption>openssl rand 32 | hexdump -C</figcaption></figure><h4>การเข้ารหัสด้วย GPG</h4><p>ในบางครั้งเราก็ต้องการเข้ารหัสทั้งไฟล์เลย ก็อาจจะใช้ gpg ได้ซึ่งต้นทางจะมาจาก Github Actions <a href="https://docs.github.com/en/actions/reference/encrypted-secrets">ทางนี้</a></p><pre>gpg --symmetric --cipher-algo AES256 file</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u04UcuHvXHbuJ46O_BXBYQ.png" /><figcaption>gpg --symmetric --cipher-algo AES256 file</figcaption></figure><p>เราอาจะถอดรหัส ด้วยคำสั่งสั้นๆ</p><pre>gpg --quiet --batch --yes --decrypt --passphrase=&quot;$PASSPHRASE&quot; &quot;${file}.gpg&quot; &gt; &quot;${file}&quot;</pre><p>หรือทีละหลายๆไฟล์ด้วย Script แบบนี้</p><pre>PASSPHRASE=$1<br>for file in $(cat files.txt); do<br>    echo $file<br>    gpg --quiet --batch --yes --decrypt --passphrase=&quot;$PASSPHRASE&quot; &quot;${file}.gpg&quot; &gt; &quot;${file}&quot;<br>done</pre><p>การเข้ารหัสหลายไฟล์อาจจะทำแบบ Manual ก่อนดีกว่าเพราะ เราจะทำไม่กี่ไฟล์อยู่ดี</p><pre>gpg --symmetric --cipher-algo AES256  snakeoilca.crt<br>gpg --symmetric --cipher-algo AES256  snakeoil.crt<br>gpg --symmetric --cipher-algo AES256  snakeoil.key</pre><h4>ทำ Checksum ด้วย shasum</h4><pre>shasum -a 256 file</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bee8a0916c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grafana & InfluxDB on OSX]]></title>
            <link>https://nazt.medium.com/grafana-influxdb-on-osx-7bad143cb50a?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bad143cb50a</guid>
            <category><![CDATA[influxdb]]></category>
            <category><![CDATA[grafana]]></category>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Fri, 21 Aug 2020 04:02:30 GMT</pubDate>
            <atom:updated>2020-08-21T04:02:30.932Z</atom:updated>
            <content:encoded><![CDATA[<h4>Grafana</h4><pre>grafana-server --config=/usr/local/etc/grafana/grafana.ini --homepath /usr/local/share/grafana --packaging=brew cfg:default.paths.logs=/usr/local/var/log/grafana cfg:default.paths.data=/usr/local/var/lib/grafana cfg:default.paths.plugins=/usr/local/var/lib/grafana/plugins</pre><h4>InfluxDB</h4><pre>ln -s ~/influxdb /usr/local/var/influxdb<br>influxd -config  /usr/local/etc/influxdb.conf</pre><h4>Database Structure</h4><pre>tar -cvf $HOME/influxdb $HOME/influxdb.tar --progress</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bad143cb50a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ปรับ alpine บน Docker ให้รองรับ TZ ซักที]]></title>
            <link>https://medium.com/chiang-mai-maker-club/%E0%B8%9B%E0%B8%A3%E0%B8%B1%E0%B8%9A-alpine-%E0%B8%9A%E0%B8%99-docker-%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%A3%E0%B8%AD%E0%B8%87%E0%B8%A3%E0%B8%B1%E0%B8%9A-tz-%E0%B8%8B%E0%B8%B1%E0%B8%81%E0%B8%97%E0%B8%B5-817729e2fb3d?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/817729e2fb3d</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[alpine]]></category>
            <category><![CDATA[mosquitto]]></category>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Fri, 27 Sep 2019 09:37:19 GMT</pubDate>
            <atom:updated>2019-09-27T09:42:05.435Z</atom:updated>
            <content:encoded><![CDATA[<h4>ปัญหานี้ตามมาถึง MQTT broker คลาสสิกอย่าง <a href="https://hub.docker.com/_/eclipse-mosquitto">Mosquitto</a> เลยทีเดียว</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BnmaXFqWqQjVMZvPuZpoQw.png" /></figure><p>ปัญหาชวนหัวเสียอย่าง TZ บน alpine ไม่ยอมถูก override อย่างคนอื่นเค้าเช่น บน Debian ก็ไม่ได้มีปัญหาอะไร</p><pre>docker run -e TZ=Asia/Bangkok debian:jessie date</pre><p>บน Alpine ดันไม่ติดซะงั้น</p><pre>docker run -e TZ=Asia/Bangkok alpine date</pre><p>ปัญหานี้ตามมาถึง MQTT broker คลาสสิกอย่าง <a href="https://hub.docker.com/_/eclipse-mosquitto">Mosquitto</a> เพราใช้ base เป็น alpine ทำยังไง๊ ยังไง เราจะ format Log ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*qmVsvHVoxzByLU6K2P7jTQ.png" /></figure><pre>FROM alpine:3.8 </pre><pre>LABEL maintainer=&quot;Roger Light &lt;roger@atchoo.org&gt;&quot; \  description=&quot;Eclipse Mosquitto MQTT Broker&quot;</pre><p>ซึ่งอ่านตาม Issue ต่างๆก็จะประมาณนี้</p><p><a href="https://github.com/gliderlabs/docker-alpine/issues/136">How can I set the timezone please? · Issue #136 · gliderlabs/docker-alpine</a></p><p>การทำ Image ขึ้นมาใหม่ไม่น่าจะใช่หนทางเพราะ Operational cost ตามอีกมากมายก่ายกอง….</p><h3>แก้ปัญหา</h3><p>หลังจากที่อ่านมาแล้ว มันน่าจะแก้ได้โดยการ ลง tzdata เข้าไปแล้ว Restart ได้เลย โดยทำผ่านกลไกของ docker exec</p><p>ถ้าทำแบบนี้จะเกิด Cost ของการทำ script ขึ้นมา​ซึ่ง ก็โอเค มันมีอยู่แล้ว หน้าตาของ Configuration Script จะเป็นแบบนี้ (เพิ่มบรรทัด 24)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PuOlQ4GohET7vUWpOuV-Dw.png" /></figure><pre>docker exec -it mosquitto /sbin/apk add --no-cache tzdata</pre><p>ผลการทำงานก็โอเค พอใจ สบายใจ :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O0qMisGAqb90U8ZDj39JsA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=817729e2fb3d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chiang-mai-maker-club/%E0%B8%9B%E0%B8%A3%E0%B8%B1%E0%B8%9A-alpine-%E0%B8%9A%E0%B8%99-docker-%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%A3%E0%B8%AD%E0%B8%87%E0%B8%A3%E0%B8%B1%E0%B8%9A-tz-%E0%B8%8B%E0%B8%B1%E0%B8%81%E0%B8%97%E0%B8%B5-817729e2fb3d">ปรับ alpine บน Docker ให้รองรับ TZ ซักที</a> was originally published in <a href="https://medium.com/chiang-mai-maker-club">Chiang Mai Maker Club</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ดูแล ระบบ Log ของ Docker และ PM2]]></title>
            <link>https://nazt.medium.com/%E0%B8%94%E0%B8%B9%E0%B9%81%E0%B8%A5-%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%9A-log-%E0%B8%82%E0%B8%AD%E0%B8%87-docker-%E0%B9%81%E0%B8%A5%E0%B8%B0-pm2-b5efbb5f32c1?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5efbb5f32c1</guid>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Mon, 02 Sep 2019 14:07:14 GMT</pubDate>
            <atom:updated>2019-09-02T14:07:46.166Z</atom:updated>
            <content:encoded><![CDATA[<h3>Log Managing for Docker and PM2</h3><h3>Log Checking</h3><h4>PM2</h4><pre>ls -ailh ~/.pm2/logs/</pre><h4>Docker</h4><pre>sudo sh -c &quot;ls -ahl /var/lib/docker/containers/*/*-json.log&quot;</pre><h3>Log Rotating</h3><h4>PM2</h4><pre>pm2 install pm2-logrotate<br>pm2 set pm2-logrotate:rotateInterval &#39;*/10 * * * *&#39;</pre><p>read <a href="https://github.com/keymetrics/pm2-logrotate">more</a></p><h4>Docker</h4><pre>sudo vi /etc/logrotate.d/docker-container</pre><pre>/var/lib/docker/containers/*/*.log {<br>  rotate 7<br>  daily<br>  compress<br>  missingok<br>  delaycompress<br>  copytruncate<br>}</pre><p>sudo logrotate -fv /etc/logrotate.d/docker-container</p><h4>ref:</h4><ul><li><a href="https://sandro-keil.de/blog/logrotate-for-docker-container/">https://sandro-keil.de/blog/logrotate-for-docker-container/</a></li><li><a href="https://github.com/keymetrics/pm2-logrotate">https://github.com/keymetrics/pm2-logrotate</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5efbb5f32c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Looping in bash]]></title>
            <link>https://nazt.medium.com/looping-in-bash-82e208902083?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/82e208902083</guid>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Sun, 28 Jul 2019 12:24:36 GMT</pubDate>
            <atom:updated>2019-09-11T11:00:30.507Z</atom:updated>
            <content:encoded><![CDATA[<pre>for i in {1..50}<br>do<br>   echo $i<br>   sleep .25<br>done</pre><pre>while True; do stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w factory_defaults.bin; sleep(1) ; done</pre><h4>A Complex</h4><pre>dbs=(ITEM-001 ITEM-002 ITEM-003 ITEM-004 ITEM-005 ITEM-006 ITEM-007 ITEM-008 ITEM-009 ITEM-010 ITEM-011 ITEM-012 ITEM-013 ITEM-014 ITEM-015 ITEM-016 ITEM-017 ITEM-018 ITEM-019 ITEM-020 ITEM-021 ITEM-022 ITEM-023 ITEM-024 ITEM-025 ITEM-026 ITEM-027 ITEM-028 ITEM-029 ITEM-030 ITEM-031 ITEM-032 ITEM-033 ITEM-034 ITEM-035 ITEM-036 ITEM-037 ITEM-038 ITEM-039 ITEM-040 ITEM-041 ITEM-042)</pre><pre>echo &quot;dbs size: ${#dbs[*]}&quot;</pre><pre>for i in &quot;${dbs[@]}&quot;<br>do<br>    echo &quot;dumping $i-$(date +&#39;%Y-%d-%m&#39;).csv&quot;<br>    influx -host $HOST -precision u  -username $USER -password $PASS -database $DB -format csv -execute &quot;SELECT * FROM \&quot;n.b.c\&quot; WHERE (\&quot;topic\&quot; = &#39;/i/gearname/$i/status&#39;)&quot; &gt;  &quot;$i-$(date +&#39;%Y-%d-%m&#39;).csv&quot;<br>done</pre><h4>For Array</h4><pre>dbs=(ITEM-001 ITEM-002 ITEM-003)</pre><pre>for i in &quot;${dbs[@]}&quot;<br>do<br>    echo &quot;$i&quot;<br>done</pre><h4>For Docker</h4><pre>for i in `docker ps --format &#39;{{.Names}}&#39; | grep telegraf`<br>do<br>    docker restart $i<br>    docker logs $i<br>done</pre><h4>For BASH Arguments</h4><pre>args=(&quot;$@&quot;)<br>for i in &quot;${args[@]}&quot;;<br>do<br>  echo &quot;$i&quot;<br>done</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82e208902083" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ใส่สีให้ tmux และการเชื่อมต่อด้วย Mosh]]></title>
            <link>https://nazt.medium.com/%E0%B9%83%E0%B8%AA%E0%B9%88%E0%B8%AA%E0%B8%B5%E0%B9%83%E0%B8%AB%E0%B9%89-tmux-%E0%B9%81%E0%B8%A5%E0%B8%B0%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%80%E0%B8%8A%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%A1%E0%B8%95%E0%B9%88%E0%B8%AD%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-mosh-4ffc50520788?source=rss-95773410378d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ffc50520788</guid>
            <dc:creator><![CDATA[Nat]]></dc:creator>
            <pubDate>Fri, 12 Jul 2019 19:31:31 GMT</pubDate>
            <atom:updated>2019-07-12T19:40:15.971Z</atom:updated>
            <content:encoded><![CDATA[<h4>ด้วย screen-256color และ tmux new -A -s X</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCQkx4GCgTz2U8i7whlb5A.png" /></figure><h3>TMUX</h3><p>เมื่อ tmux -2 ก็ไม่ได้ช่วยอะไรเรา ก็ไม่ต้องหาการ override $TERM แต่อย่างใด ให้แก้</p><pre>set -g default-terminal &quot;screen-256color&quot;</pre><p>หรือ</p><pre>set -g default-terminal &quot;tmux-256color&quot;</pre><p>ใน</p><pre>vi ~/.tmux.conf</pre><ul><li><a href="https://github.com/tmux/tmux/wiki/FAQ">https://github.com/tmux/tmux/wiki/FAQ</a></li></ul><h3>MOSH</h3><pre>sudo apt-get install mosh</pre><pre>sudo ufw allow 60000:61000/udp</pre><p>อยากจะเชื่อม Mosh ไปหา TMUX ให้สั่ง</p><pre>mosh <a href="/service/mailto:nat@dustboy-mini-api.laris.co">nat@</a>ssh.yourhost.com -- tmux a</pre><p>ถ้าอยากให้มีสีด้วย (ต้องมี config ใน .tmux.conf)</p><pre>mosh <a href="/service/mailto:nat@dustboy-mini-api.laris.co">nat@</a>ssh.yourhost.com -- tmux -2</pre><p>ถ้าอยากจะ Attach</p><pre>mosh <a href="/service/mailto:nat@dustboy-mini-api.laris.co">nat@</a>ssh.yourhost.com -- tmux a -t 0</pre><p>ถ้าอยากจะ tmux a ถ้าไม่มีให้สร้างใหม่ ก็ไปเติม ~/.tmux.conf ว่า new-session</p><p>ถ้าอยากใช้ mosh แล้วใช้ tmux แล้วถ้ามีให้ attach แต่ถ้าไม่มีให้สร้างใหม่ด้วย แถมมีสีด้วยให้ใช้.tmux.conf กับ</p><pre>mosh <a href="/service/mailto:nat@dustboy-mini-api.laris.co">nat@</a>ssh.yourhost.com -- tmux new -A -s X</pre><p>ถ้าเข้าไปแล้วจอเล็กให้เตะคนอื่นออกด้วยให้สั่ง</p><pre>mosh <a href="/service/mailto:nat@dustboy-mini-api.laris.co">nat@</a>ssh.yourhost.com — tmux a -t 0 -d</pre><p>ถ้าอยู่นอก tmux แล้วอยากเตะคนอื่นออกให้สั่ง C-b :a -d</p><p>สรุป</p><pre>alias fckoff=&#39;mosh <a href="/service/mailto:nat@dustboy-mini-api.laris.co">nat@y</a>ourhost.com -- tmux new  -A -s X&#39;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ffc50520788" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>