Author

Topic: is there a way i can get getRawTransaction without querying bitcoind/bitcoin-cli (Read 439 times)

sr. member
Activity: 434
Merit: 270
update: looks like it was in mempool

and found this answer https://bitcoin.stackexchange.com/questions/35707/what-are-pros-and-cons-of-txindex-option

Quote
By default -txindex=0 Bitcoin Core doesn't maintain any transaction-level data except for those

in the mempool or relay set
pertinent to addresses in your wallet
pertinent to your "watch-only" addresses


damn i am learning something new every day.
thanks
sr. member
Activity: 434
Merit: 270
Your question is incredibly hard to understand.

What is "tx_hex"? Do you mean the hexstring of the raw transaction or the txid?

If you have a hexstring, you can use decoderawtransaction to decode the raw hex of a transaction.

or tx_hex a key, and value is stored in the data directory of bitcoin ?

more like

key => value pair

where tx_hex is key and hextransaction is stored on disk ?
No. That is completely incorrect. When you have ask for a transaction with getrawtransaction, you must have txindex enabled. The txindex means that Bitcoin Core's databases will have records with txids and the location of where the transaction data is stored in the blk*.dat files. When you request a transaction, it looks up the txid in the database and pulls it from the disk. Then it represents the binary data as a hex string.

sorry for confusion,
i meant txid.,

and looks like i got my answer.,
so there is db with
txid => txhex

and we can do
decoderawtransaction(tx_hex)
to get json data .

thanks ., this clears things up.

but i just checked i dont have
txindex=1
in my bitcoin configuration file ., but still i can do getrawtransaction .
how is that possible ?
staff
Activity: 3458
Merit: 6793
Just writing some code
Your question is incredibly hard to understand.

What is "tx_hex"? Do you mean the hexstring of the raw transaction or the txid?

If you have a hexstring, you can use decoderawtransaction to decode the raw hex of a transaction.

or tx_hex a key, and value is stored in the data directory of bitcoin ?

more like

key => value pair

where tx_hex is key and hextransaction is stored on disk ?
No. That is completely incorrect. When you have ask for a transaction with getrawtransaction, you must have txindex enabled. The txindex means that Bitcoin Core's databases will have records with txids and the location of where the transaction data is stored in the blk*.dat files. When you request a transaction, it looks up the txid in the database and pulls it from the disk. Then it represents the binary data as a hex string.
sr. member
Activity: 434
Merit: 270
hi, i am trying to understand how does the bitcoind works.,

lets say if i have tx_hex ,

can i get the getRawTransaction from tx_hex , without querying the bitcoind/bitcoin-cli ?

i mean just by decoding ?

or tx_hex a key, and value is stored in the data directory of bitcoin ?

more like

key => value pair

where tx_hex is key and hextransaction is stored on disk ?

thanks for your time.
Jump to: