"ᠪᠯᠣᠻᠴᠧᠢᠢᠨ"-ны өөр хувилбарууд
Edit
(Layout) |
(Edit) |
||
53-р мөр: | 53-р мөр: | ||
ᠤᠳᠠᠯᠠ ᠦᠭᠡᠢ᠂ ᠪᠯᠣᠻᠴᠧᠢᠢᠨ ᠲᠧᠻᠨᠣᠯᠣᠭᠢ ᠢ ᠡᠮᠴᠢᠯᠡᠭᠡᠨ ᠦ ᠮᠡᠳᠡᠭᠡᠯᠡᠯ ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ᠂ ᠴᠠᠬᠢᠮ ᠨᠣᠲ᠋ᠠᠷᠢᠶᠠᠲ ᠠᠵᠢᠯᠯᠠᠭᠤᠯᠬᠤ᠂ ᠲᠠᠲᠠᠪᠤᠷᠢ ᠬᠤᠷᠢᠶᠠᠬᠤ ᠵᠡᠷᠭᠡ ᠥᠭᠡᠷᠡ ᠪᠤᠰᠤᠳ ᠣᠯᠠᠨ ᠵᠣᠷᠢᠯᠭᠠ ᠳᠤ ᠠᠰᠢᠭᠯᠠᠬᠤ ᠪᠣᠯᠤᠮᠵᠢ ᠲᠠᠢ ᠶᠢ ᠣᠶ᠋ᠢᠯᠠᠭᠠᠭᠰᠠᠨ ᠪᠢᠯᠡ᠃ | ᠤᠳᠠᠯᠠ ᠦᠭᠡᠢ᠂ ᠪᠯᠣᠻᠴᠧᠢᠢᠨ ᠲᠧᠻᠨᠣᠯᠣᠭᠢ ᠢ ᠡᠮᠴᠢᠯᠡᠭᠡᠨ ᠦ ᠮᠡᠳᠡᠭᠡᠯᠡᠯ ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ᠂ ᠴᠠᠬᠢᠮ ᠨᠣᠲ᠋ᠠᠷᠢᠶᠠᠲ ᠠᠵᠢᠯᠯᠠᠭᠤᠯᠬᠤ᠂ ᠲᠠᠲᠠᠪᠤᠷᠢ ᠬᠤᠷᠢᠶᠠᠬᠤ ᠵᠡᠷᠭᠡ ᠥᠭᠡᠷᠡ ᠪᠤᠰᠤᠳ ᠣᠯᠠᠨ ᠵᠣᠷᠢᠯᠭᠠ ᠳᠤ ᠠᠰᠢᠭᠯᠠᠬᠤ ᠪᠣᠯᠤᠮᠵᠢ ᠲᠠᠢ ᠶᠢ ᠣᠶ᠋ᠢᠯᠠᠭᠠᠭᠰᠠᠨ ᠪᠢᠯᠡ᠃ | ||
<br><br> | <br><br> | ||
=ᠫᠷᠣᠭ᠌ᠷᠠᠮᠴᠢᠯᠠᠯ= | |||
ᠪᠯᠣᠻᠴᠧᠢᠢᠨ ᠬᠥᠭᠵᠢᠭᠦᠯᠬᠦ ᠳ᠋ᠦ ᠬᠡᠷᠡᠭᠯᠡᠵᠦ ᠪᠣᠯᠳᠠᠭ ᠣᠯᠠᠨ ᠫᠷᠥᠭ᠌ᠷᠠᠮ ᠤᠨ ᠬᠡᠯᠡ ᠪᠠᠢᠢᠳᠠᠭ᠃ ᠡᠭᠦᠨ ᠳ᠋ᠦ C++, C#, Java, JavaScript, Python, Solidity, Simplicity, CX, Go, Ruby, Rust, Rholang ᠭᠡᠬᠶ ᠵᠡᠷᠭᠡ ᠬᠡᠯᠡ ᠨᠣᠭᠦᠳ ᠢ ᠳᠤᠷᠳᠠᠵᠤ ᠪᠣᠯᠤᠮᠤᠢ᠃<ref>chirag. 15 best programming languages for Blockchain app development. Appinventiv. 2022/03/28. <nowiki>https://appinventiv.com/blog/best-blockchain-programming-languages/#:~:text=What%20programming%20languages%20does%20blockchain,Solidity%2C%20Simplicity%2C%20and%20CX</nowiki></ref> | |||
'''ᠪᠯᠣᠻᠴᠧᠢᠢᠨ ᠦ ᠫᠷᠣᠭ᠌ᠷᠠᠮ ᠤᠨ ᠨᠢᠭᠡ ᠬᠡᠰᠡᠭ ᠻᠣᠳ᠋ ᠤᠨ ᠵᠢᠱᠢᠶ ᠡ᠋ C# ᠬᠡᠯᠡ ᠪᠡᠷ᠄''' | |||
public class BlockChain | |||
{ | |||
private readonly int _proofOfWorkDifficulty; | |||
private readonly double _miningReward; | |||
private List<Transaction> _pendingTransactions; | |||
public List<Block> Chain { get; set; } | |||
public BlockChain(int proofOfWorkDifficulty, int miningReward) | |||
{ | |||
_proofOfWorkDifficulty = proofOfWorkDifficulty; | |||
_miningReward = miningReward; | |||
_pendingTransactions = new List<Transaction>(); | |||
Chain = new List<Block> {CreateGenesisBlock()}; | |||
} | |||
public void CreateTransaction(Transaction transaction) | |||
{ | |||
_pendingTransactions.Add(transaction); | |||
} | |||
public void MineBlock(string minerAddress) | |||
{ | |||
Transaction minerRewardTransaction = new Transaction(null, minerAddress, _miningReward); | |||
_pendingTransactions.Add(minerRewardTransaction); | |||
Block block = new Block(DateTime.Now, _pendingTransactions); | |||
block.MineBlock(_proofOfWorkDifficulty); | |||
block.PreviousHash = Chain.Last().Hash; | |||
Chain.Add(block); | |||
_pendingTransactions = new List(); | |||
} | |||
public bool IsValidChain() | |||
{ | |||
for (int i = 1; i < Chain.Count; i++) | |||
{ | |||
Block previousBlock = Chain[i - 1]; | |||
Block currentBlock = Chain[i]; | |||
if (currentBlock.Hash != currentBlock.CreateHash()) | |||
return false; | |||
if (currentBlock.PreviousHash != previousBlock.Hash) | |||
return false; | |||
} | |||
return true; | |||
} | |||
public double GetBalance(string address) | |||
{ | |||
double balance = 0; | |||
foreach (Block block in Chain) | |||
{ | |||
foreach (Transaction transaction in block.Transactions) | |||
{ | |||
if (transaction.From == address) | |||
{ | |||
balance -= transaction.Amount; | |||
} | |||
if (transaction.To == address) | |||
{ | |||
balance += transaction.Amount; | |||
} | |||
} | |||
} | |||
return balance; | |||
} | |||
private Block CreateGenesisBlock() | |||
{ | |||
List transactions = new List<Transaction> {new Transaction("", "", 0)}; | |||
return new Block(DateTime.Now, transactions, "0"); | |||
} | |||
}<ref>Czako Zoltan. Blockchain Explained Using C# Implementation. Towards Data Science. 2018/11/13. https://towardsdatascience.com/blockchain-explained-using-c-implementation-fb60f29b9f07</ref> | |||
'''ᠪᠯᠣᠻᠴᠧᠢᠢᠨ ᠫᠷᠣᠭ᠋ᠷᠠᠮᠴᠢᠯᠠᠬᠤ ᠳ᠋ᠤ ᠲᠠᠯᠪᠢᠭᠳᠠᠬᠤ ᠱᠠᠭᠠᠷᠳᠠᠯᠭᠠ''' | |||
· ᠪᠯᠠᠻᠴᠧᠢᠢᠨ ᠲᠧᠻᠨᠣᠯᠣᠭᠢ ᠢᠢᠨ ᠨᠡᠪᠲᠡᠷᠬᠡᠢ ᠮᠡᠳᠡᠯᠭᠡ᠂ | |||
· ᠨᠠᠭᠠᠨᠠᠳᠠᠵᠤ ᠨᠢᠭᠡ ᠥᠨᠳᠦᠷ ᠲᠦᠪᠰᠢᠨ ᠦ ᠫᠷᠣᠭᠷᠠᠮᠴᠢᠯᠠᠯ ᠤᠨ ᠬᠡᠯᠡ ᠢ ᠴᠢᠯᠦᠭᠡ ᠲᠢᠠ ᠡᠵᠡᠮᠰᠢᠬᠦ᠂ | |||
· ᠨᠢᠭᠤᠴᠠᠯᠠᠯ ᠲᠠᠢ ᠪᠢᠴᠢᠭᠯᠡᠯ᠂ ᠬᠠᠮᠠᠭᠠᠯᠠᠯᠲᠠ ᠢᠢᠨ ᠵᠠᠷᠴᠢᠮ ᠤᠳ ᠤᠨ ᠭᠦᠨᠵᠡᠭᠡᠢ ᠣᠢᠢᠯᠠᠭᠠᠯᠲᠠ᠂ | |||
· ᠲᠦᠭᠡᠭᠡᠭᠰᠡᠨ ᠰᠢᠰᠲ᠋ᠧᠮ᠂ ᠲᠡᠭᠰᠢ ᠡᠷᠬᠡ ᠲᠡᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠦ ᠴᠢᠭᠯᠡᠯ ᠢᠢᠡᠷ ᠬᠢ ᠲᠤᠷᠰᠢᠯᠭᠠ᠂ | |||
· ᠤᠬᠠᠭᠠᠯᠢᠭ ᠭᠡᠷᠡ ᠢᠢᠨ ᠲᠠᠯᠠ ᠪᠠᠷ ᠬᠢ ᠮᠡᠳᠡᠯᠭᠡ᠂ | |||
· ᠠᠯᠭᠣᠷᠢᠲ᠋ᠾᠮ᠂ ᠥᠭᠭᠥᠭᠳᠡᠯ ᠦᠨ ᠪᠦᠲᠡᠴᠡ ᠢᠢᠨ ᠲᠠᠯ ᠠ᠋ ᠪᠠᠷ ᠬᠢ ᠣᠢᠢᠯᠠᠭᠠᠯᠲᠠ᠃<ref>Six Must-Have Blockchain Developer Skills. Hire Remotely. 2022/04/27. <nowiki>https://www.hiremotely.com/blog/blockchain-developer-skills</nowiki></ref> | |||
(6 must-have blockchain developer skills. Hire Remotely. 2022/04/27. <nowiki>https://www.hiremotely.com/blog/blockchain-developer-skills</nowiki>) | |||
<br> | |||
=ᠨᠡᠷᠡ ᠲᠣᠮᠢᠶᠠᠯᠠᠯ= | =ᠨᠡᠷᠡ ᠲᠣᠮᠢᠶᠠᠯᠠᠯ= | ||
ᠪᠯᠣᠻᠴᠧᠢᠢᠨ - blockchain - блокчейн | ᠪᠯᠣᠻᠴᠧᠢᠢᠨ - blockchain - блокчейн |