Trust Wallet์˜ wallet-core


๐Ÿงฉ 1. HD ์ง€๊ฐ‘ ์ƒ์„ฑ ๋ฐ ๋ณต๊ตฌ

  • src/HDWallet.cpp / include/TrustWalletCore/TWHDWallet.h
    • BIP39 ์‹œ๋“œ ์ƒ์„ฑ, ๋ณต๊ตฌ ๋ฐ BIP44/BIP84 ๋“ฑ ํ‘œ์ค€์— ๋”ฐ๋ฅธ ํ‚ค/์ฃผ์†Œ ์œ ๋„ ๋‹ด๋‹น (github.com, trustwallet.github.io).

๐Ÿง  2. ์ฃผ์†Œ ์œ ๋„

  • src/Derivation.cpp / include/TrustWalletCore/TWDerivationPath.h
    • ์ปค์Šคํ…€ ๊ฒฝ๋กœ(m/44'/60'/โ€ฆ) ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, HDWallet.getKey(...), CoinType.deriveAddress(...) ๋ฉ”์†Œ๋“œ ๊ตฌํ˜„ (trustwallet.github.io, developer.trustwallet.com).

โœ๏ธ 3. ํŠธ๋žœ์žญ์…˜ ์„œ๋ช…

โ€ข UTXO ๊ธฐ๋ฐ˜ (๋น„ํŠธ์ฝ”์ธ ๋“ฑ)

  • src/Bitcoin/Signer.cpp / include/TrustWalletCore/TWBitcoinSigningInput.h
    • BitcoinSigningInput ๊ฐ์ฒด๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ TX ์ƒ์„ฑ ๋ฐ ์„œ๋ช… ์ฒ˜๋ฆฌ (developer.trustwallet.com).

โ€ข ๊ณ„์ • ๊ธฐ๋ฐ˜ (์ด๋”๋ฆฌ์›€ ๋“ฑ)

  • src/Ethereum/Signer.cpp / include/TrustWalletCore/TWEthereumSigningInput.h
    • Transaction.Transfer, chainID, gasPrice, gasLimit ๋“ฑ ํฌํ•จํ•˜์—ฌ Ethereum ํŠธ๋žœ์žญ์…˜์„ ์ž…๋ ฅ๋ฐ›์•„ RLP ์ธ์ฝ”๋”ฉ ์„œ๋ช… ์ฒ˜๋ฆฌ (developer.trustwallet.com).

๐Ÿ”€ 4. AnySigner (๋ฒ”์šฉ ์„œ๋ช… API)

  • src/AnySigner.cpp
    • ๋‹ค์–‘ํ•œ ์ฝ”์ธ ํƒ€์ž…์— ๋Œ€ํ•ด ๊ณตํ†ต ์ธํ„ฐํŽ˜์ด์Šค๋กœ ์„œ๋ช… ๊ฐ€๋Šฅ. ์ฃผ๋กœ ๋ธŒ๋ผ์šฐ์ €๋‚˜ WASM ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉ (developer.trustwallet.com).

๐Ÿงฉ 5. Protobuf & C ์ธํ„ฐํŽ˜์ด์Šค

  • src/proto/*.proto & include/TrustWalletCore ํด๋”
    • ํŠธ๋žœ์žญ์…˜ ๊ด€๋ จ ๋ชจ๋ธ์€ Protobuf๋กœ ์ •์˜๋˜๋ฉฐ, TW_* ์ ‘๋‘์‚ฌ์˜ C ํ—ค๋”๋กœ ๋…ธ์ถœ๋˜์–ด ์–ธ์–ด๊ฐ„ ๋ฐ”์ธ๋”ฉ์„ ์ œ๊ณต (developer.trustwallet.com).

๐Ÿ” 6. ์•”ํ˜ธํ™”/ํ‚ค ๊ด€๋ฆฌ ์œ ํ‹ธ๋ฆฌํ‹ฐ

  • src/Crypto.cpp, Trezor-crypto ์„œ๋ธŒํด๋”, include/PublicKey.h / PrivateKey.h
    • ํ‚ค ์ƒ์„ฑ, ์„œ๋ช… ์ฒ˜๋ฆฌ, AES/PBKDF2 ๋“ฑ ์ €์ˆ˜์ค€ ์•”ํ˜ธ ๊ธฐ๋Šฅ์„ ์ œ๊ณต .

๐Ÿงช 7. ํ…Œ์ŠคํŠธ & ์ƒ˜ํ”Œ

  • tests/, swift/Tests/, samples/android/โ€ฆTestBitcoinSigning.kt
    • ๊ฐ ๊ธฐ๋Šฅ์˜ ์‹ค์ œ ์ž‘๋™์„ ๊ฒ€์ฆํ•˜๊ธฐ ์œ„ํ•œ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์˜ˆ์‹œ ์ œ๊ณต (developer.trustwallet.com).

๐Ÿงญ ์š”์•ฝ: ํ•ต์‹ฌ ํŒŒ์ผ ์ •๋ฆฌ

๊ธฐ๋Šฅ ์˜์—ญ์ฃผ์š” ํŒŒ์ผ ์œ„์น˜
HDWallet (seed/key)src/HDWallet.cpp, include/TWHDWallet.h
Derivationsrc/Derivation.cpp, include/TWDerivationPath.h
Bitcoin Signersrc/Bitcoin/Signer.cpp, TWBitcoinSigningInput.h
Ethereum Signersrc/Ethereum/Signer.cpp, TWEthereumSigningInput.h
AnySignersrc/AnySigner.cpp
Protobuf & C APIsrc/proto/*.proto, include/TW*.h
Crypto utilssrc/Crypto.cpp, trezor-crypto/**/*
Tests & ์ƒ˜ํ”Œtests/, swift/Tests/, samples/

์ฝ”๋ฉ˜ํŠธ

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•„๋“œ๋Š” *๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค