Bitcoin 2 Bitcoin 3 1 Bitcoin Transaction 2
Bitcoin 2
Bitcoin 3
목차 1. Bitcoin Transaction 2. Bitcoin Script 4
Bitcoin Transaction 일반적으로 생각할 수 있는 잔액 조회, 송금(Account, Balance model) Alice 주소의 잔액 -50, Bob 주소의 잔액 +50 주소 잔액 Alice 1 bb 12 sf… 100 Bob 1 aasidjai… 0 주소 잔액 Alice 1 bb 12 sf… 50 Bob 1 aasidjai… 50 6
Bitcoin Transaction Bitcoin 방식(UTXO) 7
Bitcoin Transaction Bitcoin 방식(UTXO) Alice의 Unspent Transaction Output(100)을 소비하여 Bob의 UTXO(50)과 Alice의 UTXO(50)을 만든다. 8
Bitcoin Transaction Bitcoin 방식(UTXO) 잔액 조회 전체 Transaction에서 내 계좌 UTXO의 모든 잔액을 더한것! 잔액 Jun 80 Alice 20 9
Bitcoin Script Transaction을 만들때 오로지 jun만 소비할 수 있도록 UTXO를 만들어야함!!! Public key Private Key 11
Bitcoin Script 오로지 Jun만 풀 수 있는 Script를 작성! Locking된 UTXO를 풀 수 있는 Unlocking Script를 Transaction에 넣어 생성 12
Bitcoin Script는 Opcode와 Data로 구성 Locking. Script 4104240 ac 91558 e 66 c 0628693 cee 5 f 5120 d 43 caf 73 cad 8586 f 9 f 56 a 447 cc 6 b 926520 d 2 b 3 b 259874 e 5 d 79 dfb 4 b 9 aff 3405 a 10 cbce 47 ee 820 e 0824 dc 7004 d 5 bbcea 86 fac Opcode Description 0 x 41 The next opcode bytes is data to be pushed onto the stack 0 xac Pop the top from stack(Pubkey), Pop the top from stack(Signature) and Verify Signature 13
Bitcoin Script Bitcoin Opcode 14
Bitcoin Script 1. Pay To Pubkey 2. Pay To Pubkey Hash 3. Pay To Multisig 4. Pay To Script Hash 15
Bitcoin Script Pay to Pubkey Locking. Script = <Pubkey> <OP_Check. Sig> Unlocking. Script = <Signature> 16
Bitcoin Script Pay to Pubkey Script = <Unlocking. Script> <Locking. Script> = <Signature> <Pubkey> <OP_Check. Sig> 17
Bitcoin Script Pay to Pubkey 18
Bitcoin Script Pay to Pubkey 19
Bitcoin Script Pay to Pubkey 20
Bitcoin Script Pay to Pubkey 21
Bitcoin Script Why bitcoin use scripting system? • Deterministic • No need to handle complex codes(Only transfer) • Lightweight(No Infinity loop, No Cost of running complex codes) 22
- Slides: 23