I’m building a cryptocurrency marketplace where users mainly buy and sell small ticket items (worth $10 - $50) using cryptocurrency. However, the "miner fees" are making it prohibitively expensive to run.
I have a marketplace of vendors and buyers where a user can be both a vendor and a buyer. A buyer must deposit funds in his account (top up account balance) before he can spend cryptocurrency on the platform. For every new user, we would generate a unique address so that any funds deposited to that address would be credited to that user. It makes it easy to know who to credit when we detect a deposit to a specific address. My main dilemma is regarding disbursements to the vendor and taking platform fee (see below).
After the buyer purchases an item (using account balance), the payment is held in escrow until the item is delivered to buyer. Once the item is delivered, the payment is “transferred” to the vendor minus a 1.9% “platform transaction fee” (which is paid to the platform owner). A vendor can withdraw his earnings at any time after paying a flat $5 withdrawal fee. Similarly, a buyer can withdraw his deposit (account balance) at any time for the same flat $5 fee. Keep in mind a withdrawal by a vendor typically includes payment received from hundreds of transactions (all which originate from numerous buyers and numerous addresses). It may also include a deposit the vendor himself made in order to top up his balance.
When a single order is complete (i.e, a product is delivered) it is obviously not viable to transfer payment from the buyer’s wallet to the vendor’s private wallet as this would incur a “mining fee” every time an order is placed on the site. Instead we would be relying on the internal ledger concept described in this reply.
In short, based on the ledger concept, if a product sold for $25, we would “credit” the vendor with $25 worth of a specific type of cryptocurrency without actually broadcasting the transaction to the blockchain. Similarly, we would “deduct” the $25 of crypto from the buyers balance (using an internal database, without actually broadcasting anything to blockchain). Now let’s say a vendor completes 100 transaction * $25 when Bitcoin is worth $10,000 per BTC. So we would now owe the vendor $2,500 USD or 0.25 BTC (minus 1.9% platform fee).
When the vendor chooses to withdraw his earnings, the 0.25 BTC would be originating from 100 different addresses (100 buyers) which will obviously lead to excessive miner fees. Similarly, since the site owner takes 1.9% fee for each transaction, if the site owner wanted to consolidate all of the little cryptocurrency earned from 100 addresses to 1 address it would entail a similar process (and the relative cost would be far greater for the platform owner).
TIME SLOT APPROACH
One solution to this problem might be to have all users of the site deposit funds to a single cryptocurrency address. Of course, this makes it difficult to track who's who when making a deposit since everyone is sending to the same address. It is possible to dedicate address to a single user for a period of time (“time slot”) and then credit the user who has the dedicated “time slot” but this approach is not ideal since we would need to track which user had access to the address at a specific period of time. Furthermore, users may not remember that address allocation is time sensitive and may make deposits to that address at a future time under someone else’s “time slot”. It is also very confusing to the user and would still require dozens of unique addresses if the site has many users. However, in theory this would solve the primary issue since payment to vendor would be originating from a single address and any funds remaining in that address would go to the site owner as a platform fee.
Presumably, there are other solutions to this problem as there are many sites with similar functionality. What is the industry standard solution to this problem? What are some ways to tackle it? Any insight is highly appreciated.
Note: The marketplace will support deposits/withdrawals in Bitcoin, Ethereum, Bitcoin Cash, Ripple, Litecoin, USDC and USDT.
Note: I'm open to a native solution that relies on the blockchain client or a API solution from a reputable firm.