Create minimal data seeding script for local dev bootstrap #197

Closed
opened 2024-12-02 16:47:21 +01:00 by lash · 2 comments
Owner

needs data-seeding-ng parts to be completed,

should bring up enough vouchers, accounts and transfers to have fully working menus for at least two accounts.

needs data-seeding-ng parts to be completed, should bring up enough vouchers, accounts and transfers to have fully working menus for at least two accounts.
lash added the
Kind/Testing
Priority
High
devops
Status
Blocked
labels 2024-12-02 16:48:36 +01:00
lash removed the
Status
Blocked
label 2024-12-13 08:58:52 +01:00
carlos was assigned by lash 2024-12-13 08:58:59 +01:00
Member

Data seeding proceedure

1.Setup

Prerequistes

1.Custodial stack
2. Ge-publish
3. Cast
4. Seed commands parser

1.Custodial stack

You should be able to run a local instance of the GE custodial stack to be able to perform GE related api calls.

2.Ge-publish

A CLI tool that lets you publish GE related smart contracts to any EVM chain.To install:

curl -L https://ge-publish.grassecon.net/install.sh | bash

Note: You will need to re-publish all the GE smart contracts as defined here to get the required contract addresses ,if using any other testnet that is not Celo Alfajores testnet.

3.Cast

The data seeding parser relies heavily on Cast to interact with deployed smart contracts and it MUST be installed.To install:

curl -L https://foundry.paradigm.xyz | bash

4.Seed commands parser

You will need a parser to run your data seeding commands:

git clone -b v-seed-test https://git.grassecon.net/urdt/data-seeding-ng.git

Then:

cd data-seeding-ng

Environment variables

Inside your env,you can define your own testnet configurations or use the default values.

  1. MASTER_PRIVATE_KEY:

    Private key with custodial permissions (atleast the key should be able to add a new token to the token index )

  2. CHAIN_ID:

    Specific identifier for a specific blockchain network

    Default: 44787.

  3. RPC:

    Rpc endpoint from the node provider

    Default: https://alfajores-forno.celo-testnet.org/.

  4. GAS_FEE_CAP:

    Default: 35000000000.

  5. GAS_TOP_UP:

    Amount of gas to topup each newly generated accounts.

    Default: 0.01ether

  6. TOKEN_INDEX:

    Address to token index smart contract

    Default: 0xD774bc082003eaF8DF74eEcD43AD44F03D488418

  7. BEARER_TOKEN:

    Token required to perform custodial api calls.

2.Define your data seeding commands:

1.using pre-defined seeding commands

It is only possible to run commands defined inside a file.To get started with an initial set of seed commands, create a text file and copy the below commands into it.

KEY_CREATE - mijikenda custodialstore
KEY_CREATE - kamba custodialstore
KEY_CREATE - maasai  custodialstore
KEY_CREATE - agiriama custodialstore
VOUCHER_MINT  - MIA 100000000 mijikenda
VOUCHER_MINT  - MES   100000000  maasai
VOUCHER_MINT  - KMP  100000000   kamba
VOUCHER_TRANSFER - MIA 2000000 kamba  mijikenda
VOUCHER_TRANSFER - MES 2000000  mijikenda maasai
VOUCHER_TRANSFER - KMP 2000000 mijikenda  kamba

Example: custodial_seed_commands.txt

2.Defining your custom data seeding commands

You can create your own set of vouchers,keys and transactions by following the instruction signatures defined here

3.Executing the commands:

If you are working with a virtual environment (recommended for isolating dependencies), follow these steps:

1.Skip step if you have virtual env installed

sudo apt-get update
sudo  apt install python3.8-venv
  1. Create a virtual environment
python3.8 -m venv seedenv
  1. Activate:
source seedenv/bin/activate

4.Install the required python packages

pip  install -r requirements.txt

To run your script,pass the path to the file where your seed commands are defined as an argument.

python3  parse.py <PATH_TO_SEED_COMMANDS.txt>

Note: If you have multiple versions of Python installed, make sure you're using the correct version (for example, python3 for Python 3.x).

## Data seeding proceedure ### 1.Setup **Prerequistes** 1.[Custodial stack](https://github.com/grassrootseconomics/custodial-docker-stack) 2. [ Ge-publish](https://github.com/grassrootseconomics/ge-publish) 3. [ Cast](https://book.getfoundry.sh/getting-started/installation) 4. [Seed commands parser](https://git.grassecon.net/urdt/data-seeding-ng) 1.**Custodial stack** You should be able to run a local instance of the GE custodial stack to be able to perform GE related api calls. 2.**Ge-publish** A CLI tool that lets you publish GE related smart contracts to any EVM chain.To install: ``` curl -L https://ge-publish.grassecon.net/install.sh | bash ``` **Note**: You will need to re-publish all the GE smart contracts as defined [here](https://software.sarafu.network/smart-contracts/bootstrap) to get the required contract addresses ,if using any other testnet that is not **Celo Alfajores testnet**. 3.**Cast** The data seeding parser relies heavily on **Cast** to interact with deployed smart contracts and it **MUST** be installed.To install: ``` curl -L https://foundry.paradigm.xyz | bash ``` 4.**Seed commands parser** You will need a parser to run your data seeding commands: ``` git clone -b v-seed-test https://git.grassecon.net/urdt/data-seeding-ng.git ``` Then: ``` cd data-seeding-ng ``` **Environment variables** Inside your `env`,you can define your own testnet configurations or use the default values. 1. `MASTER_PRIVATE_KEY`: Private key with custodial permissions (atleast the key should be able to add a new token to the token index ) 2. `CHAIN_ID`: Specific identifier for a specific blockchain network Default: `44787`. 3. `RPC`: Rpc endpoint from the node provider Default: `https://alfajores-forno.celo-testnet.org/`. 4. `GAS_FEE_CAP`: Default: `35000000000`. 5. `GAS_TOP_UP`: Amount of gas to topup each newly generated accounts. Default: `0.01ether` 6. `TOKEN_INDEX`: Address to token index smart contract Default: `0xD774bc082003eaF8DF74eEcD43AD44F03D488418` 2. `BEARER_TOKEN`: Token required to perform custodial api calls. ### 2.Define your data seeding commands: **1.using pre-defined seeding commands** It is only possible to run commands defined inside a file.To get started with an initial set of seed commands, create a text file and copy the below commands into it. ``` KEY_CREATE - mijikenda custodialstore KEY_CREATE - kamba custodialstore KEY_CREATE - maasai custodialstore KEY_CREATE - agiriama custodialstore VOUCHER_MINT - MIA 100000000 mijikenda VOUCHER_MINT - MES 100000000 maasai VOUCHER_MINT - KMP 100000000 kamba VOUCHER_TRANSFER - MIA 2000000 kamba mijikenda VOUCHER_TRANSFER - MES 2000000 mijikenda maasai VOUCHER_TRANSFER - KMP 2000000 mijikenda kamba ``` Example: [custodial_seed_commands.txt](https://git.grassecon.net/urdt/data-seeding-ng/src/branch/v-seed-test/custodial_seed_commands.txt) **2.Defining your custom data seeding commands** You can create your own set of vouchers,keys and transactions by following the instruction signatures defined [here](https://git.grassecon.net/urdt/data-seeding-ng/) ### 3.Executing the commands: If you are working with a virtual environment (recommended for isolating dependencies), follow these steps: 1.Skip step if you have virtual env installed ``` sudo apt-get update sudo apt install python3.8-venv ``` 2. Create a virtual environment ``` python3.8 -m venv seedenv ``` 3. Activate: ``` source seedenv/bin/activate ``` 4.Install the required python packages ``` pip install -r requirements.txt ``` To run your script,pass the path to the file where your seed commands are defined as an argument. ``` python3 parse.py <PATH_TO_SEED_COMMANDS.txt> ``` **Note**: If you have multiple versions of Python installed, make sure you're using the correct version (for example, python3 for Python 3.x).
Author
Owner

@kamikazechaser where do we put docs like this?

@kamikazechaser where do we put docs like this?
lash closed this issue 2024-12-31 10:08:47 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: urdt/ussd#197
No description provided.