primecoin-generate block from getblocktemplate
this is a part of mining app. study record.
处理步骤
- create coinbase tx,Coinbasevalue, Height, pay2address(这里使用 public key 例如下面的: 030990d68d8b7eb4da4092c168b95d73207d91066747867844c8e21718b1d649d4)
如果是 p2pk 则 scriptsig 是<Public Key> OP_CHECKSIG
如果是 p2pkh 则 scriptsig 是OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG - create merkle root
- create block header
use pay to public key:
ScriptPubKey=<Public Key> OP_CHECKSIG |
This transaction is a very simple use of the OP_CHECKSIG operator and validates the signature as being generated by the required private key and therefore having permission to unlock the specific transaction.
pay to public key hash:
<ScriptPubKey=OP_DUP OP_HASH160<Public KeyHash> OP_EQUALVERIFY OP_CHECKSIG |
Pay-to-Script-Hash
scriptPubKey: OP_HASH160 <scriptHash> OP_EQUAL |
m-of-n multi-signature transaction:
scriptSig: 0 <sig1> ... <script> |
coinbase tx json example
01000000 version |
getblocktemplate
tyler@ubuntu16:~/Documents/primecoin-core-desktop-src$ ./src/primecoin-cli -rpcuser=user -rpcpassword=password getblocktemplate ‘{“capabilities”:[“coinbasetxn”, “coinbasevalue”,”coinbase/append”]}’
{ |