MultiversX Tracker is Live!

Creating a raw transaction from scratch/

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 156 Views

A common scriptPubKey format, known as Pay-to-Public-Key-Hash (P2PKH), has the following form:

OP_DUP OP_HASH160 <push of 20-byte public key hash> OP_EQUALVERIFY OP_CHECKSIG

The hash of the public key is formed by ripemd-160(sha-256(compressed public key)).

You can find the hex encoding of the opcodes here: https://en.bitcoin.it/wiki/Script

The amount should be encoded as 8 bytes, in little-endian format. If you want to send 1 million satoshis, this would be 0x40420F0000000000.

By the way, you are missing "Input Count: 01" and sequence number in your example transaction.


The scriptPubKey in the article you linked is:

76a914f76bc4190f3d8e2315e5c11c59cfc8be9df747e388ac

Decoded, this is:

OP_DUP OP_HASH160 [push 20 bytes 76bc4190f3d8e2315e5c11c59cfc8be9df747e3] OP_EQUALVERIFY OP_CHECKSIG

This is exactly the same as above - a P2PKH output spending to the public key whose hash is 76bc4190f3d8e2315e5c11c59cfc8be9df74.

The article you linked is incorrect, when it says:

Locking Script β€” This is the hash of the locking script that specifies the conditions that must be met in order to spend this output.

It is referring to a P2SH output, but the output in the example is a P2PKH output.


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments