> 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/phatthana/phuenthan/verify-smart-contract/best-practices.md).

# แนวทางปฏิบัติที่ดีในการ Verify

การยืนยัน smart contract บน Chiliz Chain ต้องอาศัยทั้งแนวปฏิบัติมาตรฐาน EVM และความใส่ใจต่อรายละเอียดเฉพาะของ chain

เนื่องจาก Chiliz Chain ทำงานบนกลไกฉันทามติ Proof of Staked Authority (PoSA) พร้อมมาตรฐานเฉพาะอย่าง CAP-20 และการกำหนดเวอร์ชัน EVM แบบเฉพาะของตัวเอง การนำโค้ดจาก Ethereum มาใช้โดยตรงอาจไม่ได้ผลเสมอไป

## ทำความเข้าใจมาตรฐาน CAP-20

แม้ Chiliz Chain จะรองรับ EVM แต่ระบบนิเวศนี้ใช้มาตรฐาน CAP-20 สำหรับ token ซึ่งเป็นการนำ ERC-20 มาปรับใช้เฉพาะสำหรับ Chiliz

ดูรายละเอียด token ได้ที่นี่:

{% content-ref url="/pages/2aljCUr6tADH7xd6N2QV" %}
[CAP-20](/th/riang-ru/glossary/cap-20.md)
{% endcontent-ref %}

หากคุณกำลังพัฒนา Fan Token หรือ asset ที่ต้องการให้ทำงานเหมือน Fan Token คุณควรกำหนด decimals เป็น 0 อย่างชัดเจน ส่วน token DeFi มาตรฐานอาจใช้ 18

## กำหนดค่า compiler และ EVM

validator ของ Chiliz Chain ได้รับการปรับแต่งให้เหมาะสมกับเวอร์ชัน EVM เฉพาะ การใช้การตั้งค่าที่ใหม่เกินไปอาจทำให้เกิดความล้มเหลวในการปรับใช้หรือพฤติกรรมที่ไม่คาดคิด

คุณควรใช้เวอร์ชันเหล่านี้:

{% hint style="info" %}
**เวอร์ชัน Solidity และ EVM ที่แนะนำสำหรับ Chiliz Chain:**

* **เวอร์ชัน Solidity compiler:** `0.8.30` (หรือต่ำกว่า)
* **เวอร์ชัน EVM เป้าหมาย:** `prague`
  {% endhint %}

## ปรับแต่งเพื่อประหยัด gas

Chiliz Chain กำหนดราคา gas ขั้นต่ำแบบ "high-Gwei" เพื่อป้องกัน spam และรับประกันความยั่งยืนของ validator

นับตั้งแต่ Dragon8 hard fork, Chiliz Chain ใช้งาน EIP-1559 แต่มี **ค่า base fee ขั้นต่ำที่ 2500 gwei** ซึ่งหมายความว่าโค้ดที่ไม่ได้รับการปรับแต่งจะมีค่าใช้จ่ายสูงกว่า chain อื่นมากสำหรับผู้ใช้ของคุณ

ดังนั้น คุณควรปรับแต่ง contract ให้ใช้ storage อย่างมีประสิทธิภาพ (ซึ่งเป็นการดำเนินการที่แพงที่สุด):

* จัดกลุ่มตัวแปร `uint128`, `uint64` หรือ `bool` ไว้ติดกันเพื่อให้พอดีกับ storage slot ขนาด 32 bytes เดียว
* ใช้ `calldata` แทน `memory` สำหรับอาร์กิวเมนต์ของฟังก์ชันแบบอ่านอย่างเดียว (external functions) เพื่อประหยัด gas ระหว่างการดำเนินการ

{% hint style="success" %}
ติดตั้ง `hardhat-gas-reporter` และกำหนดค่าด้วยการตั้งค่าราคา gas เฉพาะของ Chiliz เพื่อดูต้นทุนจริงในหน่วย CHZ ก่อนที่คุณจะปรับใช้
{% endhint %}

## ทดสอบบน Spicy เสมอ

อย่าสันนิษฐานว่า Mainnet จะทำงานเหมือนกันโดยอิงจากประสบการณ์ Ethereum ของคุณ คุณต้องทดสอบการทำงานร่วมกับ Chiliz PoSA consensus บน Spicy Testnet ก่อนที่จะย้ายไปยัง Chiliz Chain Mainnet

ดูรายละเอียดการเชื่อมต่อได้ที่นี่:

{% content-ref url="/pages/dQdErvu9eh3NWFvwbVSA" %}
[เชื่อมต่อกับ Chiliz Chain](/th/phatthana/phuenthan/tho-chiliz-chain.md)
{% endcontent-ref %}


---

# 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/phatthana/phuenthan/verify-smart-contract/best-practices.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.
