> For the complete documentation index, see [llms.txt](https://docs.chiliz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chiliz.com/th/riang-ru/validator/run-validator-node.md).

# การรัน Validator Node

## **validator node คืออะไร?**

เพื่อเป็น[ผู้ตรวจสอบความถูกต้อง](https://docs.chiliz.com/chiliz-chain-2.0/validator) ของ Chiliz Chain คุณจำเป็นต้องรัน validator node ไม่ว่าจะบนฮาร์ดแวร์ของคุณเองหรือผ่านพาร์ทเนอร์\
node คือเว็บเซิร์ฟเวอร์ที่ถูกตั้งค่าขึ้นมาเพื่อยืนยันธุรกรรมก่อนที่จะบันทึกลงบน Chiliz Chain

{% hint style="info" %}
โปรดทราบว่าเรามีหน้าเอกสารสำหรับการรัน node ในรูปแบบทั่วไปด้วย: [https://github.com/chiliz-chain/docs/blob/master/th/develop/basics/connect-to-chiliz-chain/run-a-chiliz-chain-node.md](https://github.com/chiliz-chain/docs/blob/master/th/develop/basics/connect-to-chiliz-chain/run-a-chiliz-chain-node.md "mention")
{% endhint %}

## TL;DR

ในการรัน validator node คุณต้องตั้งค่าพารามิเตอร์ต่อไปนี้:

```bash
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
--mine \
--chiliz \ # for Chiliz Mainnet. Use --spicy for Spicy Testnet.
--datadir=/datadir \
--password=/datadir/password.txt \
--allow-insecure-unlock \
--unlock=REPLACE_WITH_VALIDATOR_ADDRESS \
--syncmode=full \
--gcmode=archive \
--miner.etherbase=REPLACE_WITH_VALIDATOR_ADDRESS
--nodekeyhex=2668f377e69de_EXAMPLE_REPLACE_WITH_YOUR_VALUE_c88bea3e337446ed73 \
--nat=extip:140.250.140.250 \ # This is just an example.
--verbosity=4
```

{% hint style="warning" %}
อย่าใช้คำสั่งนี้โดยตรง!

ตรวจสอบให้แน่ใจว่าคุณได้อัปเดตพารามิเตอร์ `unlock`, `miner.etherbase` และ `nodekeyhex` แล้ว!
{% endhint %}

## ข้อกำหนดเบื้องต้น

ในการรัน validator node ของ Chiliz Chain คุณต้องติดตั้ง Docker Engine บนเครื่องหรือเซิร์ฟเวอร์ของคุณ\
คุณสามารถใช้ผู้ให้บริการ cloud เช่น Amazon Web Services, Google Cloud Platform หรือ Microsoft Azure หรือจะตั้งค่าเซิร์ฟเวอร์ของคุณเองก็ได้ (ดูด้านล่าง)

กรุณาทำการ[ติดตั้ง Docker](https://docs.docker.com/engine/install/) ให้เสร็จสมบูรณ์ก่อนดำเนินการต่อ

### ข้อกำหนดของระบบ

คุณจำเป็นต้องมีเซิร์ฟเวอร์เฉพาะสำหรับการรัน validator node ของคุณ:

* CPU: อย่างน้อย 2 คอร์
* หน่วยความจำ: RAM อย่างน้อย 4 GB
* ดิสก์: ใช้ solid-state drive (SSD) เพื่อประสิทธิภาพสูงสุด
  * เราแนะนำให้มีพื้นที่ดิสก์ว่างอย่างน้อย 300 GB สำหรับการซิงค์กับ blockchain
* แบนด์วิดท์เครือข่าย: อย่างน้อย 10 Gbps

## Docker images สำเร็จรูป

ดูหรือใช้ Docker images สำเร็จรูปจาก[พื้นที่เก็บข้อมูลสาธารณะของ Chiliz Chain 2.0](https://hub.docker.com/repository/docker/chilizchain/ccv2-geth) บน Docker Hub โปรดทราบว่าคุณต้องมีบัญชี Docker Hub เพื่อเข้าถึงพื้นที่เก็บข้อมูลดังกล่าว

## การเปิดใช้งาน validator node และเริ่มการซิงค์

จุดเริ่มต้นที่แนะนำสำหรับการรัน validator node ของ Chiliz Chain คือการใช้ mounted data volume หากใช้วิธีนี้ในการสร้าง Docker container ใหม่ ข้อมูลจะถูกเก็บไว้ในไดเรกทอรีและสามารถนำมาใช้ซ้ำหรือโคลนไปยัง validator อื่นได้อย่างง่ายดาย

{% hint style="info" %}
ในฐานะที่เป็น fork ของ Ethereum นั้น Chiliz Chain ใช้ [Geth](https://geth.ethereum.org/) สำหรับ node server

Go-ethereum (หรือที่รู้จักในชื่อ Geth) คือ Ethereum client ที่สร้างด้วย Go การรัน Geth ควบคู่กับ consensus client จะเปลี่ยนคอมพิวเตอร์ให้เป็น node ดังนั้นจึงเป็นส่วนสำคัญของ node ของคุณ

เรา fork Geth มาเป็น `ccv2-geth` ดังที่จะเห็นด้านล่าง
{% endhint %}

### สร้างที่อยู่ validator

สร้าง validator node ด้วยคำสั่งต่อไปนี้:

```sh
docker run --rm -ti \
-v $(pwd)/keystore:/root/.ethereum/keystore/ \
chilizchain/ccv2-geth:latest \
--chiliz \  # for Chiliz Mainnet. Use --spicy for Spicy Testnet.
account new
```

คุณจะต้องพิมพ์รหัสผ่านสำหรับไฟล์คีย์ลับ

* **ที่อยู่สาธารณะของคีย์:** ขณะรัน validator ที่อยู่นี้จะถูกใช้เพื่อตั้งค่าพารามิเตอร์ `--unlock`

```sh
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
--chiliz \ # for Chiliz Mainnet. Use --spicy for Spicy Testnet.
...
--unlock=REPLACE_WITH_VALIDATOR_ADDRESS # This is just an example.
```

* **เส้นทางของไฟล์คีย์ลับ:** ไฟล์นี้ต้องถูกย้ายไปยังไดเรกทอรี "keystore" ภายใน datadir `$(pwd)/my-datadir` ที่คุณสร้างไว้ในขั้นตอนก่อนหน้า ดังนั้นเส้นทางสุดท้ายของไฟล์จะเป็น\
  `"$(pwd)/my-datadir/keystore/UTC–(TIMESTAMP)-(ADDRESS)"`\
  **อย่า**เปลี่ยนชื่อไฟล์
* **รหัสผ่าน:** รหัสผ่านที่คุณพิมพ์ในระหว่างการรันคำสั่งก่อนหน้านี้ต้องถูกเก็บไว้ในไฟล์:\
  `$(pwd)/my-datadir/password.txt`\
  ไฟล์นี้จะถูกใช้เพื่อตั้งค่า `--password` ขณะรัน validator node\
  อย่าลืมว่าไฟล์ทั้งหมดใน host path `$(pwd)/my-datadir` จะอยู่ในคอนเทนเนอร์ที่ไดเรกทอรี `/datadir` นี่คือเหตุผลที่พารามิเตอร์รหัสผ่านควรตั้งค่าดังตัวอย่างต่อไปนี้:

```sh
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
--chiliz \ # for Chiliz Mainnet. Use --spicy for Spicy Testnet.
...
--password=/datadir/password.txt
...

```

สิ่งสำคัญมากที่ต้องคำนึงถึงคำแนะนำต่อไปนี้:

* คุณสามารถแชร์ที่อยู่**สาธารณะ**ของคุณกับใครก็ได้ คนอื่นต้องการที่อยู่นี้เพื่อโต้ตอบกับคุณ
* คุณต้อง**ไม่แชร์**คีย์ลับกับใครทั้งนั้น! คีย์นี้ควบคุมการเข้าถึงเงินทุนของคุณ!
* คุณต้อง**สำรองข้อมูล**ไฟล์คีย์ของคุณ! หากไม่มีคีย์ จะไม่สามารถเข้าถึงเงินทุนในบัญชีได้!
* คุณต้อง**จำ**รหัสผ่านของคุณ! หากไม่มีรหัสผ่าน จะไม่สามารถถอดรหัสคีย์ได้!

### สร้างคีย์ validator node

*ส่วนนี้เป็นตัวเลือกเสริม*

เราแนะนำให้สร้างสตริงเลขฐานสิบหกแบบสุ่มสำหรับ node\
ซึ่งจะเป็นประโยชน์สำหรับการติดตามใน log และเพื่อหลีกเลี่ยงปัญหาการเชื่อมต่อ peer กับ blockchain

คุณสามารถใช้ <https://www.browserling.com/tools/random-hex> และสร้างคีย์เลขฐานสิบหกที่มี 64 ตัวอักษรต่อ node หนึ่งตัว\
ขณะรัน validator node คุณสามารถตั้งค่า `--nodekeyhex` ด้วยค่านี้ เพื่อให้แน่ใจว่าเมื่อคุณรีสตาร์ท node นั้น node จะมีที่อยู่ node เดิม (เรียกว่า "enode address") ซึ่งจะช่วยให้การดีบักหรือค้นหาข้อผิดพลาดในอนาคตทำได้ง่ายขึ้น

```bash
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
--chiliz \ # for Chiliz Mainnet. Use --spicy for Spicy Testnet.
...
--nodekeyhex=2668f377e69de_EXAMPLE_REPLACE_WITH_YOUR_VALUE_c88bea3e337446ed73 # This is just an example.
...
```

### ตั้งค่ากลไก NAT port mapping ของ Geth

พารามิเตอร์ `--nat` ของ Geth มีตัวเลือกดังนี้: `any`, `none`, `upnp`, `pmp`, `pmp:<IP>` และ `extip:<IP>` ค่าเริ่มต้นคือ `any` [ดูเอกสาร Geth สำหรับข้อมูลเพิ่มเติม](https://geth.ethereum.org/docs/fundamentals/command-line-options)

เราแนะนำให้ใช้ตัวเลือก `extip:<IP>` โดยที่ `<IP>` คือที่อยู่ IPv4 สาธารณะที่กำลังเปิดใช้งาน validator อยู่

```sh
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
--chiliz \ # for Chiliz Mainnet. Use --spicy for Spicy Testnet.
...
--nat=extip:140.250.140.250 # This is just an example.
...
```

### ตั้งค่าความละเอียดของ log

สำหรับการแก้ไขปัญหาเชิงลึก พารามิเตอร์ความละเอียดของ log `--verbosity` ของ Geth สามารถตั้งค่าได้ดังนี้:

* 0=silent
* 1=error
* 2=warn
* 3=info
* 4=debug
* 5=detail

ค่าเริ่มต้นคือ 3\
เราแนะนำให้คุณใช้ 4

```sh
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
--chiliz \ # for Chiliz Mainnet. Use --spicy for Spicy Testnet.
...
--verbosity=4 # This is just an example.
...
```

## การเปลี่ยนเจ้าของ node

อาจมีเวลาที่คุณไม่ต้องการรัน validator node อีกต่อไป คุณอาจต้องการส่งต่อ node ให้กับคนอื่น

ในกรณีนี้ คุณสามารถทำตามขั้นตอนต่อไปนี้:

1. เชื่อมต่อกระเป๋าเงินของคุณกับ [Chiliz Staking dApp](https://governance.chilizchain.com/staking)
2. คลิกปุ่ม "Change owner"

<figure><img src="/files/p0FU74BJyBUTled0g3SZ" alt=""><figcaption></figcaption></figure>

3. ในหน้าต่าง modal ระบุที่อยู่ปัจจุบันของ node ที่คุณต้องการเปลี่ยนเจ้าของ และที่อยู่ใหม่ (ที่ได้รับจากเจ้าของใหม่)

<figure><img src="/files/bi1Q19ssIvZKUdycfh4R" alt="" width="358"><figcaption></figcaption></figure>

เมื่อส่งแล้ว การเปลี่ยนแปลงจะมีผลทันที


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.chiliz.com/th/riang-ru/validator/run-validator-node.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
