3

I've some utxos with a address. I use CreateRawTransaction to make a transacton. But this method need a txid filed, I've searched a lot to get the txid from the address, but I didn't find any.

So is it possible to make transaction without wallet programmatically?

Note:I use the command line only, non-wallet distribution, I just want to create, sign and send transactions with command-cli or rpc.

1 Answer 1

2

You can create raw transaction, sign, ...etc programmatically but if you need to fetch address transactions (inputs) or broadcast the signed transaction to bitcoin network you'll need to connect to Bitcoin network.

Bitcoin-core is amazing for this purpose and if you don't want to download the whole blockchain you can alternatively use Electrum servers.

helpful commands for Bitcoin-core:

listunspent: returns an array of unspent transaction outputs belonging to this wallet.

ListTransactions: returns the most recent transactions that affect the wallet.

Electrum commands:

after connecting to some electrum server you should send JSON-RPC commands

listunspent example:

{ "id": 1, "method":"blockchain.address.listunspent", "params"["1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L"] }

UPDATE

if you are already using Bitcoin-core, so you only need to call listunspentto get your wallet UTXO's or provide an address to get that address UTXO's.

bitcoin-cli listunspent MIN_CONF MAX_CONF "["ADDRESS_NUMBER_ONE","ADDRESS_NUMBER_TWO"]"

If those address doesn't belong to your wallet, you should import them first.

4
  • I use a command line only, non-wallet distribution, so I just want to create, sign and send transactions with command-cli or rpc. Commented Mar 29, 2018 at 9:27
  • I use a non-wallet distribution. Commented Mar 29, 2018 at 10:03
  • Sorry I didn't see that part. I'm pretty sure it's hard to do what you're asking with your conditions. The best alternative is electrum, you can do what you looking for through command line.
    – Tailer
    Commented Mar 29, 2018 at 10:29
  • Do you mind getting those transactions using a third-party? Take a look at blockchain.info API or Blockcypher.
    – Tailer
    Commented Mar 29, 2018 at 10:31

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.