# วิธีทำ Teritori Testnet **Published by:** [Krit](https://paragraph.com/@krit/) **Published on:** 2022-08-03 **URL:** https://paragraph.com/@krit/teritori-testnet ## Content สามารถทำตามขั้นตอนด้านล่างได้เลย Step-By-Step ตัวผู้เขียนเองก็มือใหม่ เพิ่งหัดทำด้วยตนเอง สร้างเป็น docker ไม่เป็นเลยอาจจะยาวหน่อยนะครับ (อัพเดท 6 ส.ค. 65 แก้ไขปัญหาเชื่อม Node ไม่ได้)1) สำหรับผู้ที่ไม่เคยรัน Node มาก่อนสร้าง Virtual Machine ฟรี บน Google หรือใครมี VM อื่นอยู่แล้วก็ใช้ของตัวเองได้เลย (Virtual Machine คือ การเช่าเครื่องคอมพิวเตอร์เพื่อรัน Ubuntu คล้ายกับเช่า server ) 1.1 ไปที่ https://cloud.google.com/vm 1.2 กดปุ่ม Get started for free แล้วสมัครบัญชี, ยืนยันทางโทรศัพท์, ใส่รายละเอียดการชำระเงิน (ใช้ได้ฟรี 90 วัน เครดิต 300$ ถ้าไม่ใช้ก็กดลบ VM ออก) 1.3 เมื่อสมัครบัญชีเสร็จแล้ว ไปสร้าง VM ที่ เมนู 3 ขีดด้านซ้ายบน > Compute Engine > VM instances1.4 ที่เมนูด้านบน VM instances แล้วเลือก CREATE INSTANCE (ถ้าไม่มีให้กดที่จุด 3 จุด เมนูจะขึ้นมา)1.5 จะขึ้นหน้าสร้าง VM ให้เลื่อนไปข้างล่าง ตรงคำว่า Boot disk ให้กดปุ่ม CHANGE แล้วเลือกOperating system เป็น UbuntuVersion เปลี่ยนจาก Ubuntu 18.04 LTS ARM64 เป็น Ubuntu 18.04 LTS X86/64Size เป็น 80 GBแล้วกดปุ่ม SELECT1.6 ลงไปด้านล่างสุด กดปุ่ม CREATE จะกลับมาหน้า VM instances รอให้ status ขึ้นเป็นเครื่องหมายถูกสีเขียว แสดงว่า VM ของเราพร้อมทำงานแล้ว 1.7 กดที่ SSH ของ VM instance ที่เราเพิ่งสร้างมา จะเปิดหน้าต่าง browser ใหม่ เพื่อรันคำสั่งทำงานให้กับ VM ของเรา2) ตั้งค่า Firewall บน Google Cloud VM2.1 ที่เมนู 3 ขีด ซ้ายบนสุดของ Google Cloud กดเลือก VPC network > Firewall2.2 เลือก CREATE FIREWALL RULEเมื่อขึ้นหน้าใหม่ ให้ตั้งค่าดังนี้Name : teritoriTargets : All instances in the networkSource IPv4 ranges : 0.0.0.0/0ติ๊กถูกที่ TCP ใส่ Ports : 26656,26657ติ๊กถูกที่ UDP ใส่ Ports : 26656,26657กดที่ปุ่ม CREATE3) รัน Code บน Terminal (SSH)3.1 คัดลอก code ตามด้านล่าง ทีละบรรทัด แล้วนำไปวางบน Terminal แล้วกด Entersudo -iapt update && apt upgrade -yapt install build-essential git curl gcc make jq -ywget -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.gzecho '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_profilewget -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_profileteritorid status 2>&1 | jq .SyncInfoSNAP_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 ห้อง #┃💦ㆍfaucet แล้วพิมพ์ $request ตามเลขกระเป๋าของเรา เช่น $request tori1xxxxxxxxxxxxxxxxxxxxxxxxxxxx3.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/ ด้านบนใส่เลข wallet ของเราที่ได้มาจากข้อ 2.3เว็บจะแสดงข้อมูล wallet ของเรา ให้เลื่อนไปด้านล่าง ตรงเมนู Delegations > Validator จะมีชื่อ Node ของเราอยู่ ให้กดเข้าไปจะแสดงหน้า Validator ของเราให้ copy link มาหน้าเว็บนี้ แล้วไปส่งใน discord ห้อง #┃🦾ㆍrole-requests แล้วเราจะได้ role Validator มาถ้าติดปัญหาใด ส่งข้อความมาสอบถามได้ที่Discord user : krit#7901Twitter : https://twitter.com/KIssarasenaMore about SnakeDAOTwitter Discord Link3 Lenster Debank profileReference :อ้างอิงข้อมูลจาก : https://github.com/StakeTake/guidecosmos/tree/main/teritori/teritori-testnet-v2 และ Discord Teritori https://discord.gg/RmEqwXybr3 เพิ่มเติม VDO รัน Node ภาษาอังกฤษจาก kjnodes วิธีอาจจะแตกต่างไปบ้างนะครับ ถ้าทำตามวิธีด้านบนไม่สำเร็จลองทำตามวิธีนี้ดู ## Publication Information - [Krit](https://paragraph.com/@krit/): Publication homepage - [All Posts](https://paragraph.com/@krit/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@krit): Subscribe to updates - [Twitter](https://twitter.com/KIssarasena): Follow on Twitter