struct Transaction {
#pragma pack(1)
/* +0 */uint32_t version = 1; /* vs bitcoin-api tx block : merkleHash[32] removed */
uint8_t numInputs = 1;
uint8_t prevOutput[32];
uint32_t prevoutIndex = 0xFFFFFFFF; // +41
/* +0 */uint32_t sequence = 0xFFFFFFFF;
uint8_t numOutputs = 1;
uint64_t outValue = 50*COIN;
uint8_t pubscriptlength = ::pubscriptlength; //it isn't in the bitcoin-api tx block also
uint8_t pubkeyScript[::pubscriptlength];
uint32_t locktime = 0; // +85
} ;
and then
transaction.pubkeyScript[0] = 0x41;
hex2bin(transaction.pubkeyScript + 1, pubkey.c_str(), pubkey.length()/2); // pubkey to bytes , then append the OP_CHECKSIG byte
transaction.pubkeyScript[pubscriptlength - 1] = OP_CHECKSIG;
So reverse-engineer this.
https://github.com/alexeyneu/BlockZero/blob/master/BlockZero.cpp#L17-L29