diff --git a/.gitignore b/.gitignore index 5ad773c..231f580 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ build/ contracts *.egg .coverage +deployments/ dist/ \ No newline at end of file diff --git a/README.md b/README.md index cb0b7b5..ec4eff0 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,20 @@ token deployments. ```shell pip install --extra-index-url https://pip.grassrootseconomics.net cic[eth] ``` +## Setup +### Importing a wallet from metamask +- Export the accounts private key [Instructions](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key) +- Save the private key to a file +- Run `eth-keyfile -k > ~/.config/cic/keystore/keyfile.json` ## Usage ### Using the wizard ``` # Local -cic wizard ./somewhere -c ./config/dev-docker +cic wizard ./somewhere -c ./config/docker # Test Net -cic wizard ./somewhere -c ./config/test-net +cic wizard ./somewhere -c ./config/testnet ``` ### Modular @@ -61,8 +66,9 @@ below are limited to the context of the EVM. ``` ```bash - poetry run cic wizard ./somewhere -c ./config/dev-docker + poetry run cic wizard ./somewhere -c ./config/docker ``` + ### Tests ``` diff --git a/cic/ext/eth/rpc.py b/cic/ext/eth/rpc.py index 783915b..3b7bfbc 100644 --- a/cic/ext/eth/rpc.py +++ b/cic/ext/eth/rpc.py @@ -1,17 +1,19 @@ # standard imports -import stat -import os +from getpass import getpass import logging +import os +import stat # external imports from funga.eth.keystore.dict import DictKeystore from funga.eth.signer import EIP155Signer -from chainlib.eth.cli import Rpc from chainlib.cli import Wallet +from chainlib.eth.cli import Rpc # local imports from cic.keystore import KeystoreDirectory + logg = logging.getLogger(__name__) @@ -22,7 +24,8 @@ class EthKeystoreDirectory(DictKeystore, KeystoreDirectory): """ - +def get_passphrase(): + return getpass('Enter passphrase: ') def parse_adapter(config, signer_hint): """Determine and instantiate signer and rpc from configuration. @@ -44,7 +47,7 @@ def parse_adapter(config, signer_hint): if stat.S_ISDIR(st.st_mode): logg.debug("signer hint is directory") keystore = EthKeystoreDirectory() - keystore.process_dir(signer_hint) + keystore.process_dir(signer_hint, password_retriever=get_passphrase) w = Wallet(EIP155Signer, keystore=keystore) signer = EIP155Signer(keystore) @@ -63,6 +66,6 @@ def list_keys(config, signer_hint): if stat.S_ISDIR(st.st_mode): logg.debug("signer hint is directory") keystore = EthKeystoreDirectory() - keystore.process_dir(signer_hint, default_password=config.get('WALLET_PASSPHRASE', '')) + keystore.process_dir(signer_hint, default_password=config.get('WALLET_PASSPHRASE', ''), password_retriever=get_passphrase) - return keystore.list() \ No newline at end of file + return keystore.list() diff --git a/config/docker/config.ini b/config/docker/config.ini new file mode 100644 index 0000000..43d6b22 --- /dev/null +++ b/config/docker/config.ini @@ -0,0 +1,27 @@ +[cic_core] +meta_writer = cic.writers.KVWriter +attachment_writer = cic.writers.KVWriter +proof_writer = cic.writers.KVWriter +ext_writer = cic.writers.KVWriter + +[cic] +registry_address = 0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299 + +[meta] +url = http://localhost:63380 +http_origin = + +[rpc] +provider = http://localhost:63545 + +[auth] +type = gnupg +keyfile_path = /home/will/grassroots/cic-internal-integration/apps/cic-ussd/tests/data/pgp/privatekeys_meta.asc +passphrase = merman + +[wallet] +key_file = /home/will/.config/cic/keystore +passphrase = + +[chain] +spec = evm:byzantium:8996:bloxberg \ No newline at end of file diff --git a/config/dev-docker/config.ini b/config/local/config.ini similarity index 84% rename from config/dev-docker/config.ini rename to config/local/config.ini index 3366663..ce52f19 100644 --- a/config/dev-docker/config.ini +++ b/config/local/config.ini @@ -8,11 +8,11 @@ ext_writer = cic.writers.KVWriter registry_address = 0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299 [meta] -url = http://localhost:63380 +url = http://localhost:8000 http_origin = [rpc] -provider = http://localhost:63545 +provider = http://localhost:8545 [auth] type = gnupg diff --git a/config/test-net/config.ini b/config/mainnet/config.ini similarity index 77% rename from config/test-net/config.ini rename to config/mainnet/config.ini index 4bc766c..7429377 100644 --- a/config/test-net/config.ini +++ b/config/mainnet/config.ini @@ -5,14 +5,14 @@ proof_writer = cic.writers.KVWriter ext_writer = cic.writers.KVWriter [cic] -registry_address = 0x86c616fd2f020289d6fd7a98f3bd7539b335c995 +registry_address = 0x999487d8B1EC2b2ac9F4a9D1A6D35a24D75D7EF4 [meta] url = https://meta.grassecon.net http_origin = [rpc] -provider = https://rpc.grassecon.net +provider = https://rpc.kitabu.grassecon.net [auth] type = gnupg diff --git a/config/testnet/config.ini b/config/testnet/config.ini new file mode 100644 index 0000000..e46d3d5 --- /dev/null +++ b/config/testnet/config.ini @@ -0,0 +1,27 @@ +[cic_core] +meta_writer = cic.writers.KVWriter +attachment_writer = cic.writers.KVWriter +proof_writer = cic.writers.KVWriter +ext_writer = cic.writers.KVWriter + +[cic] +registry_address = 0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299 + +[meta] +url = http://localhost:6700 +http_origin = + +[rpc] +provider = https://rpc.grassecon.net + +[auth] +type = gnupg +keyfile_path = /home/will/grassroots/cic-internal-integration/apps/cic-ussd/tests/data/pgp/privatekeys_meta.asc +passphrase = merman + +[wallet] +key_file = /home/will/grassroots/cic-internal-integration/apps/contract-migration/keystore +passphrase = + +[chain] +spec = evm:byzantium:5050:bloxberg \ No newline at end of file