-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PhantomGate: NFT gated event check-in system #22
Open
ankit875
wants to merge
9
commits into
AztecProtocol:main
Choose a base branch
from
ankit875:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
326297a
initial nft commit
ankit875 7808f71
add nft interaction of the gated system
ankit875 ff8a1d7
fix ui for the NFT Page
ankit875 d8beed9
fix build issue
ankit875 dd087d3
add demo video
ankit875 aeea6fa
add few changes in UI and update demo link
ankit875 d309f61
code cleanup
ankit875 0de8f54
update readme
ankit875 e340c57
add event_management contract
ankit875 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
node_modules | ||
.env | ||
|
||
contracts/counter/target |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Ankit Agrawal | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,83 @@ | ||
# Private NFT-Gated Event Check-in System on Aztec | ||
|
||
## Overview | ||
|
||
`PhantomGate` implements a private NFT-gated event check-in system on Aztec Network, allowing users to prove their NFT ownership without revealing their identity or specific NFT details. The system verifies NFT ownership at specific block heights while maintaining privacy through zero-knowledge proofs. We will also provide minting the nft. | ||
|
||
## System Architecture | ||
|
||
## Challenge Selection | ||
|
||
- [ ] ZKEmail Guardian | ||
- [x] Social Cipher | ||
|
||
## Video Demo | ||
|
||
https://drive.google.com/file/d/18d6teeO3AaEkc0og0u-o10yNMIXbd_-V/view?usp=sharing | ||
|
||
### Components | ||
|
||
#### 1. Client-Side (PXE) | ||
- Aztec.js integration for client interactions | ||
- Private execution environment for NFT ownership verification | ||
- Zero-knowledge proof generation for NFT ownership | ||
- User interface for check-in process | ||
|
||
|
||
#### 2. Smart Contracts | ||
- Event management contract (public state)- (WIP) | ||
- NFT verification contract (private state) | ||
- Portal contract for Ethereum NFT communication - (WIP) | ||
|
||
#### 3. Public VM | ||
- Processes rollups of private check-ins | ||
- Maintains public event statistics | ||
- Handles state transitions | ||
|
||
### Flow Diagram | ||
|
||
``` | ||
User (with NFT) -> PXE (Private Verification) -> Aztec Contract | ||
-> Portal Contract | ||
-> Ethereum NFT Contract | ||
``` | ||
|
||
### Local Installation | ||
```bash | ||
# Clone the repository | ||
git clone https://github.com/ankit875/alpha-build2/phantom-gate | ||
|
||
cd phantom-gate | ||
|
||
# Install dependencies | ||
yarn install | ||
|
||
|
||
# Start development server | ||
yarn run dev | ||
``` | ||
|
||
```bash | ||
# Go to contract Directory | ||
cd contracts/nft_contracts | ||
|
||
# Compile contracts | ||
aztec-nargo compile | ||
|
||
# Generate Artifacts | ||
aztec codegen target --outdir ../../src/artifacts | ||
``` | ||
|
||
|
||
## License | ||
MIT License | ||
|
||
## Contact | ||
- Discord Server: ankitagrwal | ||
- Twitter: @ankitagrwal | ||
- Email: [email protected] | ||
|
||
## Acknowledgments | ||
- Aztec Network Team | ||
- Discord API Documentation | ||
- Community Contributors |
Binary file not shown.
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,9 @@ | ||
[package] | ||
name = "account" | ||
type = "contract" | ||
authors = [""] | ||
compiler_version = ">=0.33.0" | ||
|
||
[dependencies] | ||
aztec = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "aztec-packages-v0.60.0", directory = "noir-projects/aztec-nr/aztec" } | ||
authwit = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "aztec-packages-v0.60.0", directory = "noir-projects/aztec-nr/authwit" } |
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,6 @@ | ||
{ | ||
"account-SchnorrAccount.json": { | ||
"contractName": "SchnorrAccount", | ||
"hash": "b260fbc8dd255d7045c8821152dc627bb7130bbcaf85ca7724a62e26a324e161" | ||
} | ||
} |
149 changes: 149 additions & 0 deletions
149
phantom-gate/contracts/account/src/artifacts/SchnorrAccount.ts
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,149 @@ | ||
|
||
/* Autogenerated file, do not edit! */ | ||
|
||
/* eslint-disable */ | ||
import { | ||
type AbiType, | ||
AztecAddress, | ||
type AztecAddressLike, | ||
CompleteAddress, | ||
Contract, | ||
type ContractArtifact, | ||
ContractBase, | ||
ContractFunctionInteraction, | ||
type ContractInstanceWithAddress, | ||
type ContractMethod, | ||
type ContractStorageLayout, | ||
type ContractNotes, | ||
decodeFromAbi, | ||
DeployMethod, | ||
EthAddress, | ||
type EthAddressLike, | ||
EventSelector, | ||
type FieldLike, | ||
Fr, | ||
type FunctionSelectorLike, | ||
L1EventPayload, | ||
loadContractArtifact, | ||
type NoirCompiledContract, | ||
NoteSelector, | ||
Point, | ||
type PublicKey, | ||
PublicKeys, | ||
type UnencryptedL2Log, | ||
type Wallet, | ||
type WrappedFieldLike, | ||
} from '@aztec/aztec.js'; | ||
import SchnorrAccountContractArtifactJson from '../../target/account-SchnorrAccount.json' assert { type: 'json' }; | ||
export const SchnorrAccountContractArtifact = loadContractArtifact(SchnorrAccountContractArtifactJson as NoirCompiledContract); | ||
|
||
|
||
|
||
/** | ||
* Type-safe interface for contract SchnorrAccount; | ||
*/ | ||
export class SchnorrAccountContract extends ContractBase { | ||
|
||
private constructor( | ||
instance: ContractInstanceWithAddress, | ||
wallet: Wallet, | ||
) { | ||
super(instance, SchnorrAccountContractArtifact, wallet); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Creates a contract instance. | ||
* @param address - The deployed contract's address. | ||
* @param wallet - The wallet to use when interacting with the contract. | ||
* @returns A promise that resolves to a new Contract instance. | ||
*/ | ||
public static async at( | ||
address: AztecAddress, | ||
wallet: Wallet, | ||
) { | ||
return Contract.at(address, SchnorrAccountContract.artifact, wallet) as Promise<SchnorrAccountContract>; | ||
} | ||
|
||
|
||
/** | ||
* Creates a tx to deploy a new instance of this contract. | ||
*/ | ||
public static deploy(wallet: Wallet, signing_pub_key_x: FieldLike, signing_pub_key_y: FieldLike) { | ||
return new DeployMethod<SchnorrAccountContract>(PublicKeys.default(), wallet, SchnorrAccountContractArtifact, SchnorrAccountContract.at, Array.from(arguments).slice(1)); | ||
} | ||
|
||
/** | ||
* Creates a tx to deploy a new instance of this contract using the specified public keys hash to derive the address. | ||
*/ | ||
public static deployWithPublicKeys(publicKeys: PublicKeys, wallet: Wallet, signing_pub_key_x: FieldLike, signing_pub_key_y: FieldLike) { | ||
return new DeployMethod<SchnorrAccountContract>(publicKeys, wallet, SchnorrAccountContractArtifact, SchnorrAccountContract.at, Array.from(arguments).slice(2)); | ||
} | ||
|
||
/** | ||
* Creates a tx to deploy a new instance of this contract using the specified constructor method. | ||
*/ | ||
public static deployWithOpts<M extends keyof SchnorrAccountContract['methods']>( | ||
opts: { publicKeys?: PublicKeys; method?: M; wallet: Wallet }, | ||
...args: Parameters<SchnorrAccountContract['methods'][M]> | ||
) { | ||
return new DeployMethod<SchnorrAccountContract>( | ||
opts.publicKeys ?? PublicKeys.default(), | ||
opts.wallet, | ||
SchnorrAccountContractArtifact, | ||
SchnorrAccountContract.at, | ||
Array.from(arguments).slice(1), | ||
opts.method ?? 'constructor', | ||
); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Returns this contract's artifact. | ||
*/ | ||
public static get artifact(): ContractArtifact { | ||
return SchnorrAccountContractArtifact; | ||
} | ||
|
||
|
||
public static get storage(): ContractStorageLayout<'signing_public_key'> { | ||
return { | ||
signing_public_key: { | ||
slot: new Fr(1n), | ||
} | ||
} as ContractStorageLayout<'signing_public_key'>; | ||
} | ||
|
||
|
||
public static get notes(): ContractNotes<'PublicKeyNote'> { | ||
return { | ||
PublicKeyNote: { | ||
id: new NoteSelector(2806681024), | ||
} | ||
} as ContractNotes<'PublicKeyNote'>; | ||
} | ||
|
||
|
||
/** Type-safe wrappers for the public methods exposed by the contract. */ | ||
public declare methods: { | ||
|
||
/** compute_note_hash_and_optionally_a_nullifier(contract_address: struct, nonce: field, storage_slot: field, note_type_id: field, compute_nullifier: boolean, serialized_note: array) */ | ||
compute_note_hash_and_optionally_a_nullifier: ((contract_address: AztecAddressLike, nonce: FieldLike, storage_slot: FieldLike, note_type_id: FieldLike, compute_nullifier: boolean, serialized_note: FieldLike[]) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; | ||
|
||
/** constructor(signing_pub_key_x: field, signing_pub_key_y: field) */ | ||
constructor: ((signing_pub_key_x: FieldLike, signing_pub_key_y: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; | ||
|
||
/** entrypoint(app_payload: struct, fee_payload: struct, cancellable: boolean) */ | ||
entrypoint: ((app_payload: { function_calls: { args_hash: FieldLike, function_selector: FunctionSelectorLike, target_address: AztecAddressLike, is_public: boolean, is_static: boolean }[], nonce: FieldLike }, fee_payload: { function_calls: { args_hash: FieldLike, function_selector: FunctionSelectorLike, target_address: AztecAddressLike, is_public: boolean, is_static: boolean }[], nonce: FieldLike, is_fee_payer: boolean }, cancellable: boolean) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; | ||
|
||
/** lookup_validity(consumer: struct, inner_hash: field) */ | ||
lookup_validity: ((consumer: AztecAddressLike, inner_hash: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; | ||
|
||
/** verify_private_authwit(inner_hash: field) */ | ||
verify_private_authwit: ((inner_hash: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; | ||
}; | ||
|
||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there another readme that fleshout out some other sections from the readme template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like the component being built 👍