> For the complete documentation index, see [llms.txt](https://docs.streamnft.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.streamnft.tech/streamnft-protocol/web3-gaming-services/matchmaking/token-gated-matchmaking.md).

# Token Gated Matchmaking

Ways to enable token gated matchmaking with tokens as NFT rewards:\
\
1\. ERC721: tokens are moved to an escrow account, afterwards a match room is created. Tokens are moved to match winners after match completion.\
\
2\. [ERC7066](https://eips.ethereum.org/EIPS/eip-7066): tokens are locked in user wallets to create a match room and transferred to the match winner.

{% hint style="success" %}
Added advantage of using ERC7066 is project access to integration-less [NFT liquidity solutions](broken://pages/OvkUgzieeQScDlie319V) requiring **0 dev efforts**.
{% endhint %}

Steps:<br>

1. Get signer

```javascript
// function to get user signer from wallet
user.signer=streamSDK.getWalletSigner()
```

```javascript
// function to get user signer from privatekey
user.signer=streamSDK.getSigner(privateKey)
```

2. Join room

```javascript
// function to create/join a room
// @param user.id is userId of player
// @param user.address user wallet address
// @param tokenAddress contract address of NFT
// @param tokenId token Id owned by user
// @param user.signer provides a wallet instance to sign txn
// @param roomSize number of players needed to create a room
// @returns userId of winner
await streamSDK.joinRoom(user.id, user.address, tokenAddress, tokenId, user.signer, roomSize) returns {roomId,userId}
```

3. Claim match reward

```javascript
// function to share winnings to winner
// @param roomId roomId of match
// @param user.address user wallet address
await streamSDK.winnerClaim(roomId, user.address);
```


---

# 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.streamnft.tech/streamnft-protocol/web3-gaming-services/matchmaking/token-gated-matchmaking.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.
