Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: adamcro on January 08, 2022, 01:24:08 PM



Title: Send Bitcoin from 1 address to multiple addresses with one transaction
Post by: adamcro on January 08, 2022, 01:24:08 PM
I want to build a marketplace, so there is a buyer and a seller. So when a buyer buys something from the seller I take the fee. Thus part of buyer's money goes to my account like (10%) and the rest to the seller.

Is there any payment provider in the crypto world that allows that, either through a payment provider or to code it by myself? Or if there isn't, what's possible solution for my problem?


Title: Re: Send Bitcoin from 1 address to multiple addresses with one transaction
Post by: BlackHatCoiner on January 08, 2022, 02:32:03 PM
The thing is simple; you give the buyer's your receiving address and once they've sent the money you send that amount of money minus the fee to the seller. Both of them have to trust you either way.

Now if there's a payment provider that does that, none that I'm aware, but it shouldn't be difficult to code this.


Title: Re: Send Bitcoin from 1 address to multiple addresses with one transaction
Post by: n0nce on January 08, 2022, 02:36:18 PM
For implementing any type of marketplace, shop, etc., I'd recommend to run a self-hosted BTCPay Server (https://btcpayserver.org/).

Bitcoin can definitely handle single-input, multiple-output transactions; that's actually the most common type of transaction, with the second output being change. I don't think that BTCPay Server or any other payment processor has a feature specifically for it though. So your best bet might be modifying the code (https://github.com/btcpayserver) yourself.

The easier thing to do however, would most probably be to receive all the payments in your own wallet & then periodically paying out the recipients in batches. Since you can pay dozens of recipients with a single transaction, it won't add much cost overhead and would require no changes to BTCPay Server.


Title: Re: Send Bitcoin from 1 address to multiple addresses with one transaction
Post by: adamcro on January 08, 2022, 04:14:53 PM
The thing is simple; you give the buyer's your receiving address and once they've sent the money you send that amount of money minus the fee to the seller. Both of them have to trust you either way.

Now if there's a payment provider that does that, none that I'm aware, but it shouldn't be difficult to code this.

You are saying what n0nce above said? I need to code some semi-custom solution?


Title: Re: Send Bitcoin from 1 address to multiple addresses with one transaction
Post by: BlackHatCoiner on January 08, 2022, 04:52:32 PM
You are saying what n0nce above said? I need to code some semi-custom solution?

Yes. You'll have to modify the BTCPay server source code.