Thanks for reply.
I followed the steps but I have some issues.
Paste the new parts here, public keys and private keys are the same.
My enviroment is regtest.
this is my UTXO
{
{
"txid": "3bd88800252c4d049ced8813b1d6fff76b99d84e56289dfd60eca8898814a8e2",
"vout": 0,
"address": "mzjCn3ojXBGWcRjWYfJdNdrM9yr5UbpXgq",
"label": "",
"scriptPubKey": "76a914d2bb7890f3f6356d89673367b44e9a7d0265009188ac",
"amount": 49.99900000,
"confirmations": 6,
"spendable": true,
"solvable": true,
"desc": "pkh([d2bb7890]03d6e5ff918b8388dc49cdfc115ddc1ea9fd4d884dd8b87ef6602a6bd07b5c1748)#67xu85z0",
"safe": true
},
there are my parameters for my transaction:
TXID=3bd88800252c4d049ced8813b1d6fff76b99d84e56289dfd60eca8898814a8e2
VOUT=0
AMOUNT=49.998
ADDR_MITT=msPjuNgbmbRSkNGJPvquKJRRmrbzS96s62
Now create my transaction data
$ bitcoin-cli createrawtransaction '[{"txid":"'$TXID'","vout":'$VOUT'}]' '[{"'$ADDR_MITT'":'$AMOUNT'}]'
0200000001e2a8148889a8ec60fd9d28564ed8996bf7ffd6b11388ed9c044d2c250088d83b0000000000ffffffff01c0e4022a010000001976a914824441111b374bec1952a5b3fa9dd4e3ed679b3888ac00000000
Now I put the scriptPubKey and SigHash.
0200000001e2a8148889a8ec60fd9d28564ed8996bf7ffd6b11388ed9c044d2c250088d83b000000001976a914d2bb7890f3f6356d89673367b44e9a7d0265009188acffffffff01c0e4022a010000001976a914824441111b374bec1952a5b3fa9dd4e3ed679b3888ac0000000001000000
(I tried even with ScriptPub of previous transaction. The UTXO of 3bd88800252c4d049ced8813b1d6fff76b99d84e56289dfd60eca8898814a8e2.)
Double SHA256
printf 0200000001e2a8148889a8ec60fd9d28564ed8996bf7ffd6b11388ed9c044d2c250088d83b000000001976a914d2bb7890f3f6356d89673367b44e9a7d0265009188acffffffff01c0e4022a010000001976a914824441111b374bec1952a5b3fa9dd4e3ed679b3888ac0000000001000000 | xxd -r -p | sha256sum -b | xxd -r -p | sha256sum -b > a.txt
result:
f1f941f66a7bd080f14506ff91a05bd3d525dae236a4d86bac5dfa6e3bce4563
Signature
openssl dgst -sha256 -hex -sign chiave_priv_3.pem a.txt
EC-SHA256(a.txt)= 30450220120a27e6e275545d4b1c79d4fad40a5d6dc9d44f512a00d5b2b71b68e5e4d376022100bf6284c39500565c089efec95db1d82869882a08b30513a3de0287ff223b834f
add 01 at the end.
30450220120a27e6e275545d4b1c79d4fad40a5d6dc9d44f512a00d5b2b71b68e5e4d376022100bf6284c39500565c089efec95db1d82869882a08b30513a3de0287ff223b834f01
48 is the signature Length.
Public key not compressed is
04d6e5ff918b8388dc49cdfc115ddc1ea9fd4d884dd8b87ef6602a6bd07b5c1748321ac6d22737633f56538a28158d2558ca09407d9f6cc221c54b873e4cb9b999
41 is the public key length.
Signature+public key is 278 char => 8B
The whole transaction is
0200000001e2a8148889a8ec60fd9d28564ed8996bf7ffd6b11388ed9c044d2c250088d83b000000008B4830450220120a27e6e275545d4b1c79d4fad40a5d6dc9d44f512a00d5b2b71b68e5e4d376022100bf6284c39500565c089efec95db1d82869882a08b30513a3de0287ff223b834f014104d6e5ff918b8388dc49cdfc115ddc1ea9fd4d884dd8b87ef6602a6bd07b5c1748321ac6d22737633f56538a28158d2558ca09407d9f6cc221c54b873e4cb9b999ffffffff01c0e4022a010000001976a914824441111b374bec1952a5b3fa9dd4e3ed679b3888ac00000000
$ bitcoin-cli sendrawtransaction 0200000001e2a8148889a8ec60fd9d28564ed8996bf7ffd6b11388ed9c044d2c250088d83b000000008B4830450220120a27e6e275545d4b1c79d4fad40a5d6dc9d44f512a00d5b2b71b68e5e4d376022100bf6284c39500565c089efec95db1d82869882a08b30513a3de0287ff223b834f014104d6e5ff918b8388dc49cdfc115ddc1ea9fd4d884dd8b87ef6602a6bd07b5c1748321ac6d22737633f56538a28158d2558ca09407d9f6cc221c54b873e4cb9b999ffffffff01c0e4022a010000001976a914824441111b374bec1952a5b3fa9dd4e3ed679b3888ac00000000
error code: -26
error message:
mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation) (code 16)
$ bitcoin-cli decoderawtransaction 0200000001e2a8148889a8ec60fd9d28564ed8996bf7ffd6b11388ed9c044d2c250088d83b000000008B4830450220120a27e6e275545d4b1c79d4fad40a5d6dc9d44f512a00d5b2b71b68e5e4d376022100bf6284c39500565c089efec95db1d82869882a08b30513a3de0287ff223b834f014104d6e5ff918b8388dc49cdfc115ddc1ea9fd4d884dd8b87ef6602a6bd07b5c1748321ac6d22737633f56538a28158d2558ca09407d9f6cc221c54b873e4cb9b999ffffffff01c0e4022a010000001976a914824441111b374bec1952a5b3fa9dd4e3ed679b3888ac00000000
{
"txid": "0101c9603426d1476d813617bc9af7c83eb62d1efec973c096ba55ad74c3501b",
"hash": "0101c9603426d1476d813617bc9af7c83eb62d1efec973c096ba55ad74c3501b",
"version": 2,
"size": 224,
"vsize": 224,
"weight": 896,
"locktime": 0,
"vin": [
{
"txid": "3bd88800252c4d049ced8813b1d6fff76b99d84e56289dfd60eca8898814a8e2",
"vout": 0,
"scriptSig": {
"asm": "30450220120a27e6e275545d4b1c79d4fad40a5d6dc9d44f512a00d5b2b71b68e5e4d376022100bf6284c39500565c089efec95db1d82869882a08b30513a3de0287ff223b834f[ALL] 04d6e5ff918b8388dc49cdfc115ddc1ea9fd4d884dd8b87ef6602a6bd07b5c1748321ac6d22737633f56538a28158d2558ca09407d9f6cc221c54b873e4cb9b999",
"hex": "4830450220120a27e6e275545d4b1c79d4fad40a5d6dc9d44f512a00d5b2b71b68e5e4d376022100bf6284c39500565c089efec95db1d82869882a08b30513a3de0287ff223b834f014104d6e5ff918b8388dc49cdfc115ddc1ea9fd4d884dd8b87ef6602a6bd07b5c1748321ac6d22737633f56538a28158d2558ca09407d9f6cc221c54b873e4cb9b999"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 49.99800000,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 824441111b374bec1952a5b3fa9dd4e3ed679b38 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914824441111b374bec1952a5b3fa9dd4e3ed679b3888ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"msPjuNgbmbRSkNGJPvquKJRRmrbzS96s62"
]
}
}
]
}