BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction

这篇具有很好参考价值的文章主要介绍了BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Chapter 1 Introduction to Cryptography and Cryptocurrencies

In fiat currencies, law enforcement is necessary for stopping people from breaking the rules of the system.Howerver,Cryptocurrencies need to be enforced purely technologically and without relying on a central authority.

  • 传统法定货币(fiat currencies),使用法律手段来确保安全性。但加密货币(cryptocurrencies)采用存粹的技术手段来保证安全性。

Bitcoin relies on only a handful of relatively simple and well-known cryptographic constructions: cryptographic hashes and digital signatures,zero-knowledge proofs.

  • 比特币依赖哈希(hashes), 数字签名(digital signitures)以及零知识证明(zero-knowledge proofs).

1.1 CRYPTOGRAPHIC HASH FUNCTIONS

Properties of a hash fuction:

  1. Its input can be any string of any size.
  2. It produces a fixed-sized output.
  3. It is efficiently computable.More technically, computing the hash of an n-bit string should have a running time that is O(n).
  • 哈希函数(Hash function)属性:
    输入可以是任何长度的字符串;
    产生固定长度的输出;
    时间复杂度O(n),即n位的输入所需要的计算时间是O(n).

Three additional properties to be secure for a hash function:

  1. collision resistance
  2. hiding
  3. puzzle friendliness
  • 三个额外的属性
    collision resistance
    hiding
    puzzle friendliness

1.1.1 Collsion resistance

Collsion resistance:
A hash function H is said to be collision resistant if it is infeasible to find two values, x and y, such that x ≠ y, yet H(x) = H(y).
A collision occurs when two distinct inputs produce the same output.
Consider the following simple method for finding a collision for a hash function with a 256-bit output size: pick 2256 + 1 distinct values, compute the hashes of each of them.

  • collision resistance :
    除了穷举遍历,没有人能找到高效(efficient)的方法去实现 : x ≠ y, 有 H(x) = H(y)。但碰撞(collision)对于每个哈希函数都是客观存在的。因为,给定 2^256 + 1^ 个不同的输入,对于一个结果长度固定在256位的哈希函数而言,一定会产生碰撞。
    关于高效(efficient)的理解,哈希函数: H(x)= x mod 2256 可以很容易推算出3和**3 + 2256**会映射到相同的结果,所以不符合这一属性。

APPLICATION: MESSAGE DIGESTS
To ensure file integrity:
the file people download is the same as the one he uploaded to a online file storage system.
That is, Compare the hash of the downloaded file to the local copy.

  • 应用:通过比较网络文件和本地文件的哈希值,来验证二者是否相同。

1.1.2 Hiding

Hiding:
A hash function H is said to be hiding if when a secret value r is chosen from a probability distribution that has high min-entropy, then, given H(r ‖ x), it is infeasible to find x.
The hiding property asserts that if we’re given the output of the hash function y = H(x), there’s no feasible way to figure out what the input, x, was

  • r和x做链接,得到H(r || x),其中 r 符合high min-entropy的概率分布,这样则没有可行的方法在已知输出的情况下推算出输入x是什么。

APPLICATION: COMMITMENTS
commitment:
the digital analog of taking a value, sealing it in an envelope, and putting that envelope out on the table where everyone can see it.
---------------------------------------------------
Commitment scheme:
com := commit(msg, nonce) : The commit function takes a message and secret random value, called a nonce, as input and returns a commitment.
verify(com, msg, nonce) : The verify function takes a commitment, nonce, and message as input. It returns true if com == commit(msg, nonce) and false otherwise.
-------------------------------------------------------
Two security peoperties:
Hiding: Given com, it is infeasible to find msg.
Binding: It is infeasible to find two pairs (msg, nonce) and (msg′, nonce′) such that msg ≠ msg′ and commit(msg, nonce) == commit(msg′, nonce′).

  • Commitment: 将一个数据放在封好的信封里,并且放在桌子上向人们展示。
    -------------------------------
    Commitment scheme:
    com := commit(msg, nonce) : 函数commit以msg和nonce为参数,返回一个commitment
    verify(com, msg, nonce) : 函数verify以commitment, nonce, message为参数。返回 com == commit(msg, nonce).
    ------------------------------------
    Two security peoperties:
    Hiding: 对于给定的com,无法找到msg。
    Binding: 当msg != msg’时,commit(msg, nonce) != commit(msg’,nonce’)

To use a commitment scheme :
We first need to generate a random nonce. We then apply the commit function to this nonce together with msg, the value being committed to, and we publish the commitment com. This stage is analogous to putting the sealed envelope on the table. At a later point, if we want to reveal the value that we committed to earlier, we publish the random nonce that we used to create this commitment, and the message, msg. Now anybody can verify that msg was indeed the message committed to earlier. This stage is analogous to opening the envelope.

  • commitment的流程
  1. 生成随机nonce
  2. 使用com:=commit(nonce,msg)
  3. 公布com

Implemetation of a commitment scheme:
commit(msg, nonce) := H(nonce ‖ msg).
Nonce is a random 256-bit value.
Then, concatenate the nonce and the message.
Return the hash of this concatenated value as the commitment.

  • commit(msg, nonce) := H(nonce ‖ msg).
    nonce 是一个256位的值
    然后将nonce 和 msg连接
    最后返回计算好的哈希值,作为commitment

1.1.3 Puzzle Friendliness

Puzzle friendliness. A hash function H is said to be puzzle friendly if for every possible n-bit output value y, if k is chosen from a distribution with high min-entropy, then it is infeasible to find x such that H(k ‖ x) = y in time significantly less than 2n.

  • Puzzle friendliness:对于如果每一个的n位的结果,如果k符合high min-entropy分布,则不能在2n的时间找到x使得H(k ‖ x) = y 。

Intuitively, if someone wants to target the hash function to have some particular output value y, and if part of the input has been chosen in a suitably randomized way, then it’s very difficult to find another value that hits exactly that target.

  • 已知y,已知k(符合随机分布),很难找到x。

APPLICATION: SEARCH PUZZLE
A search puzzle consists of
• a hash function, H,
• a value, id (which we call the puzzle-ID), chosen from a high min-entropy distribution
• a target set Y.

A solution to this puzzle is a value, x, such that
H(id || x) ∈ Y

  • 一个search puzzle包括
    一个哈希函数H ;
    一个符合high min-entropy分布的puzzle-ID ;
    一个目标集Y ;

If a hash funtion is puzzle friendly, then there’s no solving strategy for this puzzle that is much better than just trying random values of x.

  • 对于一个puzzle friendly的哈希函数,一个个随机地试x的值是最好的求解方法。

1.1.4 SHA-256

Merkle-Damgård transform
As long as we can build a hash function that works on fixed-length inputs, there’s a generic method to convert it into a hash function that works on arbitrary-length inputs.

  • Merkle-Damgård transform
    只要我们能构建一个可以处理定长输入的哈希函数,则就可以转换成一个可以处理随意长度的哈希函数。

Compression function
the underlying fixed-length collision-resistant hash function is called the compression function.

  • Compression function
    可以处理定长输入的collision-resistant的哈希函数。

The process of Merkle-Damgård transform
Suppose that the compression function takes inputs of length m and produces an output of a smaller length n.
The input to the hash function, which can be of any size, is divided into blocks of length m – n.
The construction works as follows: pass each block together with the output of the previous block into the compression function.
Input length will then be (m – n) + n = m.

  • 首先,我们有一个compression function, 它接受长度为m的输入,产生长度为n的输出。
  • 接下来,对于任意长度的输入,我们将它划分为多个长度为(m - n)的块。
  • 将每个(m - n)的块连带着上个块的输出(长度为n)传递给compression function,即(m - n)+n = m, 满足了compression输入要以m为长度的要求。

1.2 HASH POINTERS AND DATA STRUCTURES

Hash pointer:
A hash pointer is a pointer to where data is stored together with a cryptographic hash of the value of this data at some fixed point in time.
Whereas a regular pointer gives you a way to retrieve the information, a hash pointer also allows you to verify that the information hasn’t been changed

  • 哈希指针:
    不仅指明了地址,还能去查看当前地址的内容是否被更改过。

Block Chain
Similat to a linked list
Each block not only tells us where the value of the previous block was, but it also contains a digest of that value, which allows us to verify that the value hasn’t been changed.
BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction

  • 区块链
    每一个块指明了前一个块的值,同时包含了这个值的摘要。这个摘要可以帮助我们判断这个值是否被改变过。

If an adversary modifies data anywhere in the block chain, it will result in the hash pointer in the following block being incorrect

  • 如果其他人修改了区块里的数据,将会导致后面区块里的哈希指针出错。

Merkle Trees
In a Merkle tree, data blocks are grouped in pairs, and the hash of each of these blocks is stored in a parent node. The parent nodes are in turn grouped in pairs, and their hashes stored one level up the tree. This pattern continues up the tree until we reach the root node.
BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction

  • Merkle Trees
    数据块成对分组,每个块的哈希值被存储在他们的父节点当中。向上往复,直至根节点。

Proof of membership
To prove that a data block is included in the tree only requires showing the blocks in the path from that data block to the root.
If there are n nodes in the tree,it takes about log(n) time for us to verify it.
BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction

  • 去证明一个块属于这棵树,只要顺着路径遍历即可,对于n个节点的树,时间复杂度约为log(n).

1.3 DIGITAL SIGNATURES

Two properties of digital signatures
First, only you can make your signature.
Second, the signature is to be tied to a particular document, so that the signature cannot be used to indicate your agreement or endorsement of a different document.

  • 数字签名的两个属性
    只有本人可以签名;
    每个签名绑定在固定的文件上, 当前这个签名不能代表其他的文件。

Digital signature scheme
three algorithms are consisted:
-----------------------------------------------------------------
First, (sk, pk) := generateKeys(keysize)
The generateKeys method takes a key size and generates a key pair. The secret key sk is kept privately and used to sign messages. pk is the public verification key that you give to everybody. Anyone with this key can verify your signature.
------------------------------------------------------------------
sig := sign(sk, message)
The sign method takes a message and a secret key, sk, as input and outputs a signature for message under sk.
------------------------------------------------------------------
isValid := verify(pk, message, sig)
The verify method takes a message, a signature, and a public key as input. It returns a boolean value, isValid, that will be true if sig is a valid signature for message under public key pk, and false otherwise.

  • 数字签名的三个方法
    ------------------------------------------------------------
    (sk, pk) := generateKeys(keysize)
    产生一对给定长的的私钥(sk/secret key)和公钥(pk/ public key)。私钥的由当前用户个人保管,用来签名。公钥是对所有人公开的,别人可以用来检验签名的有效性。
    ------------------------------------------------------------
    sig := sign(sk, message)
    产生签名。以私钥(sk)和信息(message)为参数,产生产生与这个文件和私钥相对应的签名。
    ------------------------------------------------------------
    isValid := verify(pk, message, sig)
    检验有效性。当前签名(sig)如果和信息(message)以及公钥(pk)对应的起来则返回真。

Unforgeability game
If the attacker is able to successfully output a signature on a message that he has not previously seen, he wins.
If he is unable to do so, the challenger wins, and the digital signature scheme is unforgeable.
BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction
We give the secret key to the challenger, and we give the public key to both the challenger and the adversary. So the adversary only knows information that’s public, and his mission is to try to forge a message. The challenger knows the secret key. So he can make signatures.
we allow the adversary to try a number of guesses that is a polynomial function of the key size, but no more (e.g., he cannot try exponentially many guesses).
The challenger runs the verify algorithm to determine whether the signature produced by the attacker is a valid signature on M under the public verification key.

  • Unforgeability game
           如果攻击者(attacker/adversary)能够伪造出签名,攻击者获胜。如果他不能,则挑战者(challenger)获胜。
           我们把私钥给挑战者,而公钥的话,为挑战者和攻击双方共有。私钥类似于密码,公钥类似于账号。
           攻击者可以多次尝试伪造签名,挑战者去检验该签名是否正确。

1.4 PUBLIC KEYS AS IDENTITIES

The idea is to take a public key, one of those public verification keys from a digital signature scheme, and equate it to an identity of a person or an actor in a system.

  • 拿一个公钥,并将和一个人相对应。

1.5. TWO SIMPLE CRYPTOCURRENCIES

1.5.1 Goofycoin

The first rule of Goofycoin is that a designated entity, Goofy, can create new coins whenever he wants and these newly created coins belong to him.

  • 一个特定的实体可以创建新的币,这个币为他所拥有。

The second rule of Goofycoin is that whoever owns a coin can transfer it to someone else.

  • 第二个规则是,币可以转让。

Let’s say Goofy wants to transfer a coin that he created to Alice. To do this, he creates a new statement that says “Pay this to Alice” where “this” is a hash pointer that references the coin in question. And as we saw earlier, identities are really just public keys, so “Alice” refers to Alice’s public key. Finally, Goofy signs the string representing the statement. Since Goofy is the one who originally owned that coin, he has to sign any transaction that spends the coin. Once this data structure representing Goofy’s transaction is signed by him, Alice owns the coin. She can prove to anyone that she owns the coin, because she can present the data structure with Goofy’s valid signature. Furthermore, it points to a valid coin that was owned by Goofy. So the validity and ownership of coins are self-evident in the system.

  • Goofy想要将他的币转给Alice, 他发起一个声明"我将这枚币转给Alice"。这个声明须由Goofy签名,则这枚币就属于Alice了。

double-spending attack
Someone spends a coin twice.
Goofycoin does not solve the double-spending attack, and therefore it’s not secure.

  • double-spending attack*
    一个人将一枚币转让给多个人。Goofycoin未能解决这个问题。

1.5.2 Scroogecoin

The first key idea is that a designated entity called Scrooge publishes an append-only ledger containing the history of all transactions.
The append-only property ensures that any data written to this ledger will remain forever in the ledger.
If the ledger is truly append only, we can use it to defend against double spending by requiring all transactions to be written in the ledger before they are accepted.
That way, it will be publicly documented if coins were previously sent to a different owner.

  • 设计一个只可以在后面添加内容而不可以再做其他修改的账本。将所有的交易记录下到账本里,便可以知道当前币是属于谁的,有没有转让给多个人。

To implement this append-only functionality, Scrooge can build a block chain, which he will digitally sign. It consists of a series of data blocks, each with one transaction in it (in practice, as an optimization, we’d really put multiple transactions in the same block, as Bitcoin does.) Each block has the ID of a transaction, the transaction’s contents, and a hash pointer to the previous block. Scrooge digitally signs the final hash pointer, which binds all the data in this entire structure, and he publishes the signature along with the block chain.
BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction

  • 为实现这一功能,建立一个区块链,每一个区块对应一个交易信息(现实生活中,可能一个区块包含多个交易信息)。
    每个区块的数据结构是(ID, contents, hash pointer to previous block)。Scrooge 为最后一个哈希指针签名即可,然后连带着整个区块链公布他的签名。

Why do we need a block chain with hash pointers in addition to having Scrooge sign each block?
As long as someone is monitoring the latest hash pointer published by Scrooge, the change will be obvious and easy to catch.
A block chain makes it easy for any two individuals to verify that they have observed the same history of transactions signed by Scrooge.

  • 为什么采用一个带有哈希指针的区块链?
    哈希指针: 方便人们察觉到到当前区块链发生的变化。
    区块链:方便人们查看交易的纪录。
1.5.2.1 Two kinds of transactions in Scrogecoin

CreateCoins
to make new coins.
Datastructure:
(serial number, value, recipent)
BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction
TransID: to represent a transaction
num: Each coin has a serial number in the transaction.
value: it’s worth a certain number of scroogecoins.
recipient: a public key that gets the coin.

PayCoins
It consumes some coins (i.e., destroys them) and creates new coins of the same total value.
So if you’re the owner of one of the coins that’s going to be consumed in this transaction, then you need to digitally sign the transaction to say that you’re OK with spending this coin.
BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction

The problem here is centralization.much of the early research on cryptosystems assumed there would indeed be some central trusted authority.
The minting of new coins also needs to be decentralized. If we can solve these problems, then we can build a currency that would be like Scroogecoin but without a centralized party. In fact, this would be a system much like Bitcoin.文章来源地址https://www.toymoban.com/news/detail-419158.html

  • 这个系统存在一个问题,即中心化。所有的交易都需要由Scrooge签名,Scrooge类似于现实中的政府。这个系统需要去中心化,则就有了比特币的概念。

到了这里,关于BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES - chapter 1 -Introduction的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 使用verdaccio搭建私有组件库

    最近公司需要根据现有的公用组件搭建一套私有组件库,方便其他项目使用,然后经过一系列尝试和走了许多坑,终于搭建成功了,这里记录下搭建步骤,希望对你有些帮助。 由于公司组件库越来越多,导致每次去基础库里面cv组件特别麻烦,特别是还有这些组件有一些其他

    2024年02月03日
    浏览(46)
  • js遍历对象key,value

    方法一:转化为操作数组forEach遍历 遍历对象属性 关于Object.keys()方法 Object.keys() 方法会返回一个由一个给定对象的自身可枚举属性组成的数组,数组中属性名的排列顺序和正常循环遍历该对象时返回的顺序一致。 例子 遍历对象属性值 关于Object.values()方法 object .values()静态方

    2024年02月11日
    浏览(34)
  • neovim下进行接口测试,并且登录token自动保存

    neovim下进行接口测试,并且登录token自动保存 最近一段时间最大的乐趣就是用自己配置的neovim写go代码, 现在用go代码写的接口,一开始用curl测试接口,感觉不是很方便。 就尝试能否在neovim发起接口测试。 功夫不负有心人,找到了一个插件rest.nvim。记录下安装和自己定制的

    2024年02月02日
    浏览(33)
  • .NET Core/.NET6 使用DbContext 连接数据库,SqlServer

    安装以下NuGet包 Microsoft.EntityFrameworkCore.SqlServer:SQL server 需要添加包 Microsoft.EntityFrameworkCore.Tools Newtonsoft.Json:用于Json格式转换 创建一个实体类来表示数据库表。在项目中创建一个名为Customer.cs的文件,并添加以下代码 创建一个数据库上下文类,用于定义实体类和数据库连接

    2024年02月07日
    浏览(39)
  • 云计算:Linux 部署 OVS 集群(控制端)实现OpenFlow

    目录  一、实验 1.环境 2.Linux 部署 OVS 集群(控制端) 3.控制端对接服务端OVS网元 4.服务端OVS添加流表 5.服务端删除OVS 二、问题 1. ODL如何查找已安装插件 2.查看流表显示不全 3.如何删除OVS流表 (1) 主机 表1 宿主机 主机 架构 软件 IP 网卡 备注 ovs_controller 控制端 karaf 0.7.3 192.1

    2024年04月16日
    浏览(34)
  • 瑞_Java开发手册_(三)单元测试

    🙊前言:本文章为瑞_系列专栏之《Java开发手册》的单元测试篇。由于博主是从阿里的《Java开发手册》学习到Java的编程规约,所以本系列专栏主要以这本书进行讲解和拓展,有需要的小伙伴可以点击链接下载。本文仅供大家交流、学习及研究使用,禁止用于商业用途,违者

    2024年01月20日
    浏览(30)
  • 使用WebApi+Vue3从0到1搭建《权限管理系统》:二、搭建JWT系统鉴权

    视频地址:【WebApi+Vue3从0到1搭建《权限管理系统》系列视频:搭建JWT系统鉴权-哔哩哔哩】 https://b23.tv/R6cOcDO qq群:801913255 一、在appsettings.json中设置鉴权属性 二、新建模型 添加模型JwtSettingModel其中字段和appsettings.json中的字段一样,如下 三、新建解析appsettings.json节点的帮助类

    2024年04月22日
    浏览(29)
  • KUKA机器人通过3点法设置工作台基坐标系的具体方法

    具体方法和步骤可参考以下内容: 进入主菜单界面,依次选择“投入运行”—“测量”—基坐标,选择“3点法”, 在系统弹出的基坐标编辑界面,给基座标编号为3,命名为table1,然后单击“继续”按钮,进行下一步操作, 在弹出的参考工具界面上选择编号为1,名称为“

    2024年02月03日
    浏览(41)
  • Vue核心语法

    我们以前都是用的框架来搭建的,省去了很多内容,今天我们从原始的方式来使用vue,下面是下载地址 未使用响应式 我们把注释去掉 从上面的演示可以看到,没有用响应式的时候,如果我们要变更元素,需要处理数据的逻辑,还需要再次操作一下DOM,很繁琐 let、var、const

    2024年02月12日
    浏览(23)
  • GitHub Copilot怎么取消付费?

    GitHub Copilot非常好用,还没有使用过的同学可以参考教程白嫖一个月:【保姆级】VsCode 安装GitHub Copilot实操教程 GitHub Copilot每月10美元的费用对于一些用户来说可能是一笔不小的开销。如果你已经完成了GitHub Copilot的免费试用,并希望取消这个订阅以节省费用,下面我将为你提

    2024年04月27日
    浏览(23)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包