Skip to content

Latest commit

ย 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

์˜คํ”ˆ ๋ฏธ์…˜: ํ”„๋ฆฌ์ฝ”์Šค ์ฑŒ๋ฆฐ์ง€


์„ ์ • ์ฃผ์ œ : ๋ธ”๋ก์ฒด์ธ ํ•™์Šต ๋ฐ ๊ตฌํ˜„

์„ ์ • ์ด์œ 

๊ธฐ์กด์— ์•”ํ˜ธ ํ™”ํ์— ๋Œ€ํ•œ ๊ด€์‹ฌ์œผ๋กœ ์ธํ•ด ๋ธ”๋ก ์ฒด์ธ์— ๋Œ€ํ•ด ํ•™์Šตํ•ด์•ผ๊ฒ ๋‹ค๊ณ  ์ƒ๊ฐํ•ด์™”๋Š”๋ฐ, ๋งˆ์นจ ์ฃผ์ œ๋ฅผ ์ž์œ ๋กญ๊ฒŒ ์„ ์ •ํ•˜๊ณ  ๋„์ „ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐํšŒ๊ฐ€ ์ƒ๊ฒจ ํ•ด๋‹น ์ฃผ์ œ๋ฅผ ์„ ์ •ํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋ฏธ์…˜ ๋ชฉํ‘œ

๋ธ”๋ก ์ฒด์ธ์— ๋Œ€ํ•œ ์ดํ•ด, ๊ตฌํ˜„, ํ™•์žฅ ๋ฐ ์ž๋ฐ” ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋Šฅ๋ ฅ ํ–ฅ์ƒ

์ˆ˜ํ–‰ ๋ฐฉ์‹

ํฌ๊ด„์ ์ธ ํ๋ฆ„์œผ๋กœ ํ•™์Šต โ†’ ๊ตฌํ˜„ โ†’ ํ™•์žฅ์˜ ํ˜•ํƒœ๋กœ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ํ”„๋ฆฌ์ฝ”์Šค ๊ณผ์ •์˜ ํ”ผ๋“œ๋ฐฑ์„ ๋ฐ”ํƒ•์œผ๋กœ ์ž๋ฐ”๋ฅผ ํ†ตํ•ด ๊ตฌํ˜„ ๋ฐ ํ™•์žฅ ํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

๋ธ”๋ก์ฒด์ธ์— ๋Œ€ํ•œ ์ดํ•ด๋„๊ฐ€ ์—†๋Š” ์ƒํƒœ์—์„œ ์„ธ๋ถ€์ ์ธ ๊ณ„ํš์„ ์žก๋Š” ๊ฑด ํž˜๋“ค๋‹ค๊ณ  ํŒ๋‹จํ•˜์—ฌ, ํ•˜๋‚˜์˜ ๋ชฉํ‘œ๋ฅผ ์„ค์ •ํ•˜๊ณ  ๋ชฉํ‘œ ๋‹ฌ์„ฑ ์‹œ ๋‹ค์Œ ๋ชฉํ‘œ๋ฅผ ์„ธ์šฐ๊ณ  ๋‹ค์‹œ ์ง„ํ–‰ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ˆ˜ํ–‰ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.


์ˆ˜ํ–‰ ๊ณผ์ •

ํ•™์Šต

  1. ๋ธ”๋ก์ฒด์ธ ๊ฐœ์š”
  2. ํŠธ๋žœ์žญ์…˜
  3. SHA256

์ž๋ฃŒ ์ถœ์ฒ˜1 : bitcoin Devloper Guides

์ž๋ฃŒ ์ถœ์ฒ˜2: https://kwjdnjs.tistory.com

์„ค๊ณ„ ๋ฐ ๊ตฌํ˜„

ํ•™์Šต ์ดํ›„ ๋ธ”๋ก์ฒด์ธ์— ๋Œ€ํ•œ ์ดํ•ด์™€, ์ด๋”๋ฆฌ์›€์˜ ์Šค๋งˆํŠธ ์ปจํŠธ๋ž™ํŠธ์™€ ๊ฐ™์€ ๋‚ด์šฉ์—์„œ ์ธ์‚ฌ์ดํŠธ๋ฅผ ์–ป์–ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ฃผ์ œ๋ฅผ ์„ ์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.


๋ธ”๋ก์ฒด์ธ ์•”ํ˜ธํ™” ๊ฑฐ๋ž˜ ์‹œ์Šคํ…œ

๊ฐœ์š”

๋ธ”๋ก์ฒด์ธ ๋„คํŠธ์›Œํฌ ์ƒ์—์„œย 1:1 ํ˜น์€ n:n ๊ด€๊ณ„์—์„œ ๊ณ„์•ฝ์ด ์ด๋ฃจ์–ด์ง„๋‹ค๊ณ  ๊ฐ€์ •ํ–ˆ์„ ๋•Œ:

  • ๊ณ„์•ฝ ๋‚ด์šฉ๊ณผ ๊ณ„์•ฝ ์ดํ–‰ ์‹œ ๋ฐ›์„ ๊ธˆ์•ก์€ย ๋‚ด๋ถ€์ž๋“ค๋ผ๋ฆฌ๋งŒ ์•Œ ์ˆ˜ ์žˆ์Œ
  • ๊ณ„์•ฝ ์ดํ–‰ ์—ฌ๋ถ€๋Š”ย ๋‚ด๋ถ€์ž๋“ค์˜ ํˆฌํ‘œ๋กœ ๊ฒฐ์ •
  • ํˆฌํ‘œ๋กœ ์Šน์ธ๋œ ๊ฒฝ์šฐ ๊ณ„์•ฝ ๊ธˆ์•ก์— ํ•ด๋‹นํ•˜๋Š” ํŠธ๋žœ์žญ์…˜ ์‹คํ–‰

ํŠธ๋žœ์žญ์…˜ ๊ตฌ์กฐ

๊ณต๊ฐœ ์ •๋ณด

  • txid: ํŠธ๋žœ์žญ์…˜ ID
  • timestamp: ์ƒ์„ฑ ์‹œ๊ฐ
  • ์†ก๊ธˆ ๊ธˆ์•ก

๋น„๊ณต๊ฐœ ์ •๋ณด (์•”ํ˜ธํ™”)

  • ๊ณ„์•ฝ ๋‚ด์šฉ
  • ์†ก์‹ ์ž/์ˆ˜์‹ ์ž
    • ํŠธ๋žœ์žญ์…˜ ๋งˆ๋‹ค ์ƒˆ๋กœ์šด ๊ฐœ์ธํ‚ค๋ฅผ ํ†ตํ•ด ์ง€๊ฐ‘ ์ฃผ์†Œ๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ํ•ด๋‹น output์— ํ•ด๋‹นํ•˜๋Š” ๋‚ด๋ถ€์ž์—๊ฒŒ ํŠธ๋žœ์žญ์…˜ ๋ฒˆํ˜ธ์™€, ๊ฐœ์ธํ‚ค๋ฅผ ์ „๋‹ฌํ•˜๋Š” ๋ฐฉ์‹
    • ๊ฑฐ๋ž˜๋ฅผ ์—ฌ๋Ÿฌ ๋ฒˆ ์ง„ํ–‰ํ•ด๋„, ๊ฐ๊ฐ ๋‹ค๋ฅธ ์ง€๊ฐ‘ ์ฃผ์†Œ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ธฐ์กด ๋น„ํŠธ ์ฝ”์ธ ๊ตฌ์กฐ๋ณด๋‹ค ๊ฑฐ๋ž˜์ž ํŠน์ •์ด ์–ด๋ ต์Šต๋‹ˆ๋‹ค.
  • ๋‚ด๋ถ€์ž ๋ช…๋‹จ

๋™์ž‘ ๋ฐฉ์‹

  1. ํˆฌํ‘œ๋ฅผ ํ†ตํ•ด ํŠธ๋žœ์žญ์…˜ ์‹คํ–‰ ๊ฒฐ์ •
  2. ์Šน์ธ ์‹œ ๋‚ด๋ถ€์ž๋“ค์—๊ฒŒย Private Key ์ œ๊ณต
  3. Private Key๋กœ ๋น„๊ณต๊ฐœ ์ •๋ณด ๋ณตํ˜ธํ™”
  4. ์™ธ๋ถ€ ๋…ธ๋“œ๋Š” ์กฐํšŒ ๋ถˆ๊ฐ€๋Šฅ
  5. ์ „์ฒด ๋„คํŠธ์›Œํฌ์˜ Mempool์— ํŠธ๋žœ์žญ์…˜ ์ถ”๊ฐ€
  6. ๊ธฐ์กด ๋ธ”๋ก์ฒด์ธ(๋น„ํŠธ์ฝ”์ธ) ๋ฐฉ์‹์œผ๋กœ ๋ธ”๋ก ์ƒ์„ฑ ๋ฐ ์ถ”๊ฐ€

์œ„์™€ ๊ฐ™์ด ๊ณต๊ฐœ์™€ ๋น„๊ณต๊ฐœ ์ •๋ณด๋ฅผ ๋‚˜๋ˆ„์–ด, ๋น„๊ณต๊ฐœ ์ •๋ณด์˜ ๊ฒฝ์šฐ ํˆฌํ‘œ๋ฅผ ํ†ตํ•ด ํŠธ๋žœ์žญ์…˜์ด ์‹คํ–‰๋  ๋•Œ ๋‚ด๋ถ€์ž๋“ค์—๊ฒŒ private key๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๋‚˜์ค‘์— ๋น„๊ณต๊ฐœ ๋‚ด์šฉ์„ ์•Œ ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๊ณ  ์™ธ๋ถ€ ๋…ธ๋“œ๋“ค์€ ์กฐํšŒ ๋ถˆ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•œ๋‹ค.

์ „์ฒด ๋„คํŠธ์›Œํฌ์˜ mempool์— ํ•ด๋‹น ํŠธ๋žœ์žญ์…˜์„ ์ถ”๊ฐ€ํ•˜๊ณ , ๊ธฐ์กด ๋ธ”๋ก์ฒด์ธ ๋„คํŠธ์›Œํฌ(๋น„ํŠธ์ฝ”์ธ)๊ฐ€ ๋™์ž‘ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๋ธ”๋ก์„ ์ƒ์„ฑํ•˜๊ณ , ๋ธ”๋ก์„ ์ถ”๊ฐ€ํ•œ๋‹ค.

๋ธ”๋ก์ฒด์ธ ๋„คํŠธ์›Œํฌ ์ƒ์—์„œย 1:1 ํ˜น์€ n:n ๊ด€๊ณ„์—์„œ ๊ณ„์•ฝ์ด ์ด๋ฃจ์–ด์ง„๋‹ค๊ณ  ๊ฐ€์ •ํ–ˆ์„ ๋•Œ:

  • ๊ณ„์•ฝ ๋‚ด์šฉ๊ณผ ๊ณ„์•ฝ ์ดํ–‰ ์‹œ ๋ฐ›์„ ๊ธˆ์•ก์€ย ๋‚ด๋ถ€์ž๋“ค๋ผ๋ฆฌ๋งŒ ์•Œ ์ˆ˜ ์žˆ์Œ
  • ๊ณ„์•ฝ ์ดํ–‰ ์—ฌ๋ถ€๋Š”ย ๋‚ด๋ถ€์ž๋“ค์˜ ํˆฌํ‘œ๋กœ ๊ฒฐ์ •
  • ํˆฌํ‘œ๋กœ ์Šน์ธ๋œ ๊ฒฝ์šฐ ๊ณ„์•ฝ ๊ธˆ์•ก์— ํ•ด๋‹นํ•˜๋Š” ํŠธ๋žœ์žญ์…˜ ์‹คํ–‰

ํด๋ž˜์Šค ๋‹ค์ด์–ด๊ทธ๋žจ

classDiagram
direction BT
class AdminSetup {
  - String ADMIN_SEED
  - String ADMIN_STORAGE_PATH
}
class BalanceCommand
class Block {
  - long timestamp
  - byte[] version
  - int txNum
  - byte[] blockHash
  - byte[] prevHash
  - int size
  - byte[] nonce
  - byte[] merkleRoot
  - List~Transaction~ transactions
}
class BlockCommand
class BlockHeader {
  ~ byte[] merkleRoot
  ~ byte[] bit
  ~ byte[] prevHash
  ~ byte[] nounce
}
class Blockchain {
  - long GENESIS_REWARD
  - List~Block~ chain
}
class BlockchainStorage {
  - String META_CHAIN_HEIGHT
  - RocksDB txDB
  - RocksDB utxoDB
  - RocksDB blocksDB
  - String dbPath
  - RocksDB metaDB
  - String META_PRIVATE_KEY
  - String META_BEST_BLOCK_HASH
  - ObjectMapper objectMapper
}
class BytesUtil
class CLI {
  - CommandContext context
  - Scanner scanner
  - Map~String, Command~ commands
}
class CLIIntegrationTest {
  - CommandContext context1
  - Node node2
  - CommandContext context2
  - String STORAGE_PATH_1
  - String STORAGE_PATH_2
  - Node node3
  - PrintStream originalOut
  - CommandContext context3
  - Node node1
  - ByteArrayOutputStream outContent
  - String STORAGE_PATH_3
}
class Command {
<<Interface>>

}
class CommandContext {
  - Node node
  - Mempool mempool
  - boolean running
}
class ConnectCommand
class ContractTransaction
class EncryptedContract {
  - byte[] encryptedContent
  - Map~String, byte[]~ encryptedKeys
}
class EncryptionUtil {
  - String AES_ALGORITHM
  - int AES_KEY_SIZE
  - int GCM_NONCE_LENGTH
  - int GCM_TAG_LENGTH
}
class ExitCommand
class GenesisBlock {
  - String GENESIS_MINER
  - long GENESIS_REWARD
  - byte[] GENESIS_PREV_HASH
  - String GENESIS_MESSAGE
  - Block cachedGenesisBlock
  - byte[] GENESIS_VERSION
  - long GENESIS_TIMESTAMP
}
class Hash
class HelpCommand {
  - Map~String, Command~ commands
}
class JsonMessage {
  - MessageType type
  - long timestamp
  - ObjectMapper mapper
  - String senderId
  - String payloadJson
  - long serialVersionUID
}
class KeyGenerator {
  - BigInteger N
}
class ListCommand
class Main
class MainTest
class Mempool {
  - TransactionValidator validator
  - Map~String, Transaction~ transactions
  - long MIN_FEE_RATE
  - int MAX_POOL_SIZE
}
class MempoolCommand
class MerkleTree
class Message {
  - MessageType type
  - long serialVersionUID
  - Object payload
  - String senderId
  - long timestamp
}
class MineCommand
class Miner {
  - Node node
  - int currentDifficulty
  - byte[] BLOCK_VERSION
  - long BLOCK_REWARD
  - Mempool mempool
}
class Node {
  - int p2pPort
  - List~Block~ blockList
  - byte[] privateKey
  - BlockchainStorage storage
  - UTXOSet utxoSet
  - TransactionValidator validator
  - P2PNetwork p2pNetwork
}
class Operation {
  - byte[] messageHash
  ~ Stack~byte[]~ stack
  - byte[] sigScriptValue
}
class P2PNetwork {
  - P2PServer server
  - List~Peer~ peers
  - Node node
  - ConcurrentHashMap~String, Peer~ peerMap
  - String nodeId
}
class P2PServer {
  - ServerSocket serverSocket
  - boolean running
  - int port
  - P2PNetwork network
  - ExecutorService executorService
}
class Peer {
  - Socket socket
  - ObjectInputStream in
  - String address
  - int port
  - ObjectOutputStream out
  - boolean connected
}
class PeersCommand
class ProofOfWork {
  - int MAX_NONCE
  - int DIFFICULTY_ADJUSTMENT_INTERVAL
  - long TARGET_BLOCK_TIME
}
class Random
class Script
class SendCommand
class Signature
class Spender {
  - byte[] txid
  - int inputIndex
  - long serialVersionUID
}
class StartCommand
class StatusCommand
class SyncCommand
class TXBlockInfo {
  - long serialVersionUID
  - int height
  - byte[] blockHash
}
class Transaction {
  - byte[] txid
  - boolean deleted
  - DateTimeFormatter TIME_FORMATTER
  - long fee
  - String time
  - List~TransactionInput~ inputs
  - List~String~ voteList
  - List~TransactionOutput~ outputs
  - String contract
  - int size
  - TXBlockInfo block
}
class TransactionInput {
  ~ int outputIdx
  ~ List~byte[]~ sigScript
  ~ byte[] pkScript
  ~ byte[] prevTXID
  ~ long value
  - Boolean isCoinbase
  ~ String address
}
class TransactionOutput {
  - Spender spender
  - byte[] address
  - boolean spent
  - long value
  - byte[] pkscript
}
class TransactionValidator {
  - UTXOSet utxoSet
}
class UTXO {
  - TransactionOutput output
  - long blockHeight
  - byte[] txid
  - int outputIndex
}
class UTXOSet {
  - Map~String, UTXO~ utxos
}
class ValidationResult {
  - String message
  - boolean valid
}
class Vote {
  - String voterAddress
  - long timestamp
  - VoteType voteType
  - byte[] signature
}
class VoteResult {
  - long finalizedAt
  - int totalParticipants
  - boolean approved
  - int rejections
  - int abstentions
  - int approvals
}
class VoteStatus {
  - int voteCount
  - boolean finalized
  - int totalParticipants
  - int approvals
  - int rejections
  - long votingDeadline
  - int abstentions
}
class VotingContract {
  - Map~String, Vote~ votes
  - long votingDeadline
  - boolean finalized
  - EncryptedContract encryptedContract
  - List~String~ participants
  - VoteResult finalResult
  - int requiredApprovals
}
class Wallet {
  - Node node
}
class WalletManager {
  - Node node
  - Map~String, byte[]~ wallets
}
class build
class settings

BalanceCommand  ..>  Command 
Block "1" *--> "transactions *" Transaction 
BlockCommand  ..>  Command 
Blockchain "1" *--> "chain *" Block 
CLI  ..>  BalanceCommand : ยซcreateยป
CLI  ..>  BlockCommand : ยซcreateยป
CLI "1" *--> "commands *" Command 
CLI "1" *--> "context 1" CommandContext 
CLI  ..>  CommandContext : ยซcreateยป
CLI  ..>  ConnectCommand : ยซcreateยป
CLI  ..>  ExitCommand : ยซcreateยป
CLI  ..>  HelpCommand : ยซcreateยป
CLI  ..>  ListCommand : ยซcreateยป
CLI  ..>  MempoolCommand : ยซcreateยป
CLI  ..>  MineCommand : ยซcreateยป
CLI  ..>  PeersCommand : ยซcreateยป
CLI  ..>  SendCommand : ยซcreateยป
CLI  ..>  StartCommand : ยซcreateยป
CLI  ..>  StatusCommand : ยซcreateยป
CLI  ..>  SyncCommand : ยซcreateยป
CLIIntegrationTest "1" *--> "context1 1" CommandContext 
CLIIntegrationTest "1" *--> "node1 1" Node 
CommandContext "1" *--> "mempool 1" Mempool 
CommandContext "1" *--> "node 1" Node 
ConnectCommand  ..>  Command 
ExitCommand  ..>  Command 
GenesisBlock "1" *--> "cachedGenesisBlock 1" Block 
HelpCommand  ..>  Command 
HelpCommand "1" *--> "commands *" Command 
ListCommand  ..>  Command 
Mempool "1" *--> "transactions *" Transaction 
Mempool "1" *--> "validator 1" TransactionValidator 
MempoolCommand  ..>  Command 
MineCommand  ..>  Command 
MineCommand  ..>  Miner : ยซcreateยป
Miner "1" *--> "mempool 1" Mempool 
Miner "1" *--> "node 1" Node 
Node "1" *--> "blockList *" Block 
Node "1" *--> "storage 1" BlockchainStorage 
Node "1" *--> "p2pNetwork 1" P2PNetwork 
Node "1" *--> "validator 1" TransactionValidator 
Node "1" *--> "utxoSet 1" UTXOSet 
P2PNetwork "1" *--> "node 1" Node 
P2PNetwork "1" *--> "server 1" P2PServer 
P2PNetwork "1" *--> "peers *" Peer 
P2PServer "1" *--> "network 1" P2PNetwork 
PeersCommand  ..>  Command 
SendCommand  ..>  Command 
StartCommand  ..>  Command 
StartCommand  ..>  Mempool : ยซcreateยป
StartCommand  ..>  Node : ยซcreateยป
StatusCommand  ..>  Command 
SyncCommand  ..>  Command 
Transaction "1" *--> "block 1" TXBlockInfo 
Transaction "1" *--> "inputs *" TransactionInput 
Transaction "1" *--> "outputs *" TransactionOutput 
TransactionOutput "1" *--> "spender 1" Spender 
TransactionValidator "1" *--> "utxoSet 1" UTXOSet 
UTXO "1" *--> "output 1" TransactionOutput 
UTXOSet "1" *--> "utxos *" UTXO 
VotingContract "1" *--> "encryptedContract 1" EncryptedContract 
VotingContract "1" *--> "votes *" Vote 
VotingContract "1" *--> "finalResult 1" VoteResult 
Wallet "1" *--> "node 1" Node 
WalletManager "1" *--> "node 1" Node 

Loading

๊ตฌํ˜„ ์ƒ์„ธ

  1. UTXO ๋ชจ๋ธ: ๋น„ํŠธ์ฝ”์ธ๊ณผ ๋™์ผํ•œ ๋ฏธ์‚ฌ์šฉ ์ถœ๋ ฅ ๊ธฐ๋ฐ˜ ํŠธ๋žœ์žญ์…˜
  2. Proof of Work: SHA-256 ๊ธฐ๋ฐ˜ ์ž‘์—… ์ฆ๋ช…
  3. P2P ๋„คํŠธ์›Œํฌ: TCP ์†Œ์ผ“ ๊ธฐ๋ฐ˜ ๋…ธ๋“œ ๊ฐ„ ํ†ต์‹ 
  4. ์•”ํ˜ธํ™” ํˆฌํ‘œ: ์ฐธ์—ฌ์ž๋งŒ ๊ณ„์•ฝ ๋‚ด์šฉ ํ™•์ธ ๊ฐ€๋Šฅ
  5. RocksDB ์˜์†์„ฑ: Key-Value ๊ธฐ๋ฐ˜ ๊ณ ์„ฑ๋Šฅ ์ €์žฅ
  6. CLI ์ธํ„ฐํŽ˜์ด์Šค: Command ํŒจํ„ด ๊ธฐ๋ฐ˜ ๋ช…๋ น์–ด ์ฒ˜๋ฆฌ
  7. ๋จธํด ํŠธ๋ฆฌ: ํŠธ๋žœ์žญ์…˜ ๋ฌด๊ฒฐ์„ฑ ๊ฒ€์ฆ
  8. ๋””์ง€ํ„ธ ์„œ๋ช…: ECDSA ๊ธฐ๋ฐ˜ ์ธ์ฆ

์œ„ ๊ธฐ๋Šฅ๋“ค์„ CLI๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘          BLOCKCHAIN CLI - HELP                     โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  Available Commands:

  mine            mine [difficulty] - Mine a new block (default difficulty: 3)
  mempool         mempool - Display pending transactions
  start           start <port> [storage_path] - Start a blockchain node
  peers           peers - Display connected peers
  list            list [start] [count] - List blocks (recent 10 by default)
  sync            sync - Request blockchain synchronization from peers
  help            help - Display this help message
  exit            exit - Shutdown node and exit
  balance         balance [address] - Check balance (yours or specific address)
  block           block <height> - Display detailed block information
  send            send <to_address> <amount> - Send coins to an address
  connect         connect <host> <port> - Connect to a peer node
  status          status - Display node status

ํ›„๊ธฐ

1. ์˜ˆ์ƒ๋ณด๋‹ค ๋ณต์žกํ•œ ๊ตฌํ˜„

๋„์ „: ๋ธ”๋ก์ฒด์ธ์˜ ๊ธฐ๋ณธ ๊ฐœ๋…์€ ๋‹จ์ˆœํ•ด ๋ณด์˜€์ง€๋งŒ, ์‹ค์ œ ๊ตฌํ˜„์€ ํ›จ์”ฌ ๋ณต์žกํ–ˆ์Šต๋‹ˆ๋‹ค. ํŠนํžˆ UTXO ๊ด€๋ฆฌ, P2P ๋™๊ธฐํ™”, ์•”ํ˜ธํ™” ์‹œ์Šคํ…œ์ด ์œ ๊ธฐ์ ์œผ๋กœ ์—ฐ๊ฒฐ๋˜์–ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค.

ํ•ด๊ฒฐ: ํฐ ๋ชฉํ‘œ๋ฅผ ์ž‘์€ ๋‹จ๊ณ„๋กœ ๋‚˜๋ˆ„์–ด ์ง„ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋จผ์ € ๋‹จ์ผ ๋…ธ๋“œ์—์„œ ๋ธ”๋ก ์ƒ์„ฑ์„ ๊ตฌํ˜„ํ•˜๊ณ , ์ดํ›„ P2P ๋„คํŠธ์›Œํฌ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ ์ง„์ ์œผ๋กœ ํ™•์žฅํ–ˆ์Šต๋‹ˆ๋‹ค.

2. ๋ถ„์‚ฐ ์‹œ์Šคํ…œ์˜ ์–ด๋ ค์›€

๋„์ „: ์—ฌ๋Ÿฌ ๋…ธ๋“œ๊ฐ€ ๋™์‹œ์— ๋ธ”๋ก์„ ์ƒ์„ฑํ•˜๊ฑฐ๋‚˜ ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ†ต์‹ ํ•˜๋Š” ํ™˜๊ฒฝ์—์„œ, ๊ตฌํ˜„๊ณผ ๋™์‹œ์— ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š” ๊ฒƒ์ด ์‰ฝ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ํŠนํžˆ ๋„คํŠธ์›Œํฌ ์ง€์—ฐ์ด๋‚˜ ๋™๊ธฐํ™” ์ด์Šˆ๋ฅผ ์žฌํ˜„ํ•˜๊ณ  ๋””๋ฒ„๊น…ํ•˜๋Š” ๊ณผ์ •์ด ๊นŒ๋‹ค๋กœ์› ์Šต๋‹ˆ๋‹ค.

ํ•ด๊ฒฐ: ๋กœ์ปฌ ํ™˜๊ฒฝ์—์„œ ์—ฌ๋Ÿฌ ํฌํŠธ๋กœ ๋‹ค์ค‘ ๋…ธ๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋ฉฐ ์‹œ๋‚˜๋ฆฌ์˜ค๋ณ„๋กœ ํ…Œ์ŠคํŠธํ–ˆ์Šต๋‹ˆ๋‹ค. Longest Chain Rule์„ ์ ์šฉํ•ด ๋ถ„๊ธฐ(Fork) ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ๊ณ , ๊ฐ ๋…ธ๋“œ์˜ ์ƒํƒœ๋ฅผ ๋กœ๊ทธ๋กœ ์ถ”์ ํ•˜๋ฉฐ ๋ฌธ์ œ๋ฅผ ํŒŒ์•…ํ–ˆ์Šต๋‹ˆ๋‹ค.

3. ์•”ํ˜ธํ™” ํˆฌํ‘œ ์‹œ์Šคํ…œ์˜ ๋ณต์žก์„ฑ

๋„์ „: ์ฒ˜์Œ ๊ณ„ํšํ–ˆ๋˜ ์•”ํ˜ธํ™” ํˆฌํ‘œ ์‹œ์Šคํ…œ์€ ๊ตฌํ˜„ ๋‚œ์ด๋„๊ฐ€ ๋†’์•„ ์™„๋ฒฝํžˆ ๊ตฌํ˜„ํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.

๋Œ€์‘: ๊ธฐ๋ณธ ๋ธ”๋ก์ฒด์ธ ๊ธฐ๋Šฅ์„ ๋จผ์ € ์™„์„ฑํ•˜๊ณ , ํˆฌํ‘œ ์‹œ์Šคํ…œ์˜ ๊ธฐ๋ฐ˜ ๊ตฌ์กฐ(VotingContract, EncryptedContract)๋งŒ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ํ–ฅํ›„ ํ™•์žฅ์„ ์œ„ํ•œ ํ† ๋Œ€๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

4. ํ”„๋ฆฌ์ฝ”์Šค ํ”ผ๋“œ๋ฐฑ ์ ์šฉ

ํ”„๋ฆฌ์ฝ”์Šค์—์„œ ๋ฐฐ์šด ์›์น™๋“ค์„ ์‹ค์ œ ํ”„๋กœ์ ํŠธ์— ์ ์šฉํ•˜๋ ค ๋…ธ๋ ฅํ–ˆ์Šต๋‹ˆ๋‹ค

์ ์šฉ ์‚ฌํ•ญ:

Command ํŒจํ„ด: CLI ๋ช…๋ น์–ด๋ฅผ ๋…๋ฆฝ์ ์ธ ํด๋ž˜์Šค๋กœ ๋ถ„๋ฆฌํ•˜์—ฌ ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ๊ตฌ์กฐ ๊ตฌ์ถ•

์ผ๊ธ‰ ์ปฌ๋ ‰์…˜: Mempool, UTXOSet, Blockchain ํด๋ž˜์Šค๋กœ ์ปฌ๋ ‰์…˜์„ ์บก์Аํ™”ํ•˜์—ฌ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ์‘์ง‘

Enum ํ™œ์šฉ: MessageType์œผ๋กœ ํƒ€์ž… ์•ˆ์ „์„ฑ ํ™•๋ณด ๋ฐ ๋งค์ง ์ŠคํŠธ๋ง ์ œ๊ฑฐ

๋‹จ์ผ ์ฑ…์ž„ ์›์น™: ๊ฐ ํด๋ž˜์Šค๊ฐ€ ํ•˜๋‚˜์˜ ์ฑ…์ž„๋งŒ ๊ฐ€์ง€๋„๋ก ์„ค๊ณ„ํ•˜์—ฌ ์œ ์ง€๋ณด์ˆ˜์„ฑ ํ–ฅ์ƒ

ํ•˜์ง€๋งŒ ๋ธ”๋กยทํŠธ๋žœ์žญ์…˜ยท๋…ธ๋“œ์ฒ˜๋Ÿผ ๋ณต์žกํ•˜๊ฒŒ ์–ฝํžŒ ๋„๋ฉ”์ธ์—์„œ๋Š” ๋‹จ์ผ ์ฑ…์ž„์„ ๋ช…ํ™•ํžˆ ๋ถ„๋ฆฌํ•˜๊ฑฐ๋‚˜ ๊ฒฐํ•ฉ๋„๋ฅผ ์ตœ์†Œํ™”ํ•˜๋Š” ๊ฒƒ์ด ์‰ฝ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ์ด๋ก ์—์„œ ๋ฐฐ์šด ์ถ”์ƒํ™”์™€ ์ฑ…์ž„ ๋ถ„๋ฆฌ๊ฐ€ ์‹ค์ œ ์‹œ์Šคํ…œ์—์„œ๋Š” ์—ฌ๋Ÿฌ ์ œ์•ฝ๊ณผ ํ˜„์‹ค์ ์ธ ์„ ํƒ์„ ๋™๋ฐ˜ํ•œ๋‹ค๋Š” ์ ์„ ๊นจ๋‹ฌ์•˜์Šต๋‹ˆ๋‹ค.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages