> For the complete documentation index, see [llms.txt](https://tokenscript.gitbook.io/token-negotiator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tokenscript.gitbook.io/token-negotiator/learn/token-authentication/on-chain-token-authentication-evm.md).

# On Chain Token Authentication (evm)

The following solution utilises EVM Web3 Wallet Signature technology to sign a custom defined  message which, once signed can be decoded to ensure the integrity of the wallet owner and the tokens they hold.&#x20;

1. Request signature:

```
const signature = await negotiator.web3WalletProvider.signMessage(
    walletAddress, 
    SigningMessage
)
```

2. Define an array of tokens the user must hold as part of your authentication rules:

```
const claim =[{"smartContract":"0x94e22c14118353651636f9af43cd0a5a08b93da3","chain":"fantom","blockChain":"evm"}]
```

(include `tokenids: [1,3,10]` into the claim collection(s) when the user must have specific token(s))

3. Verify the owner of the wallet an the claim of tokens they hold (use the following api server side  to ensure the request and response is not manipulated by the end user (Client-side CSRF):

```
https://api.token-discovery.tokenscript.org/get-token-verification?claim=[{"smartContract":"0x94e22c14118353651636f9af43cd0a5a08b93da3","chain":"fantom","blockChain":"evm"}]&signature=0x4c8be3f2039b74e830c8febdd7d51df6db0d29e17845bec0b1f3cf8ec85579904d8b441144ddbac88fcea7b86fb03b16395aaeb2b254b836d800d45261db067d2c&message=hello-web3
```


---

# 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://tokenscript.gitbook.io/token-negotiator/learn/token-authentication/on-chain-token-authentication-evm.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.
