Bitcoin Forum
May 30, 2024, 10:25:37 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: P2PK Transactions  (Read 672 times)
MeoowWoof (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
April 28, 2017, 03:38:02 PM
 #1

I am playing around with the core code trying to implement my own wallet (out of curiosity and mainly to get better grips with internals).

So far this is what i have done
- Launched in regtest mode , generated 101 blocks with mining reward 50.0 BTC paid out.
- Got hold of the chainActive structure and basically trying to implement a version of ScanForWalletTransactions.
- Following the crumbs from the above function leads me to Solver (called via isMine)

Code:
bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::vector<unsigned char> >& vSolutionsRet);

If I look at the representation of the pubKey script in the reward transaction it looks something like :

Code:
2103d7a738b1e5d4f66470d3439d970661c83e35054408eff625b441967be85caea7ac

Which is decoded to :

Code:
03d7a738b1e5d4f66470d3439d970661c83e35054408eff625b441967be85caea7 OP_CHECKSIG

Looking at the solver  , this transactions will not be decoded to TX_PUBKEY as it expects the following in the template

Code:
CScript() << OP_PUBKEY << OP_CHECKSIG

But the getBalance RPC can correctly deduce the balance,  so essentially it works.
For the love of god , i am unable to figure out how is the simple script signature of <key> OP_CHECKSIG is added to the wallet.  Any tips will be appreciated.

Cheers!
MeoowWoof (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
May 02, 2017, 03:52:25 PM
 #2

An ! can bring a man to his knees. Please ignore/lock topic. The functionality works.
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!