๋ธ”๋ก์ฒด์ธ/๋ธ”๋ก์ฒด์ธ ๊ฐœ๋ฐœ

[์ด๋”๋ฆฌ์›€ ๋ธ”๋ก์ฒด์ธ ๊ฐœ๋ฐœ] ์ด๋”๋ฆฌ์›€ ํŠธ๋žœ์žญ์…˜, ํŠธ๋žœ์žญ์…˜ ์„œ๋ช…

HHRR 2022. 7. 18. 16:08

๊ฐ•์˜ ์˜์ƒ - Solidity๋ฅผ ์‚ฌ์šฉํ•œ ์ด๋”๋ฆฌ์›€ ๋ธ”๋ก์ฒด์ธ ๊ฐœ๋ฐœ์ž ๋ถ€ํŠธ์บ ํ”„ (2022)

: https://www.udemy.com/course/solidity-ethereum-bootcamp/learn/lecture/31207252#questions

๊ฐ•์˜ ์ž๋ฃŒ : https://ethereum-blockchain-developer.com/002-first-transaction/02-transfer-ether/

web3js :  https://web3js.readthedocs.io/en/v1.2.11/web3-eth.html#sendtransaction

 

web3.eth — web3.js 1.0.0 documentation

The web3-eth package allows you to interact with an Ethereum blockchain and Ethereum smart contracts. Note on checksum addresses All Ethereum addresses returned by functions of this package are returned as checksum addresses. This means some letters are up

web3js.readthedocs.io

 

Transfer Ether - Become Ethereum Blockchain Developer

Transfer Ether from Account 1 to Account 2 You have two accounts now in MetaMask. You can switch between them. If you followed the previous tutorial, then you already have test-ether in your Account 1. Time to send some Ether from Account 1 to Account 2! S

ethereum-blockchain-developer.com

[ ์ด๋”๋ฆฌ์›€ ํŠธ๋žœ์žญ์…˜ ]

from : [account]

to : [account] (optional)

value : [integer] in wei

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

๋ธ”๋ก ํƒ์ƒ‰๊ธฐ

From

To

Value

 

 

 

 

 

 

 

[ ํŠธ๋žœ์žญ์…˜ ์„œ๋ช… ]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

=> v,r,s : ์„œ๋ช…

r,sํ•„๋“œ : ECREVOVER ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ์ž‘๋™ -> ๊ณต๊ฐœํ‚ค์™€ ์ด๋”๋ฆฌ์›€ ๊ณ„์ • ์ถœ๋ ฅ

 

 

ํŠธ๋žœ์žญ์…˜    →→→→→→→→→→→→→→→→
    โ†—
  โ†—
(ํŠธ๋žœ์žญ์…˜+๋น„๋ฐ€ํ‚ค) -> ์„œ๋ช… ํŠธ๋žœ์žญ์…˜(v,r,s)

                               ↓ ECREVOVER (r,s)
๋ฉ”ํƒ€๋งˆ์Šคํฌ ์•ˆ์˜
๋น„๋ฐ€ํ‚ค
(32bytes,64hex char)
-> ECDSA
ํƒ€์›๊ณก์„  ๋””์ง€ํ„ธ์„œ๋ช… ์•Œ๊ณ ๋ฆฌ์ฆ˜
(๊ฐœ์ธํ‚ค ์ „์†ก)
-> ๊ณต๊ฐœํ‚ค
(64bytes)
์ œ๊ณต
-> ์ด๋”๋ฆฌ์›€ ๊ณ„์ • ๋งŒ๋“ฆ
์ด๋”๋ฆฌ์›€ ๊ณ„์ • : Keccak Hash of the last 20 bytes of the public key
                          B_96...255(kec(pub_k))
(ํŠธ๋žœ์žญ์…˜์˜ from)

- ์„œ๋ช…์„ ํ†ตํ•ด ํ•ด๋‹น ์ด๋”๋ฆฌ์›€ ํŠธ๋žœ์žญ์…˜์˜ ์ง„์ •์„ฑ์ด ๋ณด์žฅ๋จ

 ์„œ๋ช…์€ ๊ฐœ์ธํ‚ค์—์„œ ์ƒ์„ฑ๋จ

 ๊ณต๊ฐœํ‚ค์™€ ์ฃผ์†Œ๋Š” ๊ฐœ์ธํ‚ค์—์„œ ์ƒ์„ฑ๋จ

 ์„œ๋ช…์œผ๋กœ ๊ณต๊ฐœํ‚ค ๋งŒ๋“ค ์ˆ˜ ์žˆ์Œ 

 ๊ณต๊ฐœํ‚ค์™€ ๊ณ„์ •์€ ๋‹ค์‹œ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ณ  ํŠธ๋žœ์žญ์…˜์˜ from์—์„œ ์‚ฌ์šฉ๋œ ๊ณ„์ •์ด ํŠธ๋žœ์žญ์…˜์„ ์„œ๋ช…ํ•˜๊ณ 

 ํŠธ๋žœ์žญ์…˜ ์„œ๋ช…์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋œ ๊ฐœ์ธํ‚ค์™€ ๊ฐ™๋‹ค๋Š” ์‚ฌ์‹ค์„ ๋ณด์žฅ

=> ๋ธ”๋ก์ฒด์ธ๊ณผ ๋ชจ๋“  ์ฐธ์—ฌ ๋…ธ๋“œ๊ฐ€ ์•„์ฃผ ์‰ฝ๊ฒŒ ํŠธ๋žœ์žญ์…˜์ด ์˜ณ๋‹ค๊ณ  ์ž…์ฆ ํ•  ์ˆ˜ ์žˆ๋Š” ์ด์œ