IT |
気になる、記になる… |
ソニーのヘッドホン「WH-XB910N」の後継モデルの製品画像や一部仕様が明らかに ー 「WH-CH520」の製品画像も流出 |
https://taisy0.com/2023/02/10/168328.html
|
stevehemme |
2023-02-09 15:24:44 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
nvm 使用方法 |
https://qiita.com/zhangpeng/items/863fc764730935796ba2
|
nvmnodeversionmanager |
2023-02-10 00:52:30 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
【メモ】WebSocket使ってみた |
https://qiita.com/mojapico/items/a48f2aff4a08cffb4829
|
javascriptvarconnectionne |
2023-02-10 00:30:21 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
Gitでフォルダ/ファイル名の大文字小文字を区別させる方法 |
https://qiita.com/chemicalist11/items/0ef42e4b9973e61c37ff
|
linux |
2023-02-10 00:48:45 |
海外TECH |
Ars Technica |
The next Zelda game is Nintendo’s first $70 Switch title |
https://arstechnica.com/?p=1916406
|
basis |
2023-02-09 15:41:22 |
海外TECH |
Ars Technica |
Autopilot had no involvement in fatal Texas Tesla crash, NTSB says |
https://arstechnica.com/?p=1916402
|
crash |
2023-02-09 15:25:55 |
海外TECH |
MakeUseOf |
How to Upscale Your Old Videos With MadVR for Windows |
https://www.makeuseof.com/upscale-old-videos-madvr-windows/
|
windows |
2023-02-09 15:15:16 |
海外TECH |
MakeUseOf |
Get The Best Samsung Galaxy S23 Ultra Case Deals |
https://www.makeuseof.com/best-samsung-galaxy-s23-ultra-case-deals/
|
ultra |
2023-02-09 15:08:55 |
海外TECH |
MakeUseOf |
Intel U vs. P vs. H Laptop CPUs: What's the Difference? |
https://www.makeuseof.com/intel-u-vs-p-vs-h-laptop-cpus/
|
Intel U vs P vs H Laptop CPUs What x s the Difference Checking how a CPU should perform on a laptop isn t as straightforward as it is on a desktop but that doesn t mean it should be complicated |
2023-02-09 15:05:16 |
海外TECH |
MakeUseOf |
A Beginner's Guide to BeReal, the Hottest New Social Media App |
https://www.makeuseof.com/guide-to-bereal-social-media-app/
|
platform |
2023-02-09 15:05:16 |
海外TECH |
DEV Community |
pyaction 4.16.0 Released |
https://dev.to/cicirello/pyaction-4160-released-mac
|
pyaction Released TL DRI just released pyaction a Docker container with Python git and the GitHub CLI Changelog ChangedBumped Python to Bumped GitHub CLI to Current Version ListThis latest release of pyaction includes Python GitHub CLI git curl gpg More InformationFor more information see my earlier post about pyaction here on DEV as well as pyaction s GitHub repository pyaction A Docker container with Python git and the GitHub CLI Vincent A Cicirello・Dec ・ min read github docker python devops cicirello pyaction A base Docker image for Github Actions implemented in Python pyactionA base Docker image for Github Actions implemented in PythonDocker Hub GitHubImage StatsBuild StatusLicenseSupport SummaryThis Docker image is designed to support implementing Github Actionswith Python As of version it starts withthe official python docker image as the basewhich is a Debian OS It specifically uses python slim to keep the image sizedown for faster loading of Github Actions that use pyaction On top of thebase we ve installed curlgpg git and theGitHub CLI We added curl and gpg because theyare needed to install the GitHub CLI and they may come in handy anyway especially curl when implementing a GitHub Action Blog Post on DEV pyaction A Docker container with Python git and the GitHub CLI posted on December Multiplatform ImageVersion and Newer pyaction supports the following… View on GitHub Where You Can Find MeFollow me here on DEV Vincent A CicirelloFollow Researcher and educator in A I algorithms evolutionary computation machine learning and swarm intelligence Follow me on GitHub cicirello cicirello My GitHub Profile Vincent A CicirelloSites where you can find me or my workWeb and social media Software development Publications If you want to generate the equivalent to the above for your own GitHub profile check out the cicirello user statisticianGitHub Action View on GitHubOr visit my website Vincent A Cicirello Professor of Computer Science Vincent A Cicirello Professor of Computer Science at Stockton University is aresearcher in artificial intelligence evolutionary computation swarm intelligence and computational intelligence with a Ph D in Robotics from Carnegie MellonUniversity He is an ACM Senior Member IEEE Senior Member AAAI Life Member EAI Distinguished Member and SIAM Member cicirello org |
2023-02-09 15:25:31 |
海外TECH |
DEV Community |
Liman MYS üzerinde network-API ayağa kaldırma |
https://dev.to/aciklab/liman-mys-uzerinde-network-api-ayaga-kaldirma-4gbe
|
Liman MYS üzerinde network API ayağa kaldırmaLiman arayüzüaçılır Menüye girilir “ Sunucu Ekle butonuna tıklanır ilk defa ekleme yaparken “Tüm sunucularıgör butonuna tıklanır ikinci ve daha fazla sunucuyu eklerken Sunucular sayfasında yeşil Sunucu Ekle butonuna tıklanır Açılan ekranda ulaşacağınız Sunucunun IP adresi veya DNS kaydındaki adresi yazılır Sunucunun portu girilir ör SSH WinRM Active Directory Samba BağlantıyıKontrol Et diyerek ilgili porttan ağerişimi bulunmakta ise “Sunucuya başarıyla erişim sağlandı mesajıalınır ve bir sonraki adıma geçilir Sunucuyu Liman MYS üzerinde görülmek istenen isim girilir Makinenin işletim sistemine göre GNU Linux veya Microsoft Windows seçilir AyarlarıOnayla diyerek “İsim onaylandı mesajıalınır ve bir sonraki adıma geçilir Anahtar kullanılacaksa “Bir Anahtar Kullanmak İstiyorum butonunu seçilir Kullanıcıadıve Şifre kısmına rehber dahilinde kullanıcıadıve şifre girilir “AyarlarıOnayla butonuna tıklanır “Anahtarınız doğrulandı mesajıalınır ve Özet sekmesine geçilir Özet sekmesinde eklenecek olan sunucunun özeti listelenir “Sunucuyu Ekle butonuna tıklayarak sunucu eklenir Eklenen sunucunun üzerine tıklanır ve Eklentiler sekmesine girilir Yeşil butonuna basılarak var olan Network eklentisi eklenir Sunucuya eklenen NETWORK eklentisine tıklanır ve NETWORK eklenti ayarlarısayfasında istenen veriler doldurulur ve yeşil Kaydet butonuna tıklanır Zabbix kurulumu için buraya bakılabilir Network Api paketi Zabbix in kurulu olduğu makineye aktarılır Network Api yüklenir sudo dpkg i network api deb opt network api env example dosyasının içerisine girilir DB NAME dbname DB USER dbuser ZABBIX URL http zabbix IP Adresi zabbix api jsonrpc php bilgileri güncellenir Değişiklikler sonrasında aşağıdaki adımlarıizleyerek veritabanında user database ve şifre oluşturulur sudo u postgres psqlKullanıcıOluşturma sudo u postgres createuser lt username gt Bizim örneğimizde karşılığıdbuser olarak belirlenmiştir Database Oluşturma sudo u postgres createdb lt dbname gt Bizim örneğimizde karşılığıdbname olarak belirlenmiştir Kullanıcıya Şifre Verme sudo u postgres psqlpsql alter user lt username gt with encrypted password lt password gt Bu örnekte şifre olarak güncellendi Database de Ayrıcalıklar Verme psql grant all privileges on database lt dbname gt to lt username gt Bu adımlardan sonra tekrardan opt network api env example dosyasının içerisine gidilir ve yenilenen şifre girilerek güncellenir Örneğe göre DB PASS olarak güncellendiSon olarak network api yi tekrar başlatmak için systemctl restart network apikomutu girilir Aktif olup olmadığınıkontrol etmek için de systemctl status network apikomutu girilir Liman arayüzüne geri dönülür network api alanına http Zabbix IP Adresiniz eklenir |
2023-02-09 15:19:18 |
海外TECH |
DEV Community |
Build and Deploy NodeJS App On Kubernetes from Scratch |
https://dev.to/lovepreetsingh/build-nodejs-app-on-kubernetes-from-scratch-66g
|
Build and Deploy NodeJS App On Kubernetes from ScratchWhenever we build our applications Initially we do not care about writing scalable or Non SPOF Single point of failure Applications But It is always a good practice to think about the Design Scalability and Availability of your WebApp To Handle Scalability we have many techniques like Microservices Deploying multiple instances using Docker and using Load Balancers Yes You read it right Containerizing your app alone is not sufficient It needs more than that Container Management is one of the main task This is where Kubernetes comes Kubernetes does automate the container management deployment and scaling our apps in a broader way ContainersContainers is a kind of way to package all of your app with dependencies so that It can run the app independent of the platform 🥲If it is not clear Don t worry you will catch up soon when you will go ahead in this Blog Node Follow this Repo for code Our Dockerfile looks like this Getting node imageFROM node alpine setting up your working directoryWORKDIR app copying package json filesCOPY package json package lock json running npm inside the docker container and installing dependenciesRUN npm install production copying everything into the docker environmentCOPY exposing portEXPOSE running node app on port CMD node index js🫣Just one thing here to point out is that Docker build its file layer by layer Each line in the Dockerfile is represented as a layer over the other So that next time when you ll build the Dockerfile then it would take only the changes CommandsRun docker build t your dockerhub name node app command to build the image To Run the container Run command docker run rm d p your dockerhub name node app to run docker container in the background Now container must be running and check localhost to view your app your dockerhub name refers to the name that you used or is showing on your Docker Desktop Dashboard after logging in Note If you want to run elsewhere or share with others You need to register it first To Push your image to Docker IO run the command docker push your docker name node app KubernetesIt is a Container orchestration tool which does manage deploy and scale the containers To create Kubernetes clusters you can use Digital Ocean Amazon Web Services etc ️We will use KubeCTL to interact with Kubernetes You can read more about Kubernetes BTS working here Now to demonstrate the Kubernetes deployment on localhost we will use minikube which mimics the behaviour of Kubernetes mentioned in the Kubernetes BTS Working Follow the stepsRun Commandscurl LO sudo install minikube darwin arm usr local bin minikubeBefore Starting MiniKube Open your Docker Desktop to run the Docker in the background If minikube fails to start then Kindly install VM from here After all that Run the command minikube start Now Run the commandkubectl create deployment node app image your dockerhub name node appNote Run kubectl describe deployment node app to see the status of your image runningType the following command to see the pod statusNow Run the following commands to forward your portIt will forward the request at port to the pod running at Now If you curl or request on port You will get the response You did it That was it for today We wrote this blog taking beginners into the count Now further we can explore How to run Kubernetes Pods on AWS Digital ocean or any other cloud Provider Remember Cloud is nothing but someone else s machine running at some location of the world So deployment of docker image in the pod will follow the same process technically on any cloud provider Try by yourself and let us know in the comments |
2023-02-09 15:11:49 |
海外TECH |
DEV Community |
A beginner's intro to coding zero-knowledge proofs |
https://dev.to/spalladino/a-beginners-intro-to-coding-zero-knowledge-proofs-c56
|
A beginner x s intro to coding zero knowledge proofsZero knowledge proofs are becoming increasingly popular but it can be a hard space to navigate and find the resources to get started as a developer After spending some time studying the topic I m compiling here what I learned in hope it helps others Note from the title that this is a beginner s guide as in its author me being a beginner on ZKP programming so please reach out if you find anything off in this article This article will cover what a zero knowledge proof is how it is used from a developer s perspective and go through a few languages for writing them It will not go through the underlying math we ll treat ZKPs as a cryptographic black box What is a zero knowledge proof A zero knowledge proof ZKP for short is a cryptographic proof about a fact that does not reveal any info about said fact A classic example to introduce ZKPs is that I the prover can prove to you the verifier that I know a valid coloring for a graph without revealing it To do it we play a game where I color the graph using a random set of colors then cover it and you choose an edge at random If my coloring was valid then both nodes connected by that edge must have different colors Then we repeat with a different set of colors each time until you are satisfied Since I re paint the graph before every round you don t learn anything about the coloring but you can verify that it was valid every time Another well known example of what could be considered a ZKP is a digital signature I can produce a proof that I hold a secret string my private key that corresponds to a public one my public key by signing a message and that signature does not reveal any bits from my private key What is a zkSNARK SNARK stands for Succinct Non interactive ARgument of Knowledge The important bits here are the first two words succinct and non interactive A proof is succinct if it s well small This means that regardless of the complexity of the fact that we are proving we can keep proofs small and quick to verify This is what makes ZKPs attractive for building rollups you can generate a succinct proof that all operations that occurred on the L chain were valid succinct enough that you can verify it in a contract on L Protocols like Mina take this to the extreme with recursive proofs which allow them to prove the validity of the entire history of the chain with a constant size proof As for non interactivity just think how cumbersome it would be to deal with signatures if you needed the signer to be online every single time someone needed to verify it In the examples above the graph coloring proof was interactive requiring an online game between the prover and the verifier Fortunately zkSNARKs do not have this requirement ZKPs flavorsTurns out that zkSNARKs are not the only kind of interesting ZKPs There are also STARKs pioneered by Starwkare and used to power Starknet and Bulletproofs used in Monero These differ in the running time for generating and verifying a proof as well as the resulting proof size or in the need for trusted setups more on this in the next section MatterLabs has a great comparison between them here Even within SNARKs you ll find that there are multiple flavors Groth is one of the most popular The PLONK family which includes TurboPLONK and UltraPLONK can remove the need for a circuit specific trusted setup at the expense of proof generation and verification time or add support for new types of operations Furthermore there are different elliptic curves to pick from or different polynomial commitment schemes that can be used Consensys Gnark provides a great explainer on SNARK proving schemes and curves here Usually picking a ZKP language to work with will determine which ZK backend you end up using though there are some like Circom or Gnark that support more than a single proving system Trusted setupSome flavors of proving systems require what s called a trusted setup A trusted setup is a one time ceremony run by multiple participants which produces a set of random values that power the ZK proving system These ceremonies are critical because if all of its participants collude they can break the proving system Here breaking the proving system means being able to generate a proof for an invalid claim that gets accepted by the verifier Fortunately having just one honest participant does the trick that s why you ll find calls for as many community members as possible to participate in such a ceremony Certain flavors like Groth require a trusted setup for each circuit this means that for every program you code you need to run a new ceremony Others like PLONK need just one universal trusted setup that can be reused on any program built with that flavor And others like STARKs don t need any trusted setup at all ConstraintsThe main thing you need to know about ZKPs internals is that the proof operates on a mathematical constraint system In other words prover engines do not deal with code like x y z but with constraints of the form x y z Depending on the language you re working with and the prover backend these may impact how you structure your code For instance Circom only allows you to write quadratic expressions on your variables whereas Halo lets you write polynomial constraints of any degree As we ll see later one of the outputs of compiling a program in a ZKP language will be the set of constraints This has the implication that certain operations are easier to represent in a ZKP than others addition can be represented in a single constraint whereas bit manipulation may require hundreds as every bit may need to be represented as a separate variable This is the reason why specific cryptographic primitives are typically chosen when working on ZKPs As an example Pedersen hashes are hash functions that can be represented in an arithmetic circuit much more efficiently than keccak so they are frequently found in ZKPs Finite fieldsAnother important bit you need to know is that constraints operate in a finite field of a size determined by the underlying elliptic curve What this means is that all arithmetic operations are computed modulo a certain value meaning they will wrap around that value Don t worry though this value is usually large enough For instance in Circom it is This also means that if you want to define specific thresholds for your integer variables you ll need to add extra constraints for it Some languages like Noir will do it for you whereas others will require you to do it manually Why all the buzz ZKPs have drawn a lot of attention lately The main reason is that they can be used as a means to cheaply verify any computation effectively becoming a general purpose cryptographic building block Gubhseep describes ZKPs as programmable cryptography in the sense that you can use them to program cryptographic proofs for general problems For instance you could prove set membership using ring signatures which are specifically built to tackle that problem or just coding a zkSNARK circuit for it In the Devcon panel on Zero Knowledge there s a great point made about their power in enabling interoperability across different systems once you have a system that can verify a ZKP then you can verify that any other system with any computational environment behaved as expected as long as you can express its computation as a ZKP This is what powers zk rollups if you can write the rules of your chain as a ZKP then you can push that proof to Ethereum and verify it on the EVM even if your rollup doesn t use the EVM as an execution environment What does a circuit look like Let s now look into how all this works The first step is to write a program in your ZK language or framework of choice such as Circom Halo or Noir These programs are often referred to as circuits which express constraints among your set of variables or signals For example we can build a circuit in Circom that lets us prove that we know two numbers a and b such that c a b without revealing them template MultiplierSq signal input a signal input b signal ab signal output c ab lt a b c lt ab ab Here we are defining two private input signals an intermediate variable and an output value Note that since Circom does not allow us to write anything more complex than quadratic constraints we cannot directly write c lt a b that s why we need the intermediate ab signal Creating and verifying a proofThe workflow for using a ZKP circuit is not the same as a regular program since we have two different agents the prover and the verifier And even within the prover there are multiple steps involved to generate the proof Let s go through them We first write and compile the circuit This outputs several artifacts such as the set of constraints defined by the circuit and a script or binary to be used in the step below Depending on the SNARK flavor being used it may be necessary to run a trusted setup ceremony to generate the proving and verifying keys which are cryptographic material required for the proving and verifying process as their names imply When interacting with our zk app the user enters the private and public inputs for the circuit The first step is to execute the circuit as if it were a program using the script or binary generated during compilation This calculates the values for all intermediate and output variables given the input In the example above given a and b it will calculate that ab and c This assignment of every signal to its concrete value is called a witness or trace Given the trace from step and the proving key from step the prover can now generate a zero knowledge proof that all the constraints defined in the circuit hold and only reveals the output value c This proof can now be sent to the verifier The verifier using the submitted proof and the verifying key can now verify that the proof is correct for its public output In our examples the verifier can cryptographically check that the prover knows three values a b ab such that a b ab and ab ab c where c Keep in mind that the verification step is cheap so the verifier can be run as an EVM smart contract This allows to trustlessly verify any off chain computation that can be expressed as a ZKP If you want to try out the workflow above yourself I strongly reccomend Circom s getting started guide that will take you through the necessary steps In Circom compiling a circuit will output a WASM or a C program that computes the witness as well as a RCS representation that together with the trusted setup ceremony outputs the proving and verifying keys Then in order to generate the proof you supply the calculated witness and the proving key To verify it just use the generated proof along with the verifying key You can also autogenerate a Solidity contract for running the verification on chain Execution vs constraintsIn the workflow above you may have noted that the circuit is used twice by the prover first to generate the witness and then to derive the constraints that are covered by the proof These two runs are completely different beasts and understanding their difference is one of the keys to understanding how ZKPs work Let s go back to our Circom example from before where we had two instructions ab lt a b c lt ab ab In Circom a fat arrow is just syntax sugar for two different instructions assignment and constrain so the above can be expanded to ab lt a bab a bc lt ab abc ab abThe a lt a b instructions means during the execution phase assign a b to ab and gets ignored when compiling the constraints On the other hand ab a b means add a constraint that forces ab to be equal to a b which gets ignored during execution In other words when writing a circuit you re writing two different programs that belong to two different programming paradigms in a single one While you will usually write assignments and constraints that are equivalent sometimes you need to split them up A good example of this is the IsZero circuit The IsZero circuitWriting a circuit that outputs if an input signal is zero and otherwise is surprisingly difficult when you are constrained pun intended to just quadratic expressions If you are thinking of using an expression like x note that that will not return a boolean on whether x is zero or not but instead it will constrain the signal x to be zero in this circuit Fortunately Circom has a library of useful building blocks that includes an IsZero circuit that returns or depending on whether the input is zero and looks like this template IsZero signal input in signal output out signal inv inv lt in in out lt in inv out in inv in out This is a good example of decoupling execution and constraints in a circuit Let s begin analyzing the constraints The constraint in out tells us that in or out is zero If in is zero then out in inv so we re good And if out is zero then it follows that in inv which means that in cannot be zero Great But note that the actual value of inv never popped up in our reasoning since we did not need it This is valid for writing constraints but when it comes to populating the trace it falls short We need to tell Circom how to calculate the value for inv in the witness generation phase that s where the inv lt in in expression comes in Cairo appropriately calls this sort of expressions hints Note that we re using operations much more complex than a quadratic expression here we have a conditional a comparison and a division This is because the execution phase is unrelated to the constraints and as such is not bound by the restrictions of generating a ZKP So we are back to pretty much usual programming when working in the execution phase having access to additional operators control flow statements or even auxiliary functions Underconstrained computation bugsHowever this difference between execution and constraint generation phases can open the door to a very nasty kind of bugs Going back to the IsZero example what would have happened if we forgot to write one of the constraints say the in out one Let s follow the workflow we know assuming in as input The circuit would have compiled fine since there are no errors Witness generation would have followed the execution instructions and correctly calculated the values inv out The prover would have generated a proof based on the witness and the public output since the constraint out in inv holds The verifier would have accepted it as valid trusting that the prover has a private non zero value So far so good But what happens if a malicious prover wants to convince us that they have a zero value when they actually have in The malicious user can manually craft a witness where in inv out Since the witness satisfies the constraint out in inv the prover can generate a proof for it The verifier happily accepts it and believes that the user has a zero value when they actually don t This kind of issues dubbed under constrained computation are particularly hard to catch Any unit test that treats the circuit as a black box would never trigger them as they use the circuit s execution logic to build the witness which will pass the constraints The only way to reproduce them is to manually assemble a witness with custom logic which requires that you exactly know the attack you are looking for Alternatively there are efforts for verifying the soundness of a circuit you ve written with regard to the function you want to encode such as Ecne whcih I still have to try out The bottom line here is that you should be particularly careful when you write execution code separate from your constraint generation code since it opens the door to underconstrained ZK programs A real world exampleTornado Cash is a great learning resource on how to build a real world zk app with Circom circuits I strongly recommend going through the page long white paper as well as Gubsheep s breaking down Tornado Cash session from the xparc course plus Porter s overview of the white paper The gist of Tornado in case you are not familiar with it is that you can deposit ETH in discrete amounts there are notes of and ETH into a contract and later anonymously withdraw each note into other addresses This has the effect of mixing your notes with those from other people granting anonimity as long as there is enough usage How does it work For the sake of the explanation we ll go through a slightly simplified version of the protocol and follow Gubsheep s version instead of the one actually implemented Whenever a user wants to deposit a note they generate a secret value s and submit their ETH note along with a hash of the secret H s to the contract The contract collects all submitted secret hashes into a merkle tree and stores its root R Now when a user wants to withdraw their note they need to prove that they have the secret that corresponds to H s To do this the user submits a ZKP that shows that they know a private value s such that H s is in the merkle tree of root R It is not revealed which of all the leaves of the tree is the user s H s as the ZKP only public output is R so this preserves anonimity The merkle proof is checked by a circuit in the ZKP We also need a way to ensure that a user cannot withdraw the same note twice Here is where the concept of nullifier comes in A nullifier is a value deterministically generated from the original secret that is tracked to prevent double spends So in addition to proving membership to the merkle tree of root R the ZKP also outputs a value G s to be used as a nullifier where G is another hash function different to H Then whenever a note is withdrawn its nullifier is added to a nullifier set in the smart contract and the withdrawn is rejeted if it already exists Note that G needs to be different to H otherwise the ZKP would reveal H s which can be traced back to the original deposit and break anonimity In other words whenever a user wants to withdraw they submit a ZKP that states that they know a secret value that s in a merkle tree of root R and exposes the nullifier of that secret value Then the contract can check that the merkle root matches and the nullifier hasn t been used it If you went through Tornado s white paper you ll note that the nullifier concept is where their implementation diverges from what we described here Tornado actually uses two different secret values called randomness r and nullifier k and the public value they store is called the nullifier hash Tornado also uses a single hash function Pedersen hashes instead of two different ones and they compute the merkle tree leaf as H r k and the nullifier hash as H k The important thing is that the nullifier cannot be linked back to the merkle tree leaf and that it is deterministically generated from the secret You can check out Tornado s full circuits in Circom here Languages for ZKPsThere are multiple languages and frameworks that you can choose from for writing ZK circuits either general purpose like Circom or specific to a certain platform like Cairo I have tried out three different languages Circom Halo and Noir and implemented the same circuit to compare them The circuit proves that the user knows the results of a private set of rock paper scissors matches such that the total score matches a public output The score is calculated as specified in the definition of advent of code day which I used for inspiration for the problem Your total score is the sum of your scores for each round The score for a single round is the score for the shape you selected for Rock for Paper and for Scissors plus the score for the outcome of the round if you lost if the round was a draw and if you won What follows is an overview of each language my personal impression of it and how the rock paper scissors circuit looks like in it Keep in mind I m a beginner in all of them so there may be errors Please reach out if you find any so I can fix this article Other languages and frameworks I still have to try out are Zokrates Cairo SnarkyJS Gnark and Leo I hope to update this post as I go through them CircomI found Circom to be the best language to start learning ZKPs as suggested by CyberPorter To me Circom has the ideal level of abstraction for learning not too high level that it abstracts away some of the quirks of ZKP and not too low level that you get bogged down in annoying details It also has been around for quite some time modulo how new everything ZK is so you can find more documentation and samples as well as the awesome Circom workshops from xparc Last but not least there is circomlib a library of common building blocks for Circom Circom ships with a rust based compiler CLI plus an npm package for trusted setups and proof generation and verification The benefit of having an npm package is that you can generate proofs in the browser opening the door to building zk apps You can also autogenerate Solidity contracts for verifying proofs on chain Circom also lets you to choose your proving engine between Groth and PLONK As mentioned before in Circom you work assembling circuits where each circuit has a set of input internal and output signals Circuits are defined as templates which can be parameterized with values known at compile time which are similar to C function templates Circom also has the concept of functions as a reusable building block in the execution phase The main challenges are Circom is understanding when you are writing constraint generation code and when you are writing witness generation code and tracking what values are known at compile time versus only known at runtime Many language constructs are only available for witness generation like boolean or comparison operators or can only depend on values known at compile time such as control flow statements Also keeping in mind the difference between constraint and witness generation times can guard you against underconstrained computation bugs Rock paper scissors in CircomThe circuits for the rock paper scissors problem were fun to write in Circom Since it s not possible to write conditional expressions in constraints you need to resort to math based tricks As a simple example the first circuit which validates the input of a play by checking that it is or looks like this template AssertIsRPS signal input x signal isRP lt x x isRP x The code for calculating the score of a single round uses similar constructs along with the IsEqual circuit from CircomLib Returns the score for a single round given the plays by x and ytemplate Round signal input x y signal output out ensure that each input is within AssertIsRPS x AssertIsRPS y check if match was a draw signal isDraw lt IsEqual x y signal diffYX lt y x y wins if y x mod signal yWins lt diffYX diffYX signal yWins lt IsZero yWins x wins if y x mod signal xWins lt diffYX diffYX signal xWins lt IsZero xWins check that exactly one of xWins yWins isDraw is true we probably can do without these constraints signal xOrYWins lt xWins yWins xOrYWins isDraw xWins yWins isDraw score is if y wins if draw if x wins plus depending on the choice of RPS out lt yWins isDraw y Finally the outermost circuit loops through a parameterizable number of rounds n and aggregates all scores Note that a loop can be used here since it depends on n which is a template parameter known at compile time template Game n signal input xs n signal input ys n signal scores n signal output out var score for var i i lt n i scores i lt Round xs i ys i score scores i out lt score HaloHalo is not a language but a Rust based framework maintained by the ZCash team Halo is specific to PLONKish giving you very direct control of how circuits are represented in the arithmetization This makes Halo very low level but ideal for writing highly optimized circuits To me Halo had the steepest learning curve by far Not just because of having to understand how PLONKish arithmetization works to build the circuits but mostly because I found Halo s API quite complex and its documentation hard to find There are also few resources for learning Halo the best I found were the xparc course which provides a few really valuable code samples as well as the examples in the main repo You may also want to check out awesome halo for updated resources When starting with Halo keep in mind that there are two flavors of the framework out there the vanilla one maintained by ZCash and the fork by Ethereum s Privacy and Scaling Explorations team which uses a different polynomial commitment KZG instead of IPA that s more friendly for Ethereum PLONKish arithmetizationThe key to building circuits in Halo is to begin by designing how the underlying PLONKish matrix will look like In PLONKish circuits are defined over a matrix that you directly define This matrix is composed by multiple columns where a column may represent a public output called instance a private witness value called advice a constant value called fixed a flag on whether a constraint is enabled called selector more on this below or a lookup value used for lookup tables an advanced feature Once you have the matrix set up it s time to define the polynomial constraints using gates A gate in Halo defines one or more constraints to be applied over a set of cells in the matrix Each gate is controlled via a selector column if the selector is enabled at a row then the constraints imposed by the gate relative to that row will be enforced A gate can define constraints across multiple rows For example here s an example of an L shaped multiplication gate straight out of the Halo book meta create gate mul meta To implement multiplication we need three advice cells and a selector cell We arrange them like so a a s mul lhs rhs s mul out Gates may refer to any relative offsets we want but each distinct offset adds a cost to the proof The most common offsets are the current row the next row and the previous row for which Rotation has specific constructors let lhs meta query advice advice Rotation cur let rhs meta query advice advice Rotation cur let out meta query advice advice Rotation next let s mul meta query selector s mul Finally we return the polynomial expressions that constrain this gate For our multiplication gate we only need a single polynomial constraint The polynomial expressions returned from create gate will be constrained by the proving system to equal zero Our expression has the following properties When s mul any value is allowed in lhs rhs and out When s mul this constrains lhs rhs out vec s mul lhs rhs out In the code sample above a and a are advice solumns and s mul is the selector that defines whether the mul multiplication gate will be enforced If it is then the value for a in the next row will be constrained to be equal to the product of a and a on the current row In addition Halo allows you to define equality constraints where you require that a specific cell in your matrix must be equal to another This is useful for copying values across your matrix or for constraining a public instance cell to equal a specific private advice cell in order to expose a value As another example you could define a circuit for proving the N th Fibonacci number where row i of the matrix has the values x i x i x i This means you d need three advice columns to begin with let s call them a b c Then you d constrain c to be equal to a b in the same row using a gate which requires adding a selector column for controlling it And you d have to set up equality constraints so that a and b are equal to b and c from the previous row Last in order to expose the N th number as a public value you d need an instance column constrained to equal the value of c at the last row Chips gadgets and regionsThe main building blocks for circuits in Halo are gadgets and chips Chips are the lowest level unit A chip will typically expose a method for configuring its gates as well as multiple methods for assigning values to its cells during synthesis more on this phase below You can also build chips composed out of other chips Gadgets on the other hand operate at a higher level of abstraction hiding the underlying chips implementation details though you can build your circuits directly out of chips and skip gadgets altogether To promote reusability you ll notice that chips always operate over relative offsets This allows multiple chips to be grouped into regions in a circuit Once all regions and their shapes have been defined it is the responsibility of a floor planner to arrange these regions on the matrix so you don t need to directly define where each chip is actually placed However depending on how you structure your circuits it is perfectly possible to pack everything into a single region and not delegate placement to the planner Halo Rust APIIn Halo similar to Circom the main thing to keep in mind is that your code will be invoked multiple times in different circumstances whether it is to configure the matrix generate the constraints create a proof or calculate a witness Your circuits need to implement a specific Circuit trait that defines methods that will be called throughout this lifecycle either with concrete or unknown Values pub trait Circuit lt F Field gt type Config Clone type FloorPlanner FloorPlanner fn without witnesses amp self gt Self fn configure meta amp mut ConstraintSystem lt F gt gt Self Config fn synthesize amp self config Self Config layouter impl Layouter lt F gt gt Result lt Error gt The important bits here are configure and synthesize The TLDR is that configure will set up the matrix shape and its gates and synthesize will calculte the witness and populate the matrix with the corresponding values However synthesize may also be invoked with unknown values during other stages so you need to always work with wrapped Values For instance and while it may seem anti intuitive polynomial constraints in gates are defined during configuration but equality constraints are set up at synthesis The example in the Halo book has a good step by step on how to implement a simple circuit with a single chip in case you need a scaffold to follow Rock paper scissors in HaloThe RPS implementation in Halo is much more verbose than in Circom so we ll only reproduce some parts here To begin with the matrix is set up with the following columns An advice column for each of the two players xs and ys where the value in row i represents what move the player chose in round i A third advice column accum that tracks the accumulated total score so row i contains the sum of the scores of all rounds up to i A public instance column where the last cell is constrained to be equal to the value of accum so only the total score is revealed and not the intermediate ones A selector for enabling the single gate that validates inputs and calculates the score of each round The main chip defines a custom gate that packs all constraints for each round validating that inputs are in range and calculating the score for the round and adding it to the accumulated total score This chip uses the values of xs ys and accum in a row as inputs and outputs the new score in the accum column at the next row meta create gate round meta let s meta query selector selector let x meta query advice col x Rotation cur let y meta query advice col y Rotation cur let accum meta query advice col accum Rotation cur We store the output in the accum column in the next row let out meta query advice col accum Rotation next Constraints for each round vec out y wins is draw y accum s clone out y wins expr F from is draw expr F from y clone const val accum x in s clone x clone x clone const val x clone const val y in s clone y clone y clone const val y clone const val The y wins and is draw above are IsZero chips defined like the following Note that we can reuse the same selector column for all constraints since there is no row in which we would want to enable some but disable others yWins lt gt y x y x let y wins IsZeroChip configure meta meta meta query selector selector meta let x meta query advice col x Rotation cur let y meta query advice col y Rotation cur y clone const val x clone y const val x When synthesizing the circuit we loop over the inputs for each round calculate the accumulated score and assign the calculated values to our matrix Note that for the execution mode we can directly use conditional expressions to calculate the score Assign one row per roundfor row in N let x y xs row ys row Enable the selector for the round gate self config selector enable amp mut region row This is requiring us to add a constant column to the chip config just with zeros if row region assign advice from constant zero col accum F ZERO Set x and y advice columns to the input values region assign advice format x row col x row x region assign advice format y row col y row y Assign the is zero chips to the same expressions defined in the gates yWins lt gt y x y x let y wins chip IsZeroChip construct y wins clone let y wins value y Value known F from x y Value known F ONE x let y wins y wins chip assign amp mut region row y wins value isDraw lt gt y x let is draw chip IsZeroChip construct is draw clone let is draw value y x let is draw is draw chip assign amp mut region row is draw value Calculate the score of this round let round score y wins zip is draw and then y wins is draw let partial score if y wins else if is draw else Value known F from partial score y Value known F ONE Assign the col accum in the next row to the new score accum value accum value round score out cell region assign advice format out row col accum row accum value The last bit is exposing the total score as a public output of the circuit by constraining the instance column to match the accum one in the last row of the matrix layouter constrain instance out cell cell self config instance N NoirNoir built by Aztec is the newest language of the pack and is under active development It is distributed as nargo a rust based CLI and as a set of npm packages The npm packages releases seem to lag slightly behind the crate which has the bleeding edge features and only got its first stable release a few days ago early February Both the rust crate and the npm package can be used to compile Noir programs generate and verify proofs and create a verifier Solidity contract Noir is heavily inspired in Rust as in it shares almost the same syntax It supports integer booleans tuples structs and arrays as well as a basic field type which represents an element in the native field of the proving backend think an unsigned int capped to a big prime of about bits and is more performant than regular integers Unlike Circom Noir does not allow you to define code used only for witness generation aka hints Noir supports control flow statements and operators out of the box and converts them to equivalent constraints as needed This helps prevent any unconstrained computation bugs at the expense of performance That said you can define constraints unrelated to witness generation using the special constrain keyword Rock paper scissors in NoirNoir feels a bit like cheating compared to the other languages since it abstracts away most complexities related to ZKPs and feels like writing regular Rust code The entirety of the program fits in lines and reads like a regular program global N Field builtin arraylen fn len lt T gt input T gt comptime Field fn round x Field y Field gt Field constrain x as u lt constrain y as u lt let mut score let diffYX y x if x y score if diffYX diffYX score score y fn main xs Field N ys Field N gt pub Field let mut result for i in len xs result result round xs i ys i result It s worth mentioning that I didn t run any analysis regarding the number of constraints generated by each language but it is expected that Noir given its higher abstraction level produces a higher number of constraints which impact proving time Nevertheless as the compiler matures more optimizations should be added that get automatically incorporated to Noir written programs ResourcesIf you got to this point and want to keep learning here are some of the resources I used for getting up to speed with ZKPs I encourage you to go through them if you want to learn directly from the masters CyberPorter produced a set of classes that provide a great overview of ZKPs including the motivation a mapping of the space and who s working on it a deep dive on TornadoCash an overview of Circom Cairo SnarkyJS and Noir and a walkthrough of the math behind Groth xPARC has two full courses online one on Circom and another on Halo I strongly recommend starting with the Circom one led mostly by the great Gubsheep the guy behind the Dark Forest game These courses include hands on workshops that take you step by step on how to build several circuits If you want to take a stab at Halo I d say they are a must see since there are not many other resoruces on it Vitalik has multiple blog posts on pretty much every cryptographic concept you need for understanding SNARKs and STARKs as well as interesting uses for the tech If you want to go deeper into the workings of ZKPs search on his blog first The Scroll team who are building a ZK EVM run an excellent educational blog when it comes to ZKPs In particular the article on proof generation provides a great step by step on the whole workflow involved when creating a ZKP Awesome lists are awesome and Matter Labs the team behind zkSync keeps an awesome zero knowledge proofs with links to all kind of resources |
2023-02-09 15:11:03 |
Apple |
AppleInsider - Frontpage News |
FPW OWC Thunderbolt Go Dock review: Ditch the big power brick |
https://appleinsider.com/articles/23/02/09/fpw-owc-thunderbolt-go-dock-review-ditch-the-big-power-brick?utm_medium=rss
|
FPW OWC Thunderbolt Go Dock review Ditch the big power brickOWC s Thunderbolt Go Dock offers excellent connectivity for road warriors without the need for a giant external power brick but its port selection is a little low for the price OWC Thunderbolt Go DockIf you have to move a MacBook Pro between locations and you need to have a more extensive selection of ports than what Apple includes you have a few options Read more |
2023-02-09 15:53:41 |
Apple |
AppleInsider - Frontpage News |
New Canon EOS R8 is a 24MP full-frame mirrorless camera |
https://appleinsider.com/articles/23/02/09/new-canon-eos-r8-is-a-24mp-full-frame-mirrorless-camera?utm_medium=rss
|
New Canon EOS R is a MP full frame mirrorless cameraCanon is launching a new full frame mirrorless camera called the EOS R that features a megapixel sensor EOS RThe EOS R is ideal for portraits events and landscape photography with its MP full frame CMOS sensor It s also suitable for capturing moving subjects with a reduced rolling shutter that enables fps continuous shooting and low noise high ISO of up to Read more |
2023-02-09 15:28:58 |
海外TECH |
Engadget |
How to watch Super Bowl 2023 |
https://www.engadget.com/how-to-watch-super-bowl-2023-100019021.html?src=rss
|
How to watch Super Bowl An estimated two thirds of the US population watched the Super Bowl last year and it didn t even have Rihanna Super Bowl will take place in Glendale Arizona at the State Farm Stadium on Sunday February th with a kick off time of pm Mountain or pm Eastern pm Pacific The Philadelphia Eagles will play against the Kansas City Chiefs to see who takes home the Lombardi trophy this year Whether you show up for the snacks the halftime show or actual football here are all of the ways to watch Super Bowl Who s airing the Super Bowl this year Fox will televise the game this year and have confirmed it will air in K as the network did in Airing rights to the Super Bowl rotate annually between broadcasters and since the game has alternated between CBS Fox and NBC ABC will get a turn in As it s Fox s year you can watch the game on local Fox broadcast stations and on Fox channels offered through your cable or satellite TV provider including Fox Sports and the Spanish language Fox Desportes You can also watch through certain live TV streaming services and the NFL app on mobile If you re watching outside the US here is a list of international channels that will carry the game How to watch with cable or satellite TVIf you already pay for cable you re set Even basic cable services include access to your local Fox channel and most also include Fox Sports both of which will air the game You can find your local Fox channels here Having a cable or satellite subscription also means you can log into the standalone Fox Sports app and watch via your smart TV or computer How to watch Super Bowl without cableFor those who ve cut the cord live TV streaming offers a bunch of ways to watch A few but not all of those services will let you watch the Super Bowl this year Here s a list of providers that carry Fox Sports along with their monthly subscription fees Sling Blue per month first monthYouTube with Live TV per monthHulu with Live TV per monthFuboTV Pro tier per monthDirecTV Stream Entertainment tier per monthSling TV is the cheapest way to watch the game with live streaming and the channel lineup confirms access to Fox Sports with their Blue package Many of these services also include a free trial period so you could sign up before the game and cancel afterwards to avoid a charge How to watch the Super Bowl on mobileIf it s just you watching and you re thinking of using your smartphone or tablet NFL is an over the top subscription app that s per month or for the NFL season which ends with the Super Bowl We should note that the app won t work on a TV and doesn t support casting so this is only a good option if you were already planning on watching on mobile How to watch the Super Bowl for freeLocal Fox stations will broadcast the Super Bowl over the airwaves and access is free provided you have a way to receive the signal Indoor HD digital antennas are available for between and These devices plug into your RF connection input the coaxial port on your TV and tend to work best when placed in a window They re not all that beautiful to look at and there is an initial cost but they do give you the ability to grab content out of the air for almost free |
2023-02-09 15:30:41 |
海外TECH |
Engadget |
Lucid tries to keep pace with rivals with a $7,500 'EV credit' |
https://www.engadget.com/lucid-air-discount-ev-152755988.html?src=rss
|
Lucid tries to keep pace with rivals with a x EV credit x Lucid s luxury Air electric vehicle exceeds the thresholds for federal tax credits but the company is still offering what it s calling an “EV credit Until March st those who buy certain configurations of Lucid Air Touring and Air Grand Touring models will be able to save up quot We think our customers still deserve a credit for choosing an EV quot Zak Edson the company s vice president of sales and service said in a statement quot With this limited time offer we hope to get Lucid Air into the hands of even more customers so they can experience the best for themselves quot Under the Inflation Reduction Act the federal tax credit applies to electric cars sedans and wagons priced under SUVs are eligible if the sticker price is under All Lucid Air models exceed those limits as the base Pure variant starts at Even so that model is not eligible for Lucid s so called credit The Lucid Air Touring starts at and the Grand Touring version starts at While a discount will always be welcome it gives buyers savings of under seven percent That s a far cry from Tesla being able to effectively drop the price of a five seat Model Y Long Range by almost a third from with the help of tax credits Tesla slightly increased the price earlier this month While Lucid is operating in a different market to rivals that sell more moderately priced EVs it seems like the company is doing what it can to keep up with the tax credits that they re eligible for |
2023-02-09 15:28:16 |
海外TECH |
CodeProject Latest Articles |
wexCommerce - Open Source eCommerce Platform on Next.js |
https://www.codeproject.com/Articles/5346666/wexCommerce-Open-Source-eCommerce-Platform-on-Next
|
platform |
2023-02-09 15:07:00 |
海外TECH |
CodeProject Latest Articles |
Summation of series with convergence acceleration |
https://www.codeproject.com/Articles/5353031/Summation-of-series-with-convergence-acceleration
|
mathematical |
2023-02-09 15:02:00 |
金融 |
RSS FILE - 日本証券業協会 |
株券等貸借取引状況(週間) |
https://www.jsda.or.jp/shiryoshitsu/toukei/kabu-taiw/index.html
|
貸借 |
2023-02-09 15:30:00 |
金融 |
金融庁ホームページ |
審判期日の予定を更新しました。 |
https://www.fsa.go.jp/policy/kachoukin/06.html
|
期日 |
2023-02-09 16:00:00 |
金融 |
金融庁ホームページ |
(株)ディー・ディー・エスにおける有価証券報告書等の虚偽記載に対する課徴金納付命令の決定について公表しました。 |
https://www.fsa.go.jp/news/r4/shouken/20230208-1.html
|
有価証券報告書 |
2023-02-09 16:00:00 |
金融 |
金融庁ホームページ |
第146回自動車損害賠償責任保険審議会 議事要旨を公表しました。 |
https://www.fsa.go.jp/singi/singi_zidousya/gijiyosi/20230120.html
|
自動車損害賠償責任保険 |
2023-02-09 16:00:00 |
金融 |
金融庁ホームページ |
第146回自動車損害賠償責任保険審議会 議事録を公表しました。 |
https://www.fsa.go.jp/singi/singi_zidousya/gijiroku/20230120.html
|
自動車損害賠償責任保険 |
2023-02-09 15:59:00 |
金融 |
金融庁ホームページ |
第145回自動車損害賠償責任保険審議会 議事要旨を公表しました。 |
https://www.fsa.go.jp/singi/singi_zidousya/gijiyosi/20230113.html
|
自動車損害賠償責任保険 |
2023-02-09 15:58:00 |
金融 |
金融庁ホームページ |
第145回自動車損害賠償責任保険審議会 議事録を公表しました。 |
https://www.fsa.go.jp/singi/singi_zidousya/gijiroku/20230113.html
|
自動車損害賠償責任保険 |
2023-02-09 15:57:00 |
ニュース |
BBC News - Home |
Burt Bacharach, one of pop's greatest songwriters, dies aged 94 |
https://www.bbc.co.uk/news/entertainment-arts-64587070?at_medium=RSS&at_campaign=KARANGA
|
prayer |
2023-02-09 15:35:16 |
ニュース |
BBC News - Home |
Lee Anderson: New Tory deputy chairman would support return of death penalty |
https://www.bbc.co.uk/news/uk-politics-64580487?at_medium=RSS&at_campaign=KARANGA
|
anderson |
2023-02-09 15:06:17 |
ニュース |
BBC News - Home |
Burt Bacharach obituary: Classy and complex songs that transcended an era |
https://www.bbc.co.uk/news/entertainment-arts-11573995?at_medium=RSS&at_campaign=KARANGA
|
compositions |
2023-02-09 15:07:33 |
ニュース |
BBC News - Home |
Lee Anderson: The outspoken Tory deputy chair |
https://www.bbc.co.uk/news/uk-politics-64582994?at_medium=RSS&at_campaign=KARANGA
|
controversial |
2023-02-09 15:02:17 |
ニュース |
BBC News - Home |
Sarina Wiegman: England's Euros-winning manager shortlisted for Fifa Best Award |
https://www.bbc.co.uk/sport/football/64582785?at_medium=RSS&at_campaign=KARANGA
|
Sarina Wiegman England x s Euros winning manager shortlisted for Fifa Best AwardEngland manager Sarina Wiegman named as one of three finalists in the women s coach category at the Fifa Best Awards |
2023-02-09 15:11:54 |
コメント
コメントを投稿