# Common Utilities

Shared functionality and utilities used across STON.fi products.

## Transaction Sending

Common patterns and utilities for sending transactions on TON:

* [Via TON Core](/developer-section/common/transaction-sending/toncore.md) - Using @ton/ton library
* [Via TonWeb](/developer-section/common/transaction-sending/tonweb.md) - Using TonWeb library
* [Via TonConnect](/developer-section/common/transaction-sending/tonconnect.md) - Using TonConnect for wallet integration

These guides apply to both DEX and Omniston integrations.

## Best Practices

### Transaction Management

* Always handle transaction failures gracefully
* Implement proper retry logic with exponential backoff
* Monitor transaction status until confirmation

### Gas Optimization

* Batch operations when possible
* Use appropriate gas limits
* Consider TON's async nature in your design

### Security

* Validate all inputs before sending transactions
* Never store private keys in code
* Use secure wallet connections (TonConnect)

### Error Handling

* Catch and handle specific error types
* Provide meaningful error messages to users
* Log errors for debugging

## TON Blockchain Specifics

Understanding TON's unique features is crucial:

* **Async Messages**: Transactions are processed asynchronously
* **Sharding**: Different contracts may be on different shards
* **Message Routing**: Internal messages between contracts
* **Gas Model**: Different from Ethereum-style blockchains


---

# Agent Instructions: 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:

```
GET https://docs.ston.fi/developer-section/common.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
