Bitcoin Forum
April 18, 2024, 11:33:27 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Pushing data to CScript on: September 02, 2017, 08:54:54 PM
Hi!

Just started learning Bitcoin Core code to better understand Bitcoin.
My C is a little bit rusty and I know just a little bit of C++ but I think I will pick it up fast as I progress.

I was thinking that the Bitcoin Script was a good place to start.
This is really basic so I hope I don't offend anyone.

What's the easiest way to push data (other than OP_CODES) to the CScript stack?

Code:
    CScript *cScript;
    opcodetype test;

    cScript = new CScript();
    *cScript << opcodetype::OP_HASH160;
   
    //Pushing 20 bytes
    *cScript << opcodetype::0x14
   
    //Need to push some address here but this is not the right way to do it...
    *cScript << "71ed53322d470bb96657deb786b94f97dd46fb15";
   
    *cScript << opcodetype::OP_EQUAL;


Thank you.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!