Making a secure trading system without external database?

Hello,
I wanted to implement trade system into my game. Generally i know how to make it secure, sanity checks, session locking with profile store, always trusting data on the serve, but im still not sure if its enough, as i heard somewhere (if im correct) that bigger games save the data about the trade history of an item to a external database, so if anything is duped or glitched it gets removed. Is it the only approach to making trading system truly safe? Or am i just overreacting? How would you go about making a secure, dupe and glitch free trading?

usually when u have duped items, they have same properties, same UID, UID will let you know if item is duped, so just delete items with same UID

Problem is my items dont have unique uids - from 54 unique items they can stack infinitely, so storing each of, lets say, 10k of a common item in separate uids would he straight up impossible on a bigger scale. Even if items would have unique ids, the problem would be with storing currency, which is just a number

you cant assign each trade a UUID and then log saves and gets to players accounts on behalf of that UUID?

Sorry but i don’t really get what you are saying, can you elaborate?

if youre working with fungible goods, log each trade done between accounts in their local datastore by marking the trade with a UUID and saving gets and saves with such UUID into your trading db

What you should do is make a system where the items of both players are first stored on the server somewhere, and then passed on to both players. Then if one player cancels last moment nothing happens because the items are already middle-man (server) owned instead of by that player.
Also duping shouldn’t be possible if the owned items are stored on the server and you don’t have any bugs…

Items of the players are always stored on the server, whats on the client is just a copy that a client can’t replicate back to the server. If user wants to upgrade an item, the only thing sent to the server is the item name, rest of the data like if the user has the item, can he upgrade, does he have resources - its all taken from the server. So if it’s enough i should be good?

Yep you should be good, just make sure there aren’t any race conditions in accepting/denying trades :slight_smile: