Compare commits
2 Commits
241907bc62
...
16006babb7
| Author | SHA1 | Date | |
|---|---|---|---|
| 16006babb7 | |||
| 33161daa00 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -96,6 +96,8 @@ Desktop.ini
|
||||
*.temp
|
||||
|
||||
# Project specific (for your snapshot collector)
|
||||
preclaims/*json
|
||||
!preclaims/.gitkeep
|
||||
snapshots/*.json
|
||||
!snapshots/.gitkeep # Optional: keep the directory but not the files
|
||||
|
||||
|
||||
25
README.md
25
README.md
@ -18,13 +18,15 @@ pip install web3 tqdm
|
||||
The Ghost Preclaim Snapshot Tool provides a straightforward command-line interface for collecting NFT snapshot data across multiple blockchain networks. Before running the tool, ensure you have properly configured your environment with the necessary RPC endpoints and network access credentials.
|
||||
|
||||
```bash
|
||||
python finder.py --rpc <RPC_URL> [--delay 0.3]
|
||||
```
|
||||
usage: finder.py [-h] --rpc RPC [--bonus BONUS] [--delay DELAY]
|
||||
|
||||
Parameters:
|
||||
```bash
|
||||
--rpc: EVM JSON-RPC endpoint URL
|
||||
--delay: (Optional) Delay between RPC requests in seconds (default: 0.3)
|
||||
EVM NFT Snapshot Collector for Ghostchain Preclaims
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--rpc RPC EVM JSON-RPC Node URL
|
||||
--bonus BONUS Additional JML ownership amounton top of the collateral (default: 6.9 CSPR)
|
||||
--delay DELAY Delay between RPC requests in seconds (default: 0.3)
|
||||
```
|
||||
|
||||
Example:
|
||||
@ -38,13 +40,20 @@ python finder.py --rpc https://sepolia.infura.io/v3/YOUR_KEY
|
||||
The Merkle proof generation module transforms raw snapshot data into cryptographically verifiable proofs that enable efficient and secure preclaim verification on the Ghostchain governance platform. This critical component ensures that only legitimate NFT holders can participate in governance decisions and claim their allocations.
|
||||
|
||||
```bash
|
||||
python forester.py --chain <CHAIN_NAME>
|
||||
usage: forester.py [-h] --network-id NETWORK_ID
|
||||
|
||||
Dynamic Merkle Tree for Ghost Preclaims
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--network-id NETWORK_ID
|
||||
EVM numeric Network ID to mix into preimage (e.g., 11155111)
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
python forester.py --chain 11155111
|
||||
python forester.py --network-id 11155111
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
@ -12,6 +12,7 @@ GMV_ADDRESS = "0x7EF911f8ef130F73D166468c0068753932357B17"
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser(description="EVM NFT Snapshot Collector for Ghostchain Preclaims")
|
||||
parser.add_argument("--rpc", required=True, help="EVM JSON-RPC Node URL")
|
||||
parser.add_argument("--bonus", default=6900000000000000000, help="Additional JML ownership amounton top of the collateral (default: 6.9 CSPR)")
|
||||
parser.add_argument("--delay", type=float, default=0.3, help="Delay between RPC requests in seconds (default: 0.3)")
|
||||
return parser.parse_args()
|
||||
|
||||
@ -101,7 +102,7 @@ def main():
|
||||
"index": current_index,
|
||||
"token_id": token_id,
|
||||
"address": owner,
|
||||
"shares": shares
|
||||
"shares": shares + args.bonus
|
||||
})
|
||||
|
||||
current_index += 1
|
||||
|
||||
@ -17,7 +17,8 @@ def parse_arguments():
|
||||
def keccak256(data: bytes) -> bytes:
|
||||
return keccak(data)
|
||||
|
||||
EMPTY_HASH = keccak256(b'')
|
||||
# prefix + empty bytes
|
||||
EMPTY_HASH = keccak256(b'\x00' + b'\x00' * 32)
|
||||
|
||||
def next_power_of_two(n: int) -> int:
|
||||
if n <= 1:
|
||||
@ -47,7 +48,7 @@ def generate_tree(raw_values, network_id):
|
||||
for item in raw_values:
|
||||
idx = item['index']
|
||||
preimage = generate_preimage(item['token_id'], item['address'], item['shares'], network_id)
|
||||
merkle_tree[idx] = keccak256(preimage)
|
||||
merkle_tree[idx] = keccak256(b'\x00' + preimage)
|
||||
|
||||
layer_start = 0
|
||||
current_layer_len = padded_leaves
|
||||
@ -59,7 +60,7 @@ def generate_tree(raw_values, network_id):
|
||||
left_bytes = merkle_tree[layer_index]
|
||||
right_bytes = merkle_tree[layer_index | 1]
|
||||
|
||||
combined = left_bytes + right_bytes
|
||||
combined = b'\x01' + left_bytes + right_bytes
|
||||
merkle_tree[write_ptr] = keccak256(combined)
|
||||
write_ptr += 1
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user