{"id":20109985,"url":"https://github.com/distributed-lab/bulletproofs","last_synced_at":"2025-10-30T05:51:06.975Z","repository":{"id":224442490,"uuid":"763259036","full_name":"distributed-lab/bulletproofs","owner":"distributed-lab","description":"Bulletproofs++ implementation on Go","archived":false,"fork":false,"pushed_at":"2024-06-20T12:52:37.000Z","size":81,"stargazers_count":25,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-07T19:50:31.015Z","etag":null,"topics":["blockhain","bulletproofs","cryptography","zero-knowledge"],"latest_commit_sha":null,"homepage":"https://distributedlab.com/whitepaper/Bulletproofs-Construction-and-Examples.pdf","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/distributed-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-26T00:04:02.000Z","updated_at":"2025-05-16T02:17:04.000Z","dependencies_parsed_at":"2025-07-07T19:36:30.476Z","dependency_job_id":"24552269-0ba9-4aa3-95f7-85d8ed4b04d4","html_url":"https://github.com/distributed-lab/bulletproofs","commit_stats":null,"previous_names":["distributed-lab/bulletproofs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/distributed-lab/bulletproofs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Fbulletproofs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Fbulletproofs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Fbulletproofs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Fbulletproofs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/distributed-lab","download_url":"https://codeload.github.com/distributed-lab/bulletproofs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-lab%2Fbulletproofs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267612747,"owners_count":24115520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockhain","bulletproofs","cryptography","zero-knowledge"],"created_at":"2024-11-13T18:09:59.988Z","updated_at":"2025-10-30T05:51:06.879Z","avatar_url":"https://github.com/distributed-lab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bulletproofs++ implementation\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n⚠️ __Please note - this crypto library has not been audited, so use it at your own risk.__\n\n## Abstract\n\nPresent Go library contains the implementation of Bulletproofs++ weight norm linear argument protocol, arithmetic\ncircuit\nprotocol and reciprocal range proof protocol described in Distributed\nLab's [Bulletproofs++ Construction and Examples](https://distributedlab.com/whitepaper/Bulletproofs-Construction-and-Examples.pdf).\n\nExplore the [circuit_test.go](./circuit_test.go) to check the examples of circuit prove and verification.\nIt contains several circuits:\n\n- Prove that we know such `x, y` that `x+y=r` and `x*y=z` for public `r, z`. This example encoded directly into the BP++\n  circuits.\n- Prove the range for 4-bits value: `x` is in `[0..2^n)` range (simple binary range proof).\n\nAlso, [reciprocal_test.go](./reciprocal_test.go) contains example of proving that value lies in [0, 16^n) range.\n\nImplemented protocol has 2G points advantage over existing BP and BP+ protocols on proving of one 64-bit value and this\nadvantage will increase for more values per proof.\n\n| Protocol | G  | F |\n|----------|----|---|\n| BP       | 16 | 5 |\n| BP+      | 15 | 3 |\n| Our BP++ | 13 | 3 |\n\n## Reciprocal range proofs\n\nCheck the following snippet as an example of usage of range proof protocol:\n\n```go\npackage main\n\nimport (\n\t\"github.com/cloudflare/bn256\"\n\t\"github.com/distributed-lab/bulletproofs\"\n\t\"math/big\"\n)\n\nfunc main() {\n\t// The uint64 in 16-base system will be encoded in 16 digits. \n\t// The 16 base is selected as the most optimal base for this case.\n\n\t// Our private value is 0xab4f0540ab4f0540. \n\tx := uint64(0xab4f0540ab4f0540)\n\tX := new(big.Int).SetUint64(x)\n\n\t// Let's encode it as a list of digits:\n\tdigits := bulletproofs.UInt64Hex(x) // [0 4 5 0 15 4 11 10 0 4 5 0 15 4 11 10]\n\n\t// Public poles multiplicities i-th element corresponds to the 'i-digit' multiplicity (the count of 'i-digit' in digits list)\n\tm := bulletproofs.HexMapping(digits) // [4 0 0 0 4 2 0 0 0 0 2 2 0 0 0 2]\n\n\tNd := 16 // digits size\n\tNp := 16 // base size\n\n\tvar G *bn256.G1\n\t// Length of our base points vector should be a power ot 2 to be used in WNLA protocol. \n\t// So cause the real HVec size in circuit is `Nd+10` the nearest length is 32   \n\tvar GVec []*bn256.G1 // len = 16\n\tvar HVec []*bn256.G1 // len = 32\n\n\tpublic := \u0026bulletproofs.ReciprocalPublic{\n\t\tG:    G,\n\t\tGVec: GVec[:Nd],\n\t\tHVec: HVec[:Nd+10],\n\t\tNd:   Nd,\n\t\tNp:   Np,\n\n\t\t// Remaining points that will be used in WNLA protocol\n\t\tGVec_: GVec[Nd:],\n\t\tHVec_: HVec[Nd+10:],\n\t}\n\n\tprivate := \u0026bulletproofs.ReciprocalPrivate{\n\t\tX:      x,                // Committed value\n\t\tM:      m,                // Corresponding multiplicities\n\t\tDigits: digits,           // Corresponding digits\n\t\tS:      MustRandScalar(), // Blinding value (secret) used for committing value as: x*G + Sx*H\n\t}\n\n\tVCom := public.CommitValue(private.X, private.Sx) // Value commitment: x*G + Sx*H\n\n\t// Use NewKeccakFS or your own implementation for the Fiat-Shamir heuristics.\n\tproof := bulletproofs.ProveRange(public, bulletproofs.NewKeccakFS(), private)\n\n\t// If err is nil -\u003e proof is valid.\n\tif err := bulletproofs.VerifyRange(public, VCom, bulletproofs.NewKeccakFS(), proof); err != nil {\n\t\tpanic(err)\n\t}\n}\n\n```\n\n## Weight norm linear argument (WNLA)\n\nThe [wnla.go](./wnla.go) contains the implementation of **weight norm linear argument** protocol. This is a fundamental\nbasis for arithmetic circuit protocol. It uses the Fiat-Shamir heuristics from [fs.go](./fs.go) to generate challenges\nand make protocol non-interactive.\n\nCheck the following snippet with an example of WNLA usage:\n\n```go\npackage main\n\nimport (\n\t\"github.com/distributed-lab/bulletproofs\"\n\t\"math/big\"\n)\n\nfunc main() {\n\tpublic := bulletproofs.NewWeightNormLinearPublic(4, 2)\n\n\t// Private\n\tl := []*big.Int{big.NewInt(4), big.NewInt(5), big.NewInt(10), big.NewInt(1)}\n\tn := []*big.Int{big.NewInt(2), big.NewInt(1)}\n\n\tproof := bulletproofs.ProveWNLA(public, public.Commit(l, n), bulletproofs.NewKeccakFS(), l, n)\n\tif err := bulletproofs.VerifyWNLA(public, proof, public.Commit(l, n), bulletproofs.NewKeccakFS()); err != nil {\n\t\tpanic(err)\n\t}\n}\n\n```\n\n## Arithmetic circuit\n\nThe [circuit.go](./circuit.go) contains the implementation of BP++ arithmetic circuit protocol.\nIt runs the WNLA protocol as the final stages of proving/verification. Uses the Fiat-Shamir heuristics\nfrom [fs.go](./fs.go) to generate challenges\nand make protocol non-interactive.\n\nCheck the following snippet with an example of arithmetic circuit protocol usage:\n\n```go\npackage main\n\nimport (\n\t\"github.com/cloudflare/bn256\"\n\t\"github.com/distributed-lab/bulletproofs\"\n)\n\nfunc main() {\n\tpublic := \u0026bulletproofs.ArithmeticCircuitPublic{\n\t\tNm,\n\t\tNl, // Nl = Nv * K\n\t\tNv, // Size on any v witness vector\n\t\tNw, // Nw = Nm + Nm + No\n\t\tNo,\n\t\tK, // count of v witnesses vectors\n\t\tG,\n\n\t\t// points that will be used directly in circuit protocol\n\t\tGVec[:Nm],   // Nm\n\t\tHVec[:Nv+9], // Nv+9\n\n\t\t// Circuit definition \n\t\tWm, // Nm * Nw\n\t\tWl, // Nl * Nw\n\t\tAm, // Nm\n\t\tAl, // Nl\n\t\tFl,\n\t\tFm,\n\n\t\t// Partition function\n\t\tF: func(typ bulletproofs.PartitionType, index int) *int {\n\t\t\t// define\n\t\t\treturn nil\n\t\t},\n\n\t\t// points that will be used in WNLA protocol to make vectors 2^n len\n\t\tHVec[Nv+9:], // 2^x - (Nv+9) dimension\n\t\tGVec[Nm:],   // 2^y - Nm dimension\n\t}\n\n\tprivate := \u0026bulletproofs.ArithmeticCircuitPrivate{\n\t\tV,  // witness vectors v, dimension k*Nv\n\t\tSv, // witness blinding values, dimension k\n\t\tWl, // Nm\n\t\tWr, // Nm\n\t\tWo, // No\n\t}\n\n\t// Commitments to the v witness vectors\n\tV := make([]*bn256.G1, public.K)\n\tfor i := range V {\n\t\tV[i] = public.CommitCircuit(private.V[i], private.Sv[i], public.G, public.HVec)\n\t}\n\n\tproof := bulletproofs.ProveCircuit(public, bulletproofs.NewKeccakFS(), private)\n\n\tif err := bulletproofs.VerifyCircuit(public, V, bulletproofs.NewKeccakFS(), proof); err != nil {\n\t\tpanic(err)\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributed-lab%2Fbulletproofs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistributed-lab%2Fbulletproofs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributed-lab%2Fbulletproofs/lists"}