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.

  • 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
    Feb 13, 2019 at 16:39
  • Yes, I want to create raw transactions using Bcoin, can you guide me with that?
    – Deb
    Feb 14, 2019 at 14:03

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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