Bitcoin Forum
May 13, 2024, 06:51:00 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: is there a way i can get getRawTransaction without querying bitcoind/bitcoin-cli  (Read 437 times)
btctousd81 (OP)
Sr. Member
****
Offline Offline

Activity: 434
Merit: 270


View Profile WWW
July 29, 2017, 05:55:41 PM
Last edit: July 29, 2017, 06:19:46 PM by btctousd81
 #1

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.

Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715583060
Hero Member
*
Offline Offline

Posts: 1715583060

View Profile Personal Message (Offline)

Ignore
1715583060
Reply with quote  #2

1715583060
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
July 29, 2017, 07:07:10 PM
 #2

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.

btctousd81 (OP)
Sr. Member
****
Offline Offline

Activity: 434
Merit: 270


View Profile WWW
July 29, 2017, 07:18:31 PM
 #3

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 ?

btctousd81 (OP)
Sr. Member
****
Offline Offline

Activity: 434
Merit: 270


View Profile WWW
July 29, 2017, 07:34:44 PM
 #4

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

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!