# 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](https://docs.ston.fi/developer-section/common/transaction-sending/toncore) - Using @ton/ton library
* [Via TonWeb](https://docs.ston.fi/developer-section/common/transaction-sending/tonweb) - Using TonWeb library
* [Via TonConnect](https://docs.ston.fi/developer-section/common/transaction-sending/tonconnect) - 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
