Bitcoin Forum
May 31, 2024, 02:30:25 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: verify bitcoin transaction  (Read 3107 times)
qrius1111 (OP)
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile
December 26, 2013, 11:48:17 AM
 #1

hi all, newbie here Smiley

i asked this question previously in the newbie area, but i think this section is more appropriate.

i am trying to understand the bitcoin transaction verification process in depth. as i understand it, it is possible to prove that a transaction has legitimately claimed the output of a previous transaction - ie that a transaction is legitimate. to do this, i would need to perform an operation on the transaction and obtain as a result the previous output address. since the transaction is not mine, i do not own the private key of the output address, so it seems that all the information i need is purely contained within the transaction and the output of the previous transaction (which can be identified via the txid hash and index specified within the later transaction).

i found this code which has a function called "verify_message" - https://github.com/nanotube/supybot-bitcoin-marketmonitor/blob/master/GPG/local/bitcoinsig.py

will this function verify that a transaction is legitimately linked to a previous output address? if so then what are the inputs that need to be used? the address i know, and i'm guessing that the signature is the scriptsig of the latest transaction, but what is the "message" argument? is it something like the hash of the latest transaction?

can someone please help. i'd like to actually implement a test in python using a real transaction from the blockchain.

apparently this is a process which miners do before including new transactions in the block (http://bitcoin.stackexchange.com/a/9461/2116) so if there is any python mining code that somebody could link me to which actually does this natively that would be really helpful.

i've looked all around the web for the code which computes the address from the tx input script and previous txout elements in python. i think i found some in c# (http://stackoverflow.com/questions/19665491/how-do-i-get-an-ecdsa-public-key-from-just-a-bitcoin-signature-sec1-4-1-6-k) but i'm not experienced enough in c#, like i am in python, to actually try it out.

i'm really just keen to fully understand how bitcoin works at these nitty gritty levels. many thanks in advance!
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
December 26, 2013, 02:35:27 PM
 #2

Messages are not transactions.  Messages are verified by checking ECDSA on the message hash, which is very simple.

Transactions are verified by executing the two script halves, which is not so simple.

https://en.bitcoin.it/wiki/OP_CHECKSIG

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
qrius1111 (OP)
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile
December 26, 2013, 10:04:08 PM
 #3

i did actually think the process was the same so thanks for the clarification!

it looks like etotheipi made the diagram in that page on the wiki. and it also looks like he has a python bitcoin library - https://bitcointalk.org/index.php?topic=27179.10;wap2 - here - https://github.com/etotheipi/PyBtcEngine Smiley

cheers for the lead!
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!