Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • carback1/xxwalletcheck
1 result
Show changes
Commits on Source (4)
...@@ -35,7 +35,6 @@ ENV/ ...@@ -35,7 +35,6 @@ ENV/
.DS_Store .DS_Store
# Project specific # Project specific
*.csv
*.log *.log
*.sqlite3 *.sqlite3
......
xxwalletcheck is a tool to check the balance of accounts in a CSV file against a Substrate chain. We use it to check on the current status of all the wallets from the public block audit, which includes all the official xx network addresses, including any addresses carried over from either BetaNet or via private sales that existed on the launch of the network.
To install, start by creating a virtual environment and installing the dependencies:
```
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
To run the script, use the following command:
```
python walletcheck/cli.py --rpc-url <substrate-rpc-url> --csv-file <path-to-csv-file> -o <path-to-output-file>
```
The script will read the CSV file, extract the account addresses, and check the balance of each account against the Substrate chain. The results will be written to the output file in CSV format with the following fields:
- `address`: the account address
- `starting_balance`: the balance from the CSV file
- `current_balance`: the balance from the Substrate chain
It makes a best effort attempt to keep the column names the same except that the balance columns are prefixed with "current_" or "starting_".
To run this script agains all the files in the data folder, you can use the following command:
```
ls -1 data | grep csv | while read -r i; do echo $i; walletcheck --rpc-url ws://finney:63007 -o "updated/$i" "data/$i"; done;
```
In this case, "ws://finney:63007" is the URL of the Substrate node that we are checking against. You can change this to the URL of any other Substrate node, like your local gateway node. You cannot do this against the public RPC endpoint because you will be rate limited and/or banned.
\ No newline at end of file
This diff is collapsed.
Name,Address,Amount
CanaryNet Allocation,6XmmXY7zLRirfHC8R99We24pEv2vpnGi29qZBRkdHNKxMCEB,8461480
Sale Allocation,6XmmXY7zLRihLPUmtcKEtvKTxtphzwGRb7YUjztiEYBUG545,244940685
Rewards Pool,6XmmXY7zLRirPixiSFxKNA54MYYFYajZMXeA6bo7cb95gPUR,250000000
Treasury,6XmmXY7zLRirfFQivNnn6LNyRP1aMvtzyr4gATsfbdFh2QqF,1
Rewards Pool 2,6XmmXY7v7NeGH3qiiZTQCRsp2bV3m5zNKAgohiNPE8uiprJ7,50000000
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File added
File added
...@@ -17,6 +17,8 @@ def extract_info_from_csv(file_path): ...@@ -17,6 +17,8 @@ def extract_info_from_csv(file_path):
balance_pairs = [] balance_pairs = []
new_fieldnames = reader.fieldnames.copy() new_fieldnames = reader.fieldnames.copy()
for header in reader.fieldnames: for header in reader.fieldnames:
if 'Coin' in header or 'coin' in header:
continue
if not any(keyword in header.lower() for keyword in ['account', 'address', 'custody', 'reserve']): if not any(keyword in header.lower() for keyword in ['account', 'address', 'custody', 'reserve']):
continue continue
...@@ -49,9 +51,16 @@ def extract_info_from_csv(file_path): ...@@ -49,9 +51,16 @@ def extract_info_from_csv(file_path):
def get_chain_balances(substrate: SubstrateInterface, acct_data, balance_pairs): def get_chain_balances(substrate: SubstrateInterface, acct_data, balance_pairs):
"""Query current balances for addresses from the chain.""" """Query current balances for addresses from the chain."""
lineno = 0
for acct in acct_data: for acct in acct_data:
lineno += 1
for addr_col, balance_col in balance_pairs: for addr_col, balance_col in balance_pairs:
try: try:
acct_addr = acct[addr_col]
if not acct_addr:
click.echo(f"Skipping line # {lineno} due to missing address", err=False)
continue
result = substrate.query( result = substrate.query(
module='System', module='System',
storage_function='Account', storage_function='Account',
......