-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from jpmorganchase/features/PADLbn254
Features/pad lbn254
- Loading branch information
Showing
54 changed files
with
3,549 additions
and
2,110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pragma solidity ^0.8.19; | ||
/// @title Verification for proof of equivalence in transaction | ||
/// @author Applied research, Global Tech., JPMorgan Chase, London | ||
/// @notice This is an code for research and experimentation. | ||
|
||
struct BN254Point{ | ||
uint256 x; | ||
uint256 y; | ||
} | ||
|
||
abstract contract BNInterface { | ||
|
||
function add(BN254Point calldata point1, BN254Point calldata point2) public virtual returns (BN254Point memory ret); | ||
function mul(BN254Point calldata point1, uint256 scalar) public virtual returns (BN254Point memory ret); | ||
function neg(BN254Point calldata p) public virtual returns (BN254Point memory); | ||
} |
29 changes: 29 additions & 0 deletions
29
pyledger/contracts/Interfaces/ConsistencyProofInterface.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pragma solidity ^0.8.28; | ||
/// @title Verification for proof of equivalence in transaction | ||
/// @author Applied research, Global Tech., JPMorgan Chase, London | ||
/// @notice This is an code for research and experimentation. | ||
import "../Interfaces/BNInterface.sol"; | ||
|
||
struct consistencyProofSolR{ | ||
BN254Point t1; | ||
BN254Point t2; | ||
uint256 s1; | ||
uint256 s2; | ||
uint256 challenge; | ||
BN254Point pubkey; | ||
BN254Point cm; | ||
BN254Point tk; | ||
BN254Point chalcm; | ||
BN254Point chaltk; | ||
BN254Point s2pubkey; | ||
BN254Point s1g; | ||
BN254Point s2h; | ||
} | ||
|
||
abstract contract ConsistencyProofInterface { | ||
|
||
function getConsistencyHash(consistencyProofSolR memory prsol) public virtual returns(uint256); | ||
function pushPointToHash(bytes memory b, uint256 x, uint256 y) public virtual returns(bytes memory); | ||
function closeHash(bytes memory b) public virtual returns (uint256); | ||
function verify(consistencyProofSolR memory prsol) public virtual returns(bool); | ||
} |
21 changes: 21 additions & 0 deletions
21
pyledger/contracts/Interfaces/EquivalenceProofInterface.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
pragma solidity ^0.8.20; | ||
/// @title Verification for proof of equivalence in transaction | ||
/// @author Applied research, Global Tech., JPMorgan Chase, London | ||
/// @notice This is an code for research and experimentation. | ||
import "../Interfaces/BNInterface.sol"; | ||
import "../Interfaces/EquivalenceProofInterface.sol"; | ||
|
||
struct eqProofSolR{ | ||
BN254Point pk; | ||
BN254Point pktrand; | ||
uint256 chalrsp; | ||
} | ||
|
||
abstract contract EquivalenceProofInterface { | ||
|
||
function pushPointToHash(bytes memory b, uint256 x, uint256 y) public virtual returns(bytes memory); | ||
function closeHash(bytes memory b) public virtual returns (uint256); | ||
function getChallenge(eqProofSolR memory prsol, BN254Point memory h2r) public virtual returns (uint256); | ||
function verify(eqProofSolR memory prsol, BN254Point memory h2r) public virtual returns (bool); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/// @title Private and auditable transaction via on-chain verification | ||
/// @author Applied research, Global Tech., JPMorgan Chase, London | ||
/// @notice This is an code for research and experimentation. | ||
pragma solidity ^0.8.20; | ||
|
||
//import "../ZK_proof/bn254.sol"; | ||
//import {Bulletproof} from "../ZK_proof/RangeVerifier.sol"; | ||
//import {ConsistencyProofBN} from "../ZK_proof/ConsistencyProofBN.sol"; | ||
//import {EquivalenceProofBN} from "../ZK_proof/EquivalenceProofBN.sol"; | ||
//import {Rangeproof} from "../ZK_proof/RangeVerifier.sol"; | ||
import "../Interfaces/BNInterface.sol"; | ||
import "../Interfaces/RangeProofInterface.sol"; | ||
import "../Interfaces/ConsistencyProofInterface.sol"; | ||
import "../Interfaces/EquivalenceProofInterface.sol"; | ||
|
||
|
||
abstract contract PADLOnChainInterface { | ||
struct cmtk { | ||
BN254Point cm; | ||
BN254Point tk; | ||
} | ||
|
||
struct txcell { | ||
BN254Point cm; | ||
BN254Point tk; | ||
BN254Point compcm; | ||
BN254Point comptk; | ||
eqProofSolR peq; | ||
consistencyProofSolR pc; | ||
consistencyProofSolR pc_; | ||
Rangeproof ppositive; | ||
} | ||
|
||
function isPermitted(address _add) public virtual returns (bool); | ||
function addRequests(address _add, string memory _zl, uint _amt) public virtual; | ||
function addParticipant(address _add) public virtual; | ||
function getTotalBalance() public virtual view returns (uint); | ||
function retrieveParticipant(uint i) public virtual view returns (address); | ||
function retrieveNumberOfParticipants() public virtual view returns (uint); | ||
function storePublicKey(string memory _pk, address _add) public virtual; | ||
function retrievePk(address _add) public virtual view returns (string memory); | ||
function retrieveAllPks() public virtual view returns (string memory); | ||
function retrieveZeroLine(address _add) public virtual view returns (string memory); | ||
function addZeroLine(string memory _zl, address _add) public virtual; | ||
function retrieveTxnLength() public virtual view returns(uint) ; | ||
function storeIntCMTK(cmtk[][] memory _p) public virtual; | ||
function addstorageidentifier(string memory _idnt) public virtual; | ||
function retrieveCommitsTokens() public virtual returns(cmtk[][] memory); | ||
function retrieveIdentifier() public virtual returns(string memory); | ||
function voteTxn() public virtual; | ||
function checkTxnApproval() public virtual returns(bool); | ||
function resetVotes() public virtual; | ||
function updateState() public virtual; | ||
function approveTxn() public virtual; | ||
function approveTxnIssuer() virtual public ; | ||
function clearTxn() public virtual; | ||
function retrieveTxn(uint i) public virtual returns(string memory); | ||
function setGovRules(string memory gov) virtual public ; | ||
function retrieveGovarnenceRules() public virtual returns(string memory); | ||
function addZeroLineToState(cmtk [] memory zls) public virtual; | ||
function retrieveStateId(uint256 p) public virtual returns (cmtk[] memory); | ||
function processTx(txcell[] memory ctx, uint256 asset_id) public virtual returns (bool); | ||
function checkSenderCell(txcell memory ctxid, address add, BN254Point memory h2rd) public virtual returns (bool); | ||
function checkReceiverCell(txcell memory ctx) public virtual returns (bool); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
/// @title Verification for proof of equivalence in transaction | ||
/// @author Applied research, Global Tech., JPMorgan Chase, London | ||
/// @notice This is an code for research and experimentation. | ||
//import "./bn254.sol"; | ||
import "../Interfaces/BNInterface.sol"; | ||
//import {BN254} from "./bn254.sol"; | ||
|
||
struct Rangeproof{ | ||
BN254Point A; | ||
BN254Point S; | ||
BN254Point T1; | ||
BN254Point T2; | ||
uint256 tau_x; | ||
uint256 miu; | ||
uint256 tx; | ||
uint256 a_tag; | ||
uint256 b_tag; | ||
BN254Point G; | ||
BN254Point H; | ||
BN254Point Com; | ||
BN254Point[5] L; | ||
BN254Point[5] R; | ||
BN254Point[32] g_vec; | ||
BN254Point[32] h_vec; | ||
// BN254Point[32] yi_vec; | ||
} | ||
|
||
abstract contract RangeProofInterface { | ||
function verify_range_proof(Rangeproof calldata proof) public virtual returns (bool); | ||
} |
Oops, something went wrong.