3

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.

SCENARIO:

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).

THE PROBLEM

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.

3
  • 3
    Please limit the scope of this question to Bitcoin. Other currencies are off-topic here. Dec 23 '20 at 2:02
  • @PieterWuille I thought that if the primary question relates to Bitcoin, I can include altcoins as secondary: "Questions about alternative cryptocurrencies are off topic unless they are applicable to Bitcoin"
    – S.O.S
    Dec 23 '20 at 2:04
  • I understand that to cover questions for which the answer is the same as for Bitcoin.
    – Murch
    Dec 23 '20 at 18:51
4

As @chytrik already described, address reuse does not solve your problem for UTXO-based coins, each transaction output must be individually referenced regardless.

When your users deposit into your site, you want to give them separate addresses, so that you can track whose internal balance should be credited. After that, the funds are in your custody, though. Which means that you can and should manage your UXTO pool. A good start would be to regularly consolidate smaller amounts into larger UTXOs during off-peak hours when the feerates are low. You may find this article about UTXO management for enterprise wallets interesting.

Generally, Bitcoin on-chain payments don't lend themselves to fast micropayments—as you observed the fees are too big of a portion of the value. Bitcoin's response to that is the Lightning Network, an instant payment network leveraging multisignature based payment channels.

4
  • Thanks for your reply. 1) Is the "time slot" proposal a viable solution for altcoins such as Ethereum which use the Account Model? 2) The fee to transfer $2,500 to Vendor is approx. $376.37 (USD) (15% of the total) with a 60 min time frame according to this site. For a 400 min time frame cost is reduced to $78.50 (USD) (1.5% of total). The platform charges a 1.9% fee which would be eaten up by the high cost. Would you say this is the lowest fee I could expect to pay using the legacy BTC protocol (The API I'm using doesn't support Lighting Network) ?
    – S.O.S
    Dec 22 '20 at 18:13
  • 1
    Bitcoin fees are not relative to the amount that is sent, but relative to the amount of blockspace a transaction occupies. If you can wait longer, you will eventually be able to get a transaction through at 5 sat/vB or lower. If you want to be really patient even at 1 sat/vB. For an average-sized transaction of 500 vB that translates to 500-2,500 satoshi of fees—at today's exchange rate less than a dollar. For questions about ethereum, I would suggest that you check out ethereum.stackexchange.com.
    – Murch
    Dec 23 '20 at 18:56
  • A SE user (@Prayank) commented on another question of mine "I can have one website, user login, all pay to same address but updated in my local database with user id and transaction id when payment is done" Would you agree to that statement? Is it possible to track user deposits using the transaction ID (TXID) if everyone on the site is sending to the same Bitcoin address? It doesn't make sense to me..
    – S.O.S
    Jan 14 at 17:22
  • 1
    While it is correct that every transaction has a unique id and therefore every unspent transaction output is uniquely identifiable, having everyone pay to the same address will introduce a lot of overhead with tracking who paid when. It will be much easier to assign a new address for every payment process (or at least every customer). Generally, address reuse has a lot of disadvantages, and afaict no palpable advantages in Bitcoin.
    – Murch
    Jan 14 at 17:38
3

One solution to this problem might be to have all users of the site deposit funds to a single cryptocurrency address

This is definitely not a solution to the problem you've outlined. When creating a transaction, there is no difference between consolidating many payments that were made to the same address, and consolidating many payments that were made to unique addresses. Each payment you include will represent a single input to the transaction.

From the sounds of it, you are confusing the concept of an account based model for transactions, and a UTXO-based model for transactions (which is what bitcoin employs).

2
  • Thanks. While the main questions is about BItcoin, would the time slot approach be a solution for Ethereum (account based model) type transactions?
    – S.O.S
    Dec 29 '20 at 16:38
  • 1
    @S.O.S I don’t find Ethereum that interesting, so I am no expert in its operation, but I would guess that the ‘time slot approach’ is almost certainly not a good solution for any such situation, given the issue of many users potentially making concurrent deposits. (And the issue of delayed tx confirmation, etc)
    – chytrik
    Dec 29 '20 at 20:08
0

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.

Use segwit for on-chain transactions, batching wherever possible, UTXO consolidation over weekends once you have lot of small inputs and use latest technologies when they are available like taproot

Try to use less on-chain and more layer 2 solutions like LN and Liquid

Tradeoffs including different levels of decentralization and trust assumptions when using Liquid or any bitcoin sidechains

4
  • Liquid is probably not a good advice for someone who wants to use Bitcoin. It's kind of like saying "use altcoins".
    – darosior
    Dec 23 '20 at 19:06
  • *use bitcoin sidechains :)
    – Prayank
    Dec 23 '20 at 19:38
  • 1
    I don't think that's good advice in general. Liquid's trust model relies on specific entities that form the federation controlling it. If you don't already have a trust relation with these companies, there isn't a reason why you should. Dec 27 '20 at 0:20
  • Better than moving to some altcoins because of on-chain fees. Nobody cares about on-chain fees anyways apart from few devs and users so it will always become difficult for transactions mentioned by OP. I have also.mentioned LN. If people don't want to use or suggest bitcoin sidechains, lot of users will move to altcoins. Individual user cares about his transaction and fees. Also if people could respond to this: github.com/bitcoin/bitcoin/pull/13990
    – Prayank
    Dec 27 '20 at 0:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.