# Broadcasting transaction with multiple recipients using BDK-Kotlin

> A quick guide on how to use the BDK-Kotlin 0.7.0 library to create a send transaction with multiple recipients.

By Tang Yetong. Published June 25, 2022. 4 min read. Category: blockchain. Tags: BDK-Kotlin, Bitcoin, Transactions, Multiple Recipients.
Read it with the interactive demos: https://tangyetong.com/blog/broadcasting-transaction-multiple-recipients-bdk-kotlin

A quick guide on how to use the [`BDK-Kotlin 0.7.0`](https://github.com/bitcoindevkit/bdk-kotlin) library to create a send transaction with multiple recipients. 
You can use the [`Padawan Wallet`](https://github.com/thunderbiscuit/padawan-wallet) and [`dev-kit`](https://github.com/thunderbiscuit/devkit-wallet/tree/simple-wallet) open-source projects as reference. 

## TxBuilder

With the `TxBuilder()` you can create the transaciton as per usual. 

```kotlin
var txBuilder = TxBuilder()
for (recipient in recipientList) {
	txBuilder = txBuilder.addRecipient(address = recipient.first, amount = recipient.second)
}
txBuilder = txBuilder.feeRate(satPerVbyte = feeRate)
return txBuilder.finish(wallet)
```

You can write this piece of logic however you want, but to give an example of using scopes to read the `recipientList` data :

```kotlin 
val psbt = recipientList.fold(TxBuilder()) { builder, recipient ->
    builder.addRecipient(recipient.address, recipient.amount)
}.finish(wallet)
```

## Sign & Broadcast

After you have the `PSBT` object you can do whatever you want with it! Sign and broadcast with the `Wallet` and `Blockchain` object to send out the transaction.
