How to make transaction without wallet?

2

2

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.

Kris Roofe

Posted 2018-03-29T08:58:28.653

Reputation: 135

Answers

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.

Adam

Posted 2018-03-29T08:58:28.653

Reputation: 3 215

I use a command line only, non-wallet distribution, so I just want to create, sign and send transactions with command-cli or rpc.Kris Roofe 2018-03-29T09:27:40.060

I use a non-wallet distribution.Kris Roofe 2018-03-29T10:03:09.583

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.Adam 2018-03-29T10:29:01.900

Do you mind getting those transactions using a third-party? Take a look at blockchain.info API or Blockcypher.Adam 2018-03-29T10:31:03.750