<p>This is a very complicated question. bcoin already has a built-in wallet that can do all of these operations for you. There is a well-documented RESTful HTTP API you can read through here: <a href="http://bcoin.io/api-docs/" rel="nofollow noreferrer">http://bcoin.io/api-docs/</a> to get an idea of what's available. You can also write your own wallet application using the bcoin object classes directly.</p>

<p>Very broadly however, here's some tips that might interest you:</p>

<ul>
<li><p>Enable Address indexing. This is a feature that is not currently available in bitcoind yet (so far I think only indexing by transaction ID is supported). This is switched on with <code>indexAddress: true</code> in <code>bcoin.conf</code> or <code>--index-address</code> on the command line. The address index will enable you to request the transactions associated with a specific address: <a href="http://bcoin.io/api-docs/#get-tx-by-address" rel="nofollow noreferrer">http://bcoin.io/api-docs/#get-tx-by-address</a></p></li>
<li><p>You will want to process that transaction data and maybe cross-check the UTXO set (so you know what has been spent already) with the API call <a href="http://bcoin.io/api-docs/#get-coin-by-outpoint" rel="nofollow noreferrer">http://bcoin.io/api-docs/#get-coin-by-outpoint</a></p></li>
<li><p>Check out the <code>MTX</code> and <code>Coin</code> objects to construct a transaction from the UTXO you recover. We have several guides on transaction handling, maybe read through this: <a href="http://bcoin.io/guides/working-with-txs.html" rel="nofollow noreferrer">http://bcoin.io/guides/working-with-txs.html</a></p></li>
<li><p>Signing transactions with private keys: I'm not sure how your application will work but it sounds like the users will have to sign the TX themselves?</p></li>
</ul>

<p>I recomend you read through the bcoin API docs and the guides (and of course, the codebase!). And just focus on the default wallet process for coin selection, transaction composition, signing, and private key handling.</p>

CC BY-SA 4.0
2019-07-16T22:21:57.203Z
2019-07-16T22:21:57.203Z
pinhead
<p>I am new to development. I am working on a project and I am trying to use bcoin.
I want to create an application which has a UI, where the user will be asked to enter Destination address and amount. And maybe the sender's public key as well, if it is not already entered.
Then the application will fetch the UTXOs relevant to the sender's public key from some other Full Node.
And based the UTXOs and the input data entered by the user, my application will construct a transaction HEX.
I need the final outcome in XDR format. But I will try to do that on my own.</p>

<p>I will not be connecting to the Bitcoin network, I will connect with another network which has forked bitcoin code.
I know this is a very silly question. But if anyone could guide me towards the right path on how to accomplish the above.</p>

CC BY-SA 4.0
2019-02-13T16:39:44.867Z
I would help answer this question but I don't fully understand what you are after - do you want to manually create raw transactions using Bcoin?  If so the "sender" in your case would need to be the Bcoin node you are running and you can fetch the unspent outputs and construct a transaction using outputs which are address amount pairs.
PW Kad
CC BY-SA 4.0
2019-02-14T14:03:09.310Z
Yes, I want to create raw transactions using Bcoin, can you guide me with that?
Deb
<transactions><utxo><spv><javascript><bcoin>
How to create an application which constructs a transaction using `bcoin` (javascript)?
Deb
# How to create an application which constructs a transaction using `bcoin` (javascript)?

(Asked by: username_0 on 2019-02-13)

I am new to development. I am working on a project and I am trying to use bcoin.
I want to create an application which has a UI, where the user will be asked to enter Destination address and amount. And maybe the sender's public key as well, if it is not already entered.
Then the application will fetch the UTXOs relevant to the sender's public key from some other Full Node.
And based the UTXOs and the input data entered by the user, my application will construct a transaction HEX.
I need the final outcome in XDR format. But I will try to do that on my own.

I will not be connecting to the Bitcoin network, I will connect with another network which has forked bitcoin code.
I know this is a very silly question. But if anyone could guide me towards the right path on how to accomplish the above.

**Tags:** transactions, utxo, spv, javascript, bcoin

> **Comments:**
> **username_1**: I would help answer this question but I don't fully understand what you are after - do you want to manually create raw transactions using Bcoin?  If so the "sender" in your case would need to be the Bcoin node you are running and you can fetch the unspent outputs and construct a transaction using outputs which are address amount pairs.  
> **username_0**: Yes, I want to create raw transactions using Bcoin, can you guide me with that?  

---

## 1 answers

### Answer by username_2 on 2019-07-16. Score: 0

This is a very complicated question. bcoin already has a built-in wallet that can do all of these operations for you. There is a well-documented RESTful HTTP API you can read through here: <http://bcoin.io/api-docs/> to get an idea of what's available. You can also write your own wallet application using the bcoin object classes directly.

Very broadly however, here's some tips that might interest you:

* Enable Address indexing. This is a feature that is not currently available in bitcoind yet (so far I think only indexing by transaction ID is supported). This is switched on with `indexAddress: true` in `bcoin.conf` or `--index-address` on the command line. The address index will enable you to request the transactions associated with a specific address: <http://bcoin.io/api-docs/#get-tx-by-address>
* You will want to process that transaction data and maybe cross-check the UTXO set (so you know what has been spent already) with the API call <http://bcoin.io/api-docs/#get-coin-by-outpoint>
* Check out the `MTX` and `Coin` objects to construct a transaction from the UTXO you recover. We have several guides on transaction handling, maybe read through this: <http://bcoin.io/guides/working-with-txs.html>
* Signing transactions with private keys: I'm not sure how your application will work but it sounds like the users will have to sign the TX themselves?

I recomend you read through the bcoin API docs and the guides (and of course, the codebase!). And just focus on the default wallet process for coin selection, transaction composition, signing, and private key handling.


---

