Post
Topic
Board Bahasa Indonesia (Indonesian)
Merits 9 from 4 users
Re: Pengiriman uang dengan bitcoin. Lebih murah ataukah lebih mahal?[Update Q1-2019]
by
abhiseshakana
on 23/04/2019, 04:49:20 UTC
⭐ Merited by dbshck (5) ,pandukelana2712 (2) ,Husna QA (1) ,Farul (1)
Besarnya ukuran transaksi sampai saat ini adalah:
(3 input x 148 byte) + ( 1 x 34 byte) + 10 byte = 488 byte.

Mungkin masih banyak yg bingung bagaimana mengestimasi ukuran transaksi pada P2PKH (Pay-to-PubkeyHash), untuk menentukan besaran fee yang akan digunakan pada transaksi tersebut (diluar transaksi yg dilakukan oleh exchange). Seperti yang telah dijelaskan oleh Om pandu diatas, transaksi P2PKH (compressed pubkey) mempunyai besar input 148 bytes dan output 34 bytes. Dan jika menggunakan uncompressed pubkey maka besar input akan ditambah sebesar 32 bytes.

Sebenarnya ukuran tersebut bukanlah fix size (tapi rata-rata ukurannya sekitar nilai/size tersebut) dan yang mempengaruhi besar dari input dan output pada sebuah transaksi ialah :

Input
  • Previous Transaction hash (32 Bytes)
  • Previous Txout-index (4 Bytes)
  • Txin-script length (1-9 Bytes)
  • Txin-script / scriptSig (Banyak Bytes)
  • sequence_no (4 Bytes)

Output
  • value (8 Bytes)
  • Txout-script length (1-9 Bytes)
  • Txout-script / scriptPubKey (Banyak Bytes)

Source : https://en.bitcoin.it/wiki/Transaction#Generation


Contoh (Breakdown) >> transaksi P2PKH (compressed pubkey) :
https://www.blockchain.com/btc/tx/797ecda5e21a4fc2a77c541eb8161e9d2093aaabee8b05d9e8eab8940c8d439d?show_adv=true
1 Input + 1 Output + 10 Bytes = 191 Bytes

Dari transaksi tersebut didapatkan Raw Transaction (Hex) sbb :
01000000014d446bc2dc6d23006790e210e00e86014ae825cc1fd3751076184502b746e9ca010000006a473044022043922325a72cfbe195bd9f0d298d6f5339b99a4ea5109ed664af198beebc88c602204 f9f9c4574b65ebb09d08bb4702489d7a6c4bb02cd28f7eac30c9047b8544842012103ddaaea47d9 3581a0ba68c3c92e6cbb509c37e5e52ea5c09ac09876c459a28059ffffffff0110b85000000000001976a914220063b546265fbc382f6ffb66a958ef23222d9988ac00000000

Detail dari transaksi tersebut sbb :
Version         
01 00 00 00


Number input      
01

Previous Transaction hash (Reverse)          
cae9 46b7 0245 1876 1075 d31f cc25 e84a 0186 0ee0 10e2 9067 0023 6ddc c26b 444d (32 Bytes)


Previous Txout-index (Reverse)   
00 00 00 01 (4 bytes)


Txin-script length      
6a (1 Byte)


Txin-script / scriptSig   
4730 4402 2043 9223 25a7 2cfb e195 bd9f 0d29 8d6f 5339 b99a 4ea5 109e d664 af19 8bee bc88 c602 204f 9f9c 4574 b65e bb09 d08b b470 2489 d7a6 c4bb 02cd 28f7 eac3 0c90 47b8 5448 4201 2103 ddaa ea47 d935 81a0 ba68 c3c9 2e6c bb50 9c37 e5e5 2ea5 c09a c098 76c4 59a2 8059 (106 Bytes)


sequence_no   
ff ff ff ff (4 bytes)


Number of outputs
01

Value
10 b8 50 00 00 00 00 00 (8 bytes)


Txout-script length
19 (1 Byte)


ScriptPubKey
76 a914 2200 63b5 4626 5fbc 382f 6ffb 66a9 58ef 2322 2d99 88ac (25 bytes)


Locktime
00 00 00 00

Dari data diatas maka didapatkan nilai Input dan Output sebagai berikut :
Input = 32 Bytes + 4 Bytes + 1 Byte + 106 Bytes + 4 Bytes = 147 Bytes
Output = 8 Bytes + 1 Byte + 25 Bytes = 34 Bytes

Jika dimasukkan ke formula yg dijelaskan oleh Om pandu, maka akan didapatkan ukuran transaksi sbb :
P2PKH (compressed pubkey) size = Input + Output + 10 Bytes (framework)
P2PKH (compressed pubkey) size = 147 Bytes + 34 Bytes + 10 Bytes = 191 Bytes

Dan untuk menghitung fee transaksi
Fee TX = ((n * Input) + (n * Output) + 10 Bytes) * Fee/byte