# Structure of a matchmaking system

**URL:** <https://forum.algorand.co/t/structure-of-a-matchmaking-system/5190>\
**Category:** General\
**Tags:** testnet, teal\
**Created:** [November 25, 2021, 10:07am UTC](https://forum.algorand.co/t/structure-of-a-matchmaking-system/5190 "2021-11-25T10:07:08Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![arash](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@arash](https://forum.algorand.co/u/arash)\
**Post date:** [November 26, 2021, 8:55am UTC](https://forum.algorand.co/t/structure-of-a-matchmaking-system/5190/6 "2021-11-26T08:55:49Z")

</div>

I tried your suggested algorithm and got the following error on `localPut` when i call the smart contract for second player (Bob):  
`logic eval error: invalid Account reference`  
Here’s the code (I wrote a comment where I received the error):

```auto
      scratchWaitinglayer.store(App.globalGet(Bytes("waitingPlayer"))),
        If(scratchWaitinglayer.load() == Bytes(""), # no player in Queue
           Seq([
               App.globalPut(Bytes("waitingPlayer"), Txn.sender()),
           ])
           , # a player is in Queue
           Seq([
               App.localPut(Int(0), Bytes("partner"), scratchWaitinglayer.load()), #Got error here
               App.localPut(scratchWaitinglayer.load(),Bytes("partner"),Txn.sender()),
               App.globalPut(Bytes("waitingPlayer"), Bytes("")),
           ])
           ),

```

---

_[View the full topic](https://forum.algorand.co/t/structure-of-a-matchmaking-system/5190)._
