Compare commits

..

No commits in common. "16006babb76c7482e9ed88730360e00e792f19a3" and "241907bc62d4f768a07b54c06aefe795edffb38b" have entirely different histories.

4 changed files with 12 additions and 25 deletions

2
.gitignore vendored
View File

@ -96,8 +96,6 @@ 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

View File

@ -18,15 +18,13 @@ 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
usage: finder.py [-h] --rpc RPC [--bonus BONUS] [--delay DELAY]
python finder.py --rpc <RPC_URL> [--delay 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)
Parameters:
```bash
--rpc: EVM JSON-RPC endpoint URL
--delay: (Optional) Delay between RPC requests in seconds (default: 0.3)
```
Example:
@ -40,20 +38,13 @@ 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
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)
python forester.py --chain <CHAIN_NAME>
```
Example:
```bash
python forester.py --network-id 11155111
python forester.py --chain 11155111
```
Output:

View File

@ -12,7 +12,6 @@ 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()
@ -102,7 +101,7 @@ def main():
"index": current_index,
"token_id": token_id,
"address": owner,
"shares": shares + args.bonus
"shares": shares
})
current_index += 1

View File

@ -17,8 +17,7 @@ def parse_arguments():
def keccak256(data: bytes) -> bytes:
return keccak(data)
# prefix + empty bytes
EMPTY_HASH = keccak256(b'\x00' + b'\x00' * 32)
EMPTY_HASH = keccak256(b'')
def next_power_of_two(n: int) -> int:
if n <= 1:
@ -48,7 +47,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(b'\x00' + preimage)
merkle_tree[idx] = keccak256(preimage)
layer_start = 0
current_layer_len = padded_leaves
@ -60,7 +59,7 @@ def generate_tree(raw_values, network_id):
left_bytes = merkle_tree[layer_index]
right_bytes = merkle_tree[layer_index | 1]
combined = b'\x01' + left_bytes + right_bytes
combined = left_bytes + right_bytes
merkle_tree[write_ptr] = keccak256(combined)
write_ptr += 1