Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74e86df7d2 | ||
|
|
f8934ebdfe | ||
|
|
62ece58a96 |
@@ -0,0 +1,6 @@
|
|||||||
|
venv
|
||||||
|
laconic_testnet.egg-info
|
||||||
|
__pycache__
|
||||||
|
|
||||||
|
*-deployment
|
||||||
|
*-spec.yml
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# cli
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
* Run commands in repo root directory
|
||||||
|
```bash
|
||||||
|
python3 -m venv venv
|
||||||
|
source ./venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
* Install CLI in editable mode
|
||||||
|
```bash
|
||||||
|
pip install --editable .
|
||||||
|
```
|
||||||
|
|
||||||
|
* Verify installation
|
||||||
|
```bash
|
||||||
|
laconic-testnet --help
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-testnet --onboarded-json path/to/onboarded-accounts.json --subscribers-csv path/to/subscribers.csv --output path/to/subscribed-onboarded-accounts.csv
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cleanup
|
||||||
|
|
||||||
|
Deactivate virtual environment
|
||||||
|
```bash
|
||||||
|
deactivate
|
||||||
|
```
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
import click
|
||||||
|
from .core import process_subscribers
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.option('--onboarded-json', required=True, type=click.Path(exists=True), help='Path to onboarded accounts JSON file.')
|
||||||
|
@click.option('--subscribers-csv', required=True, type=click.Path(exists=True), help='Path to the subscribers CSV file.')
|
||||||
|
@click.option('--output', required=True, type=click.Path(), help='Path to the output CSV file.')
|
||||||
|
def main(onboarded_json, subscribers_csv, output):
|
||||||
|
"""
|
||||||
|
CLI tool to match subscriber data with participant data and generate a CSV.
|
||||||
|
"""
|
||||||
|
process_subscribers(onboarded_json, subscribers_csv, output)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
import csv
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
|
||||||
|
def hash_subscriber_id(subscriber_id):
|
||||||
|
return '0x' + hashlib.sha256(subscriber_id.encode()).hexdigest()
|
||||||
|
|
||||||
|
def process_subscribers(onboarded_json, subscribers_csv, output):
|
||||||
|
# Load JSON data from the file
|
||||||
|
with open(onboarded_json, 'r') as json_file:
|
||||||
|
json_data = json.load(json_file)
|
||||||
|
|
||||||
|
# Create a dictionary mapping kyc_id to participant data
|
||||||
|
kyc_map = {participant['kyc_id']: participant for participant in json_data['participants']}
|
||||||
|
|
||||||
|
# Load subscribers data from the CSV file and process it using map
|
||||||
|
with open(subscribers_csv, 'r') as csv_file:
|
||||||
|
csv_reader = csv.DictReader(csv_file)
|
||||||
|
subscribers = list(csv_reader)
|
||||||
|
|
||||||
|
# Use map to process subscribers
|
||||||
|
def process_subscriber(subscriber):
|
||||||
|
hashed_subscriber_id = hash_subscriber_id(subscriber['subscriber_id'])
|
||||||
|
participant = kyc_map.get(hashed_subscriber_id)
|
||||||
|
|
||||||
|
if participant:
|
||||||
|
return {
|
||||||
|
'subscriber_id': subscriber['subscriber_id'],
|
||||||
|
'email': subscriber['email'],
|
||||||
|
'cosmos_address': participant['cosmos_address'],
|
||||||
|
'nitro_address': participant['nitro_address'],
|
||||||
|
'role': participant['role'],
|
||||||
|
'hashed_subscriber_id': participant['kyc_id'],
|
||||||
|
'status': subscriber['status'],
|
||||||
|
'premium': subscriber['premium?'],
|
||||||
|
'created_at': subscriber['created_at']
|
||||||
|
}
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Apply the map function and filter out None values
|
||||||
|
output_data = list(filter(None, map(process_subscriber, subscribers)))
|
||||||
|
|
||||||
|
# Write the matched data to a new CSV file
|
||||||
|
with open(output, 'w', newline='') as csv_file:
|
||||||
|
fieldnames = ['subscriber_id', 'email', 'cosmos_address', 'nitro_address', 'role', 'hashed_subscriber_id', 'status', 'premium', 'created_at']
|
||||||
|
csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
|
||||||
|
csv_writer.writeheader()
|
||||||
|
csv_writer.writerows(output_data)
|
||||||
|
|
||||||
|
print(f'Data has been written to {output}')
|
||||||
@@ -99,12 +99,9 @@
|
|||||||
cat <<EOF > stage0-deployment/config.env
|
cat <<EOF > stage0-deployment/config.env
|
||||||
# Set to true to enable adding participants functionality of the onboarding module
|
# Set to true to enable adding participants functionality of the onboarding module
|
||||||
ONBOARDING_ENABLED=true
|
ONBOARDING_ENABLED=true
|
||||||
|
|
||||||
# A custom human readable name for this node
|
# A custom human readable name for this node
|
||||||
MONIKER=LaconicStage0
|
MONIKER=LaconicStage0
|
||||||
|
|
||||||
# Chain ID of the network
|
|
||||||
CHAINID=loro-testnet-0
|
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -230,8 +227,6 @@
|
|||||||
|
|
||||||
cat <<EOF > laconic-faucet-deployment/config.env
|
cat <<EOF > laconic-faucet-deployment/config.env
|
||||||
CERC_FAUCET_KEY=$FAUCET_ACCOUNT_PK
|
CERC_FAUCET_KEY=$FAUCET_ACCOUNT_PK
|
||||||
|
|
||||||
CERC_LACONICD_CHAIN_ID=loro-testnet-0
|
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -357,8 +352,6 @@
|
|||||||
CERC_FAUCET_ENDPOINT="https://faucet.laconic.com"
|
CERC_FAUCET_ENDPOINT="https://faucet.laconic.com"
|
||||||
|
|
||||||
CERC_WALLET_META_URL="https://loro-signup.laconic.com"
|
CERC_WALLET_META_URL="https://loro-signup.laconic.com"
|
||||||
|
|
||||||
CERC_LACONICD_CHAIN_ID=loro-testnet-0
|
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -554,8 +547,6 @@
|
|||||||
AUTHORITY_GRACE_PERIOD=7200
|
AUTHORITY_GRACE_PERIOD=7200
|
||||||
|
|
||||||
MONIKER=LaconicStage1
|
MONIKER=LaconicStage1
|
||||||
|
|
||||||
CHAINID=loro-testnet-1
|
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -634,7 +625,7 @@
|
|||||||
```bash
|
```bash
|
||||||
network:
|
network:
|
||||||
ports:
|
ports:
|
||||||
laconic-console:
|
console:
|
||||||
- '127.0.0.1:4001:80'
|
- '127.0.0.1:4001:80'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+1
-13
@@ -49,7 +49,7 @@ Once all the participants have completed their onboarding, stage0 laconicd chain
|
|||||||
# Generate the genesis file
|
# Generate the genesis file
|
||||||
# Participant allocation: 1000000000000 (10^12)
|
# Participant allocation: 1000000000000 (10^12)
|
||||||
# Validator allocation: 2000000000000000 (10^15)
|
# Validator allocation: 2000000000000000 (10^15)
|
||||||
CHAINID=loro-testnet-1 MONIKER=LaconicStage1 ./scripts/generate-stage1-genesis-using-allocations.sh $DEPLOYMENTS_DIR/stage0-deployment 1000000000000 2000000000000000
|
./scripts/generate-stage1-genesis-using-allocations.sh $DEPLOYMENTS_DIR/stage0-deployment 1000000000000 2000000000000000
|
||||||
|
|
||||||
# Expected output:
|
# Expected output:
|
||||||
# Genesis file for stage1 written to output/genesis.json
|
# Genesis file for stage1 written to output/genesis.json
|
||||||
@@ -69,18 +69,6 @@ Once all the participants have completed their onboarding, stage0 laconicd chain
|
|||||||
cp ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd/output/genesis.json stage1-deployment/data/genesis-config/genesis.json
|
cp ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd/output/genesis.json stage1-deployment/data/genesis-config/genesis.json
|
||||||
```
|
```
|
||||||
|
|
||||||
* Update testnet-onboarding-app deployment
|
|
||||||
* Change chain ID in `/srv/app/onboarding-app-deployment/config.env`
|
|
||||||
```bash
|
|
||||||
CERC_LACONICD_CHAIN_ID=loro-testnet-1
|
|
||||||
```
|
|
||||||
* Restart the container
|
|
||||||
```
|
|
||||||
laconic-so deployment --dir onboarding-app-deployment stop
|
|
||||||
|
|
||||||
laconic-so deployment --dir onboarding-app-deployment start
|
|
||||||
```
|
|
||||||
|
|
||||||
* Start the stage1 deployment:
|
* Start the stage1 deployment:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -63,8 +63,6 @@ Instructions to reset / update the deployments
|
|||||||
|
|
||||||
cat <<EOF > laconic-faucet-deployment/config.env
|
cat <<EOF > laconic-faucet-deployment/config.env
|
||||||
CERC_FAUCET_KEY=$FAUCET_ACCOUNT_PK
|
CERC_FAUCET_KEY=$FAUCET_ACCOUNT_PK
|
||||||
|
|
||||||
CERC_LACONICD_CHAIN_ID=loro-testnet-0
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Stop the deployment
|
# Stop the deployment
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Click
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="laconic-testnet",
|
||||||
|
version="0.1.0",
|
||||||
|
packages=find_packages(),
|
||||||
|
install_requires=[
|
||||||
|
"Click",
|
||||||
|
],
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': [
|
||||||
|
'laconic-testnet = cli.cli:main',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[upstream]
|
[upstream]
|
||||||
rpcEndpoint = "REPLACE_WITH_CERC_LACONICD_RPC_ENDPOINT"
|
rpcEndpoint = "REPLACE_WITH_CERC_LACONICD_RPC_ENDPOINT"
|
||||||
chainId = "REPLACE_WITH_CERC_LACONICD_CHAIN_ID"
|
chainId = "laconic_9000-1"
|
||||||
denom = "alnt"
|
denom = "alnt"
|
||||||
prefix = "laconic"
|
prefix = "laconic"
|
||||||
gasPrice = "1"
|
gasPrice = "1"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ FAUCET_CONFIG=$(echo "$config_template" | \
|
|||||||
sed -E "s|REPLACE_WITH_CERC_FAUCET_KEY|${CERC_FAUCET_KEY}|g; \
|
sed -E "s|REPLACE_WITH_CERC_FAUCET_KEY|${CERC_FAUCET_KEY}|g; \
|
||||||
s|REPLACE_WITH_CERC_LACONICD_RPC_ENDPOINT|${CERC_LACONICD_RPC_ENDPOINT}|g; \
|
s|REPLACE_WITH_CERC_LACONICD_RPC_ENDPOINT|${CERC_LACONICD_RPC_ENDPOINT}|g; \
|
||||||
s|REPLACE_WITH_CERC_TRANSFER_AMOUNT|${CERC_TRANSFER_AMOUNT}|g; \
|
s|REPLACE_WITH_CERC_TRANSFER_AMOUNT|${CERC_TRANSFER_AMOUNT}|g; \
|
||||||
s|REPLACE_WITH_CERC_LACONICD_CHAIN_ID|${CERC_LACONICD_CHAIN_ID}|g; \
|
|
||||||
s|REPLACE_WITH_CERC_PERIOD_TRANSFER_LIMIT|${CERC_PERIOD_TRANSFER_LIMIT}|; ")
|
s|REPLACE_WITH_CERC_PERIOD_TRANSFER_LIMIT|${CERC_PERIOD_TRANSFER_LIMIT}|; ")
|
||||||
|
|
||||||
echo "$FAUCET_CONFIG" > $target_config
|
echo "$FAUCET_CONFIG" > $target_config
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ laconic-so deployment --dir laconic-console-deployment start
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Example
|
# Example
|
||||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type photon --quantity 1000000000000"
|
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type alnt --quantity 1000000000000"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
|
|||||||
@@ -5,16 +5,6 @@
|
|||||||
* Visit <https://wallet.laconic.com/> and click on `Create wallet`
|
* Visit <https://wallet.laconic.com/> and click on `Create wallet`
|
||||||
* Save the mnemonic for further usage
|
* Save the mnemonic for further usage
|
||||||
|
|
||||||
* Add a new network for stage0 laconicd by clicking on `Add Network`
|
|
||||||
* Change network type to `COSMOS`
|
|
||||||
* Set Chain ID to `loro-testnet-0`
|
|
||||||
* Set Network Name to `LOROTestnet0`
|
|
||||||
* Set New RPC URL to `https://laconcid.laconic.com`
|
|
||||||
* Set Coin Type to `118`
|
|
||||||
* Set Native Denom to `alnt`
|
|
||||||
* Set Address Prefix to `laconic`
|
|
||||||
* Set Gas Price to `1`
|
|
||||||
|
|
||||||
* Register your laconic address as a participant using the [Onboarding App](https://loro-signup.laconic.com)
|
* Register your laconic address as a participant using the [Onboarding App](https://loro-signup.laconic.com)
|
||||||
|
|
||||||
* Read and accept the `Terms and Conditions`
|
* Read and accept the `Terms and Conditions`
|
||||||
@@ -181,23 +171,13 @@ laconic-so deployment --dir testnet-laconicd-deployment start
|
|||||||
|
|
||||||
### Join as testnet validator
|
### Join as testnet validator
|
||||||
|
|
||||||
|
* Open the wallet: <https://wallet.laconic.com/>
|
||||||
|
|
||||||
* Create a validator from the onboarding app:
|
* Create a validator from the onboarding app:
|
||||||
* Open the wallet: <https://wallet.laconic.com/>
|
|
||||||
|
|
||||||
* Add a new network for stage1 laconicd by clicking on `Add Network`
|
|
||||||
* Change network type to `COSMOS`
|
|
||||||
* Set Chain ID to `loro-testnet-1`
|
|
||||||
* Set Network Name to `LOROTestnet1`
|
|
||||||
* Set New RPC URL to `https://laconcid.laconic.com`
|
|
||||||
* Set Coin Type to `118`
|
|
||||||
* Set Native Denom to `alnt`
|
|
||||||
* Set Address Prefix to `laconic`
|
|
||||||
* Set Gas Price to `1`
|
|
||||||
|
|
||||||
* Visit the [validator creation](https://loro-signup.laconic.com/validator) page
|
* Visit the [validator creation](https://loro-signup.laconic.com/validator) page
|
||||||
|
|
||||||
* Click on `DISCONNECT` if wallet is already connected and then connect again to pair using the stage1 chain ID
|
* If required, connect testnet-onboarding app to the wallet with which onboarding was done on stage0
|
||||||
|
|
||||||
* Select the Laconic account (same as the one used while onboarding) using which you wish to send the create validator request
|
* Select the Laconic account (same as the one used while onboarding) using which you wish to send the create validator request
|
||||||
|
|
||||||
@@ -263,7 +243,7 @@ laconic-so deployment --dir testnet-laconicd-deployment start
|
|||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd tx staking create-validator my-validator.json \
|
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd tx staking create-validator my-validator.json \
|
||||||
--fees 500000alnt \
|
--fees 500000alnt \
|
||||||
--chain-id=loro-testnet-1 \
|
--chain-id=laconic_9000-1 \
|
||||||
--from $KEY_NAME"
|
--from $KEY_NAME"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user