从零构建以太坊(Ethereum)智能合约到项目实战——学习笔记2

资讯 2024-06-27 阅读:125 评论:0
P5 、1-会说话的PPT,从开发者角度快速理解区块链P5, 1-talking PPT, fast-track understanding of block chains from the developer's perspective一...
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

P5 、1-会说话的PPT,从开发者角度快速理解区块链

P5, 1-talking PPT, fast-track understanding of block chains from the developer's perspective

一、什么是区块链?

What's a block chain?

区块链(Block Chain):

block chain (Block Chain):

a、是一种 分布式资料库

a, a distributed database

攻击成本高,超过节点数51%才可以修改数据,即少数服从多数原则

High cost of attack, 51 per cent more than nodes to modify data, i.e. a minority is subject to the majority principle

b、最初是广泛使用在?比特币(Bitcoin)

b, originally widely used? Bitcoin

c、维护一份连续不断?的交易记录档,通过计算算出自己的余额

c, maintain a continuous transaction log file?

d、每一笔资料被称为一个 区块(Block)

d, each of which is called a block

e、每一个区块可以包含 一笔以上的交易

e, each block can contain more than one transaction

demo网址:https://anders.com/blockchain/block.html

Domo web site: https://anders.com/blockchain/block.html

Block:1(区块号)

Block 1: (block number)

Nonce:满足计算难度的值

Nonce: The value that meets the difficulty of calculating

Data:

Hash:包括 Block、Nonce、Data 的数据hash值

Hash: including Block, Nonce, Data hash values

挖矿:就是计算出Nonce值的过程

Mining: the process of calculating the Nonce value

难度4表示hash前面为0000(4个0)

Difficulty 4 means hash up front is 0.000 (4 zeros)

f、每个区块都会与另一个区块 产生连接(Linking)

f, each block will be connected to another block (Linking)

g、每个区块都会包含 上个区块的hash值

g, each block will contain the hash of the previous block

demo网址:https://anders.com/blockchain/hash.html

Domo web site: https://anders.com/blockchain/hash.html

h、所有被连接在一起的区块被称为 链(Chain)

h, all the blocks connected are called Chain

i、就是 由多个区块组成的链

i is a chain of blocks

二、区块链如何运作?

II. How does the block chain function?

区块链

block chain

a、产生区块的过程会经过 复杂的密码学运算(Cryptography)

a, the process of creating blocks will be followed by complex cryptography .

b、复杂的密码学运算可杜绝 记录篡改与修订

b, complex cryptography to prevent record tampering and revision

c、每个区块在成功产生之后 是无法修改的

c, each block cannot be modified after it has been successfully created

d、产生区块的过程又称为 挖矿(Mining)

d. The process of creating blocks is also known as Mining

e、负责产生区块的人又称为 矿工(Miner)

e, also known as Miner as the person responsible for the creation of blocks

f、负责产生区块的机器又称为 挖矿机

f, the machine responsible for the creation of blocks, also known as the miner

g、每一笔资料都可以通过连接找出 所有可靠的历史资料(溯源性)

g, every piece of information can be linked to all reliable historical information (trace)

h、由于是分布式数据库,所以 具有去(中心化)特性

h, since it's a distributed database, has a de- (centralized) feature

i、(去中心化)意味着 资料会分布到多个节点

i, (decentralized) means that the information will be distributed to multiple nodes .

j、所有的节点会共同维护 整个分布式数据库

j, all nodes will jointly maintain the whole distributed database

k、共同维护整份资料库意味着 没人可以说自己的区块才是合法有效的区块

k, co-maintaining the entire database means that no one can say that their blocks are legally valid

l、共同维护整份资料库意味着?多数人验证后过的区块才是合法有效的区块

l, co-maintaining the entire database means that the blocks that most people have verified are legally valid .

m、共同维护整份资料库意味着 超过50%的节点验证过的区块才是合法有效的区块

m, co-maintaining the whole database means that more than 50% of the nodes that have been validated are legally valid blocks

n、每个节点 必须存储所有区块(但有新的设计可让节点仅存储部分区块)

n, each node must store all blocks (but there is a new design to allow node to store only parts of the blocks)

o、每一个节点都可以 协助验证区块的有效性

o, every node can help verify the validity of blocks

p、任何一笔资料被篡改 都将破坏区块的完整性

p, any tampering of information will destroy the integrity of the block

q、任何一笔资料被篡改的几率 微乎其微

q, the probability that any piece of information has been tampered with is negligible

r、由于是分布式数据库,所以 具有去(中心化)特性

r, since it's a distributed database, has a de- (centralized) feature

s、的写作包含两种物件类型 (交易)与(区块)

s, writing contains two types of objects (transactions) and (blocks)

t、解说情景 数字货币

t, contemplation digital currency

u、交易物件就是 转账过程的完整内容

u, the transaction is the complete content of the transfer process

v、(区块物件)包含 一系列交易的集合

v, (block objects) contains a collection of transactions

demo网址:https://anders.com/blockchain/blockchain.html

Domo web site: https://anders.com/blockchain/blockchain.html

每个区块修改之后,往后所有的区块都需要重新挖矿!

After each block is modified, all blocks need to be re-mining!

分布式区块链demo网址:https://anders.com/blockchain/distributed.html

Distributed block chain demo web site: https://anders.com/blockchain/distributed.html

P6 、2-挖矿算法

P6, 2-mining algorithm

demo网站:www.blockchaindemo.io

Demo website: www.blockchaindemo.io

终端环境为:ubuntu 16.04 ,已经安装好了npm

End environment: ubuntu 16.04, installed npm

(PS:如果还没安装,执行: apt-get install npm 安装就行!

(PS: If not installed, execute: apt-get install npm!

安装完,查看版本: npm -v

Installed, viewing version: npm-v

版本为:3.5.2? )

Version 3.5.2?)

打开终端,输入

Open terminal, enter.

代码语言:javascript
复制

安装有点慢,

It's a little slow.

安装出错了!

There's been a mistake!

node_modules安装问题,执行以下:

Installation of node_modules, as follows:

代码语言:javascript
复制

终端输入:

Terminal input:

代码语言:javascript
复制

区块(block)长什么样子?

What does Block look like?

在 blockchain -> 后面输入 blockchain 或者 bc 查看创世区块结构。

Enter the blockchain or bc to view the original block structure at the bottom of the blockchain->.

代码语言:javascript
复制
  • Index(Block #):第几个区块?(创世区块链的索引为0)
  • Hash:当前区块的hash值
  • Previous Hash:上一个区块的hash值
  • Timestamp:当前区块创建时的时间戳
  • Data:存储在当前区块上的交易信息
  • Nonce:在找到有效区块之前,我们经历的迭代次数

挖矿:

Mining:

代码语言:javascript
复制

?Hash值是怎么计算的?

? How's the Hash value calculated?

Hash值是一个? 十六进制? 固定长度为 64位 的唯一的标识。

Hash is the only identifier for a hexadecimal length of 64 bits.

hash值是由 index,previous block hash,timestamp,block date 和 nonce 作为输入数据计算而得。

The hash value is calculated as input data by index, precious black hash, mimestamp, black date and nonce.

代码语言:javascript
复制

你是否注意到哈希中的四个前导0?

Did you notice the four leading zeros in Hashi?

四个前导0是有效散列的最低要求。所需的前导0 的数量称为 难度。

Four lead zeros are the minimum requirements for a valid hash. The number of lead zeros required is called difficulty.

下面的方法验证hash难度是否有效。

The following method is used to verify the validity of the hash difficulty.

代码语言:javascript
复制

这就是我们所熟知的工作量证明系统-Proof-of-work system。

This is what we know about the workload certification system - Proof-of-work system.

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 区块链社区有哪些?区块链社区是什么?

    区块链社区有哪些?区块链社区是什么?
    展开全文...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
  • 0.00003374个比特币等于多少人民币/美金

    0.00003374个比特币等于多少人民币/美金
    0.00003374比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00003374比特币等于2.2826 1222美元/16.5261124728人民币。比特币(BTC)美元(USDT)人民币(CNY)0.00003374克洛克-0/22216.5261124728比特币对人民币的最新汇率为:489807.72 CNY(1比特币=489807.72人民币)(1美元=7.24人民币)(0.00003374USDT=0.0002442776 CNY)。汇率更新于2024...
  • 0.00015693个比特币等于多少人民币/美金

    0.00015693个比特币等于多少人民币/美金
    0.000 15693比特币等于多少人民币?根据比特币对人民币的最新汇率,0.000 15693比特币等于10.6 1678529美元/76.86554996人民币。比特币(BTC)【比特币价格翻倍】美元(USDT)人民币(CNY)0.000/克洛克-0/5693【数字货币矿机】10.6 167852976.8655254996比特币对人民币的最新汇率为:489,807.72 CNY(1比特币= 489,807.72人民币)(1美元=7.24人民币)(0.00015693 U...
  • 带你进入一次元宇宙,让你亲身体会如何在元宇宙中抓住自己的机会

    带你进入一次元宇宙,让你亲身体会如何在元宇宙中抓住自己的机会
    元宇宙是个怎样的世界?鑫哥今天带你进入一次元宇宙。今天用最简单明了的语言来解释一下元宇宙,还有如何利用元宇宙实现财富自由。What kind of world is Yuan cosmos? Brother Jin took you into the Yuan cosmos today. Today, explain the Yuan cosmos in the simplest language, and how to use the Yuan cosmos for the...
标签列表