2 PART TWO 3 PART TWO P 2
- Slides: 45
2 PART TWO 共识机制
3 PART TWO P 2 P网络
P 2 P网络的基本组成 Blu P P/I TC IP P/ Linux TC oth eto TCP/IP P 2021/9/8 HTT XP
Napster原理 insert(X, 1. 2. 3. 4). . . Publish I have X! 1. 2. 3. 4
Napster原理 4. 3. 2. 1 Fetch search(A) --> 4. 3. 2. 1 Query Reply Where is file A? 1. 2. 3. 4
Gnutella原理 I have file A. Reply Query Where is file A?
Ka. Za. A原理 insert(X, 123. 2. 21. 23). . . Publish I have X! 123. 2. 21. 23
Ka. Za. A原理 search(A) --> 123. 2. 22. 50 Query Replies search(A) --> 123. 2. 0. 18 Where is file A? 123. 2. 0. 18
Bit. Torrent原理 Tracker A D B C
Bit. Torrent原理 A D B C
4 PART FOUR 智能合约
编译合约 智能合约 hello word contract greeter is mortal { //继承mortal string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } } var greeter. Source = ' contract greeter is mortal {string greeting; …. . return greeting; }}' var greeter. Compiled = web 3. eth. compile. solidity(greeter. Source) 备注:本节中的所有例子以在Go语言的客户端geth中的操作为例
创建合约 var greeter. Contract = web 3. eth. contract(greeter. Compiled["<stdin>: greeter"]. info. abi. Definition); abi. Definition是合约的接口说明 老版本中是 greeter. Compiled. greeter. info. abi. Definition 新版本(geth-1. 5. 9)中是 greeter. Compiled["<stdin>: greeter"]. info. abi. Definition 备注:本节中的所有例子以在Go语 言的客户端geth中的操作为例
部署合约的时候,需要支付费用,需要用户输入密码,先执行 personal. unlock. Account(eth. accounts[0]); var greeter = greeter. Contract. new(_greeting, { from: eth. accounts[0], data: greeter. Compiled["<stdin>: greeter"]. code, gas: 1000000 }, function(e, contract){ if(!e) { if(!contract. address) { console. log("Contract transaction send: Transaction. Hash: " + contract. transaction. Hash + " waiting to be mined. . . "); } else { console. log("Contract mined! Address: " + contract. address); console. log(contract); } }}) 日 志
其它的机器调用合约 其它的机器上没有greeter对象,需要根据合约的地址和abi. Definition来创建,然后调用。 var greeter 2 = eth. contract([{constant: false, inputs: [], name: ‘kill’, outputs: [], type: ‘function’}, {constant: true, inputs: [], name: ‘gre et’, outputs: [{name: ‘’, type: ‘string’}], type: ‘function’}, {inputs: [{name: ‘_greeting’, type: ‘string’}], type: 'constructor '}]). at(‘ 0 xcde 7 cfdf 234 dfa 63 ba 4 d 7 c 273 a’); greeter 2. greet();
ÐAPPS(去中心化的应用) http: //dapps. ethercasts. com/上面已经有300多个ÐAPPS
ÐAPPS
5 PART FIVE 区块链应用
Thank you for your attention! Any questions?
- Part whole model subtraction
- Unit ratio definition
- Part part whole
- Technical description examples
- Part of a bar
- The part of a shadow surrounding the darkest part
- Minitab adalah
- The diagram shows a parallelogram cdef
- Two part tariff graph
- Two part tariff graph
- Two part tariff
- Opposite rays example
- Chapter 4 test a part two preparing a chart of accounts
- Two part thesis statement
- Two part thesis
- Two parts of topic sentence
- Part 2 analyzing the effect of transactions
- Analyzing transactions
- Two parts of topic sentence
- 8-4 project part two: presentation
- Verb of normal
- Two part tariff
- 1. 13-1 work together, p. 381
- Part two analyzing transactions in a cash control system
- Complementary and supplementary angles formula
- Who is he
- 1910 134
- Two two four cryptarithmetic solution
- Close reading workshop
- Describing congruent angle relationships
- When two curves coincide the two objects have the same
- Both passages have a(n) tone
- Adjacent vs perpendicular
- Two beer or not two beer shakesbeer
- Hamlet act 2 scene 2 summary
- Two witches were watching two watches
- Biological statistics
- The two terms of comparison in the first two quatrains are
- Two witches watched two watches
- Two beer or not two beer shakesbeer
- Why does macbeth revisit the witches
- Proto 5hema
- Pedigree biology
- How to write a friendly letter format
- What is an octave and sestet
- Crest in waves