The task of a zero-knowledge proof system is to "prove a fact without revealing knowledge."
Let's start with an image:

There are numerous penguins in it. However, a puffin looks like a penguin (below).

The situation is that you know where this puffin is hiding, but you don't want to tell others exactly where it is. What can you do to prove to others that you know the puffin's location without giving away the exact location?
A simple solution is to take a plastic plate, leave a hole in it, but the whole picture behind the plate, and let the puffin point at the hole.

As long as you look through the hole, you can see the puffin.

Looking back at the process, you can see that although you did not point out the exact location of the puffin, nor did you give any explicit or implicit information, the observer can be sure that there is a puffin in the picture, and would believe that you know the location.
This is so-called "zero-knowledge proof".
Zero-knowledge proof refers to the ability of a prover to convince a verifier that an assertion is correct without providing any valuable information to the verifier. It is essentially an agreement involving two or more parties, i.e., a series of steps that two or more parties need to take to accomplish a task. In short, a zero-knowledge proof system performs the task of "proving a fact and not revealing knowledge."
The official definition is a bit awkward, so let's take a classic example to illustrate it in layman's terms.
Suppose you have one red ball and one green ball in your hand, and you have a friend who has red-green color blindness. You cannot tell him what color the two balls are, but you must convince him that they are two different colors. What would you do in this situation?
Solution:
First, place two balls in each of his hands and ask him to remember the colors of the balls in his left and right hands.
Then, have him place his hands behind his back and randomly decide whether or not to switch the balls in his hands.
He will then show you the balls in his hands and ask you to judge whether or not they have been switched.
When comparing the colors of the balls, you can tell whether he switched them behind his back. Your friend knows the number of times the balls have switched and can demonstrate whether or not your estimation is accurate.
Additionally, to eliminate randomness, you can repeatedly conduct many trials.
As long as you continue to make accurate assessments, you may demonstrate that the two balls are distinct colors.
You (the prover) do not reveal any specific information about the colors of the balls to him (the verifier) throughout the entire process of proof, and your friend is unable to determine the colors of the balls on his own; therefore, no useful information about the proven message is transmitted, and he accepts the claim that "the two balls are different colors."
The study of zero-knowledge proof first began in 1985 with the paper "The Knowledge Complexity of Interactive Proof-Systems" by MIT professors Shafi Goldwasser, Silvio Micali, and cryptography guru Charles Rackoff. This paper introduced the concept of "zero-knowledge proof", which has gradually become one of the foundations of modern cryptographic theories.
A working zero-knowledge proof system must contain three properties.
Completeness: If both the prover and the verifier are honest, and the proof process conforms to the rules and is correct, then the proof must be successful, and the prover will eventually convince the verifier.
Soundness: Only the prover can make the proof, and the prover can only convince the verifier whether the statement is true or not, and there is no way for the prover to convince the verifier by fraud.
Zero-knowledge: After the proof process is performed, the verifier only gets the information that "the prover has this knowledge", but not the knowledge itself.
Initially, the research on zero-knowledge proof was mainly conducted in academia, and researchers focused on the cryptography of block cryptography, stream cryptography, and public-key systems. However, with the development of the Internet, especially mobile applications, a large amount of information involving privacy is stored, exchanged, and computed on connected devices, inevitably resulting in a large amount of privacy information leakage and the prevalence of Internet fraud.
With privacy and security being a primary concern today, zero-knowledge proof has greater use. For example,
Protecting private data: When buying insurance, you want to prove that you have no family medical history, and you don't want to expose all the information about your case. Regardless of the information, you can replace the part you don't want to reveal with a zero-knowledge proof that looks like a random number, proving that the data is accurate and trustworthy while protecting privacy.
Authentication: When using a website, a user can prove to the website that he has a private key or knows some answer that only he/she knows. The website does not have to know the key but can confirm the user's identity through zero-knowledge proof. The server can prove to the user that the data is properly preserved and not compromised based on decentralized storage.
Computation compression and blockchain scaling: In the traditional block architecture, the exact computation is repeated many times, such as signature verification, legitimacy verification of transactions, brilliant contract execution, etc. Because with proof of computation, the same computation does not need to be repeated many times, and the zero-knowledge proof technology can compress the computation process.
Theoretically, any data stored today is bound to be leaked in the future, which is just a matter of time. All that can be done technically is to add difficulty to this data leakage so that it lacks immediacy and completeness when it is leaked, thus reducing its utilization value. For this aspect, a well-designed zero-knowledge protocol is a more promising solution. We recommend four mainstream zero-knowledge proof development libraries here and hope they will be helpful to readers.
libsnark: A zkSNARK scheme implementation developed by SCIPR Lab, developed in C++ and applied to several projects such as zcash.
snarkjs: A JavaScript implementation library for the zkSARNK scheme. With snarkjs you can perform trusted settings, generate evidence and verify the evidence.
bellman: A rust library for developing zk-SNARK circuits, which provides circuit interfaces, infrastructure, and basic circuit implementations such as Boolean and numerical abstractions.
pysnark: A zk-snark scheme implementation developed in Python that supports the Pinocchio protocol and supports the generation of smart contracts for Ethereum to verify zero-knowledge evidence.
我正在尝试使用moneygem在我的应用程序中处理货币,但我遇到了一个奇怪的错误。这是我的“记录”模型中的内容:composed_of:amount,:class_name=>"Money",:mapping=>[%w(centscents),%w(currencycurrency_as_string)],:constructor=>Proc.new{|cents,currency|Money.new(cents||0,currency||Money.default_currency)},:converter=>Proc.new{|value|value.respond_to?(:to
>>current_user.first_visit=>0>>ifcurrent_user.first_visit>>puts"test">>endtest=>nil为什么打印测试? 最佳答案 在Ruby中只有nil可以被认为是false的类比。没有假设0、""或[]表示false,因此您必须使用==0、.blank?、.empty?、.zero?等但是nil并不总是表现为false。例如,在字符串插值中,.to_s方法应用于#{}内容,它对FalseClass和NilClass的作用不同:irb(main)>"qwe#{false
我正在尝试用没有前导零的日期来格式化日期使用%d它工作正常,但前导零date_time.strftime("%d/%m/%y")result:04/01/11我搜索了一下,发现我应该使用%e而不是%d,但是执行以下操作会得到一个空字符串。date_time.strftime("%e/%m/%y")result:这跟Ruby的版本有关系吗?我在Windows机器上使用v1.8.7。更重要的是,是否有另一种方法可以在没有前导零的情况下完成一天(比gsub更方便)? 最佳答案 如果你想删除月份或日期的前导零,只需在格式前添加一个减号,如下
我有以下方法来计算平均值:defcompute_average(a,b,c,d,e)total=[a,b,c,d,e].sum.to_faverage=[a,2*b,3*c,4*d,5*e].sum/totalaverage.round(2)end这没什么特别的,但它有一个问题,我认为所有平均方程都有:如果输入全为零,它可能被零除。所以,我想到了这样做:defcompute_average(a,b,c,d,e)total=[a,b,c,d,e].sum.to_fiftotal==0average=0.00elseaverage=[a,2*b,3*c,4*d,5*e].sum/total
我正在寻找一种简洁的方法来检查一个值是零还是零。目前我正在做类似的事情:if(!val||val==0)#Isnilorzeroend但这看起来很笨拙。 最佳答案 对象有一个nil?method.ifval.nil?||val==0[dosomething]end或者,对于一条指令:[dosomething]ifval.nil?||val==0 关于ruby-"nilorzero"的最佳ruby习语,我们在StackOverflow上找到一个类似的问题:
Ruby的strftime是否具有不带前导零的月份格式?我发现%e的日期没有前导零,但月份没有任何运气。最终想要一个格式如下的日期:9/1/2010 最佳答案 某些版本的strftime确实允许使用前缀minus来格式化前导零,例如:strftime"%-d/%-m/%y"然而,这将取决于您系统上的strftime。所以为了保持一致性,我会做这样的事情:dt=Time.local(2010,'Sep',1)printf"%d/%d/%d",dt.day,dt.month,dt.year
我正在处理GooglemapKML图层点击事件。我正在使用这段代码:functioninitialize(){varmapOptions={center:newgoogle.maps.LatLng(41.875696,-87.624207),zoom:11,mapTypeId:google.maps.MapTypeId.ROADMAP};varmap=newgoogle.maps.Map(document.getElementById("map_canvas"),mapOptions);varctaLayer=newgoogle.maps.KmlLayer('https://sites
嘿,我是javascript的新手,使用一个文本框验证十进制数。示例格式应为66,00。但是如果用户键入66,0并且不在逗号后键入两个零,那么在离开文本框后它应该自动附加到它。这样它就是正确的格式。我怎样才能得到这个。我怎样才能追加??这是我的代码片段。functioncheck2(sender){varerror=false;varregex='^[0-9][0-9],[0-9][0-9]$';varv=$(sender).val();varindex=v.indexOf(',');varcharacterToTest=v.charAt(index+1);varnextCharAft
将监听器附加到KML图层:varlayer=newgoogle.maps.KmlLayer('http://sites.google.com/site/kmlprototypes/kmls/temp.kml?dc_='+Math.random(),{suppressInfoWindows:true,preserveViewport:true});layer.setMap(map);google.maps.event.addListener(layer,'click',function(obj){alert(obj.featureData.id);});KML文件有效(通过验证api检查
https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contractshttps://decentralize.today/introducing-perigord-golang-tools-for-ethereum-dapp-development-60556c2d9fd简单存储.sol:pragmasolidity^0.4.4;contractSimpleStorage{uintstoredData;functionset(uintx)public{storedData