# วิธีทำ Teritori Testnet

By [Krit](https://paragraph.com/@krit) · 2022-08-03

---

สามารถทำตามขั้นตอนด้านล่างได้เลย Step-By-Step ตัวผู้เขียนเองก็มือใหม่ เพิ่งหัดทำด้วยตนเอง สร้างเป็น docker ไม่เป็นเลยอาจจะยาวหน่อยนะครับ (อัพเดท 6 ส.ค. 65 แก้ไขปัญหาเชื่อม Node ไม่ได้)

### 1) สำหรับผู้ที่ไม่เคยรัน Node มาก่อน

สร้าง Virtual Machine ฟรี บน Google หรือใครมี VM อื่นอยู่แล้วก็ใช้ของตัวเองได้เลย (Virtual Machine คือ การเช่าเครื่องคอมพิวเตอร์เพื่อรัน Ubuntu คล้ายกับเช่า server )

1.1 ไปที่ [https://cloud.google.com/vm](https://cloud.google.com/vm)

1.2 กดปุ่ม Get started for free แล้วสมัครบัญชี, ยืนยันทางโทรศัพท์, ใส่รายละเอียดการชำระเงิน (ใช้ได้ฟรี 90 วัน เครดิต 300$ ถ้าไม่ใช้ก็กดลบ VM ออก)

1.3 เมื่อสมัครบัญชีเสร็จแล้ว ไปสร้าง VM ที่ เมนู 3 ขีดด้านซ้ายบน > Compute Engine > VM instances

![](https://storage.googleapis.com/papyrus_images/f9d2519db5fd6089492d1fb64acca4604e916c87e3597a46e0a47c314226d4b2.jpg)

1.4 ที่เมนูด้านบน VM instances แล้วเลือก CREATE INSTANCE (ถ้าไม่มีให้กดที่จุด 3 จุด เมนูจะขึ้นมา)

![](https://storage.googleapis.com/papyrus_images/6427cba9e15dd924a668ec0f0d1a51d17e9cc345aff722c324b8eeaefc476b66.jpg)

1.5 จะขึ้นหน้าสร้าง VM ให้เลื่อนไปข้างล่าง ตรงคำว่า Boot disk ให้กดปุ่ม CHANGE แล้วเลือก

*   Operating system เป็น Ubuntu
    
*   Version เปลี่ยนจาก Ubuntu 18.04 LTS ARM64 เป็น Ubuntu 18.04 LTS X86/64
    
*   Size เป็น 80 GB
    
*   แล้วกดปุ่ม SELECT
    

![](https://storage.googleapis.com/papyrus_images/acadfe63e19b6f9c4b6169f23e77b918e351f438fcd53b875a7dbc4997bbed38.jpg)

1.6 ลงไปด้านล่างสุด กดปุ่ม CREATE จะกลับมาหน้า VM instances รอให้ status ขึ้นเป็นเครื่องหมายถูกสีเขียว แสดงว่า VM ของเราพร้อมทำงานแล้ว

1.7 กดที่ SSH ของ VM instance ที่เราเพิ่งสร้างมา จะเปิดหน้าต่าง browser ใหม่ เพื่อรันคำสั่งทำงานให้กับ VM ของเรา

![](https://storage.googleapis.com/papyrus_images/4139925479897f2440a84a94b0bc8cc4571863c00da14b3c23d8f476cfb9b0f7.jpg)

### 2) ตั้งค่า Firewall บน Google Cloud VM

2.1 ที่เมนู 3 ขีด ซ้ายบนสุดของ Google Cloud กดเลือก VPC network > Firewall

![](https://storage.googleapis.com/papyrus_images/e204259595aa51fae0781fb8972671885eb1484caa8fc6e73b276bde3bba5241.jpg)

2.2 เลือก CREATE FIREWALL RULE

![](https://storage.googleapis.com/papyrus_images/18a37c2f0f3110351e674731d8f9436b754b15c0f3f0f602c07b43a7471f32ff.jpg)

*   เมื่อขึ้นหน้าใหม่ ให้ตั้งค่าดังนี้
    
*   Name : teritori
    
*   Targets : All instances in the network
    
*   Source IPv4 ranges : 0.0.0.0/0
    
*   ติ๊กถูกที่ TCP ใส่ Ports : 26656,26657
    
*   ติ๊กถูกที่ UDP ใส่ Ports : 26656,26657
    
*   กดที่ปุ่ม CREATE
    

### 3) รัน Code บน Terminal (SSH)

3.1 คัดลอก code ตามด้านล่าง ทีละบรรทัด แล้วนำไปวางบน Terminal แล้วกด Enter

*   `sudo -i`
    
*   `apt update && apt upgrade -y`
    
*   `apt install build-essential git curl gcc make jq -y`
    
*   `wget -c https://go.dev/dl/go1.18.3.linux-amd64.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz && rm -rf go1.18.3.linux-amd64.tar.gz`
    
*   `echo 'export GOROOT=/usr/local/go' >> $HOME/.bash_profile echo 'export GOPATH=$HOME/go' >> $HOME/.bash_profile echo 'export GO111MODULE=on' >> $HOME/.bash_profile echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile && . $HOME/.bash_profile`
    
*   `wget -O teritori.sh https://raw.githubusercontent.com/kj89/testnet_manuals/main/teritori/teritori.sh && chmod +x teritori.sh && ./teritori.sh`
    
*   จะขึ้นมาว่า Enter node name: ให้ตั้งชื่อ node ของเรา
    
*   รอติดตั้งสักครู่……….. จนกระทั่งติดตั้งเสร็จสิ้น ให้ใส่คำสั่งด้านล่าง
    
*   `source $HOME/.bash_profile`
    
*   `teritorid status 2>&1 | jq .SyncInfo`
    
*   `SNAP_RPC="http://teritori.stake-take.com:26657" LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \ BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000)); \ TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \ s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \ s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \ s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \ s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.teritorid/config/config.toml teritorid tendermint unsafe-reset-all --home $HOME/.teritorid sudo systemctl restart teritorid && journalctl -fu teritorid -o cat`
    
*   จะแสดงรายงานผลการทำงานของ Node ให้รันประมาณ 10 วินาที แล้วกดปุ่ม Ctrl+c เพื่อออกจากหน้าจอ
    

3.3 สร้างกระเป๋า wallet และขอ Faucet

*   สร้างกระเป๋าโดยใช้คำสั่ง
    
    `teritorid keys add $WALLET`
    
*   ให้จด nmemonic key สำหรับกู้กระเป๋าไว้ด้วย(บรรทัดล่างสุด) และคัดลอกเลข wallet เรา ที่อยู่หลังคำว่า address : ( จะขึ้นด้วยคำว่า tori )
    
*   ไปที่ TERITORI Discord [https://discord.gg/RmEqwXybr3](https://discord.gg/RmEqwXybr3) ห้อง #┃💦ㆍfaucet แล้วพิมพ์ $request ตามเลขกระเป๋าของเรา เช่น $request tori1xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    

3.4 สร้าง Validator

*   คัดลอกคำสั่งไปวาง และ enter
    
    `TERITORI_WALLET_ADDRESS=$(teritorid keys show $WALLET -a) TERITORI_VALOPER_ADDRESS=$(teritorid keys show $WALLET --bech val -a) echo 'export TERITORI_WALLET_ADDRESS='${TERITORI_WALLET_ADDRESS} >> $HOME/.bash_profile echo 'export TERITORI_VALOPER_ADDRESS='${TERITORI_VALOPER_ADDRESS} >> $HOME/.bash_profile source $HOME/.bash_profile`
    
*   เช็คยอดว่าเหรียญ utori ที่ขอทาง faucet ไปได้มาหรือยัง (ถ้ามาแล้วจะขึ้นเลข 1000000)
    
    `teritorid query bank balances $TERITORI_WALLET_ADDRESS`
    
*   ถ้าได้เหรียญทดสอบมาแล้วให้ใช้คำสั่งนี้
    
    `teritorid tx staking create-validator --amount 1000000utori --from $WALLET --commission-max-change-rate "0.01" --commission-max-rate "0.2" --commission-rate "0.07" --min-self-delegation "1" --pubkey $(teritorid tendermint show-validator) --moniker $NODENAME --chain-id $TERITORI_CHAIN_ID`
    
*   จะขึ้นมาถามว่า (y/N) ให้ตอบ y
    
*   ถ้าสำเร็จแล้วจะขึ้น txhash บรรทัดสุดท้าย
    

3.5 ไปที่เว็บ [https://teritori.explorers.guru/](https://teritori.explorers.guru/) ด้านบนใส่เลข wallet ของเราที่ได้มาจากข้อ 2.3

*   เว็บจะแสดงข้อมูล wallet ของเรา ให้เลื่อนไปด้านล่าง ตรงเมนู Delegations > Validator จะมีชื่อ Node ของเราอยู่ ให้กดเข้าไป
    
*   จะแสดงหน้า Validator ของเราให้ copy link มาหน้าเว็บนี้ แล้วไปส่งใน discord ห้อง #┃🦾ㆍrole-requests แล้วเราจะได้ role Validator มา
    

* * *

ถ้าติดปัญหาใด ส่งข้อความมาสอบถามได้ที่

*   Discord user : krit#7901
    
*   Twitter : [https://twitter.com/KIssarasena](https://twitter.com/KIssarasena)
    

More about SnakeDAO
-------------------

[Twitter](https://twitter.com/SnakeDAOproject) [Discord](http://discord.gg/A7MV2ZDnpD) [Link3](https://link3.to/70285234) [Lenster](https://lenster.xyz/communities/0x57e8-0x09) [Debank profile](https://debank.com/profile/0xd803589968d4dcd57a97d897693c45c8bb753b16)

### Reference :

อ้างอิงข้อมูลจาก : [https://github.com/StakeTake/guidecosmos/tree/main/teritori/teritori-testnet-v2](https://github.com/StakeTake/guidecosmos/tree/main/teritori/teritori-testnet-v2) และ Discord Teritori [https://discord.gg/RmEqwXybr3](https://discord.gg/RmEqwXybr3)

เพิ่มเติม VDO รัน Node ภาษาอังกฤษจาก kjnodes วิธีอาจจะแตกต่างไปบ้างนะครับ ถ้าทำตามวิธีด้านบนไม่สำเร็จลองทำตามวิธีนี้ดู

[![]({{DOMAIN}}/editor/youtube/play.png)](https://www.youtube.com/watch?v=txFQ_rKrkmg)

---

*Originally published on [Krit](https://paragraph.com/@krit/teritori-testnet)*
