> For the complete documentation index, see [llms.txt](https://docs.bitbadges.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bitbadges.io/token-standard/evm_integration/tokenization-precompile/security.md).

# Security

The precompile implements security measures to protect against common attack vectors.

## Security Features

### Caller Verification

All transaction methods automatically use `msg.sender` as the caller. The caller cannot be spoofed - it's always the address that directly called the contract.

### Input Validation

All inputs are validated:

* Zero addresses are rejected
* Invalid ranges (start > end) are rejected
* Array sizes are limited to prevent DoS attacks
* Business logic constraints are enforced

### DoS Protection

Array size limits prevent denial-of-service attacks:

* Maximum 100 recipients per transfer
* Maximum 100 token ID ranges
* Maximum 100 ownership time ranges

### Reentrancy Protection

Operations execute atomically through the Cosmos SDK state machine, preventing reentrancy attacks.

## Best Practices

1. **Validate inputs** in your contracts before calling the precompile
2. **Check return values** - all methods return success indicators
3. **Handle errors** appropriately using try-catch blocks
4. **Use helper library** for type construction and validation
5. **Review permissions** - ensure approvals and collection permissions are configured correctly

For detailed security implementation, see the [precompile code](https://github.com/BitBadges/bitbadgeschain/tree/evm-poc/x/tokenization/precompile).


---

# 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.bitbadges.io/token-standard/evm_integration/tokenization-precompile/security.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.
