Skip to content
This repository was archived by the owner on Apr 19, 2022. It is now read-only.
/ dirdem Public archive

a ethereum-based direct-democracy prototype

License

Notifications You must be signed in to change notification settings

FrankBeu/dirdem

Repository files navigation

dirĐem

INFO

SOURCES

flask is roughly based on

https://github.com/testdrivenio/flask-htmx-tailwind

smartcontract folder structure is based on brownie chainlink-mix

https://github.com/smartcontractkit/chainlink-mix

RUNNING

dependencies

on nixos

everything will be loaded automatically via direnv on entering the project-directory

other os

all package.json-packages
npm install
all pyproject.toml-packages
poetry lock

DEVEL

start local chain FIRST!

OR
with summon
cd ./smartcontract/
summon -e dev --up brownie console
w/o summon

all envs in ./secrets.yml:dev have to be set manually

cd ./smartcontract/
brownie console

deploy BallotList

on brownie-console

run('scenario/00')

(optional) deploy ballot(s)

on brownie-console

run('scenario/01')

start local flask

with summon
summon -e dev --up flask run --host='::' --port=8080
w/o summon

all envs in ./secrets.yml:dev have to be set manually

flask run --host='::' --port=8080

PRODUCTION (kovan-testnet)

optional

flask will use a web3-provider to access kovan via infura

OR
with summon
cd ./smartcontract/
summon -e dev --up brownie console --network ${BROWNIE_NETWORK}

networks are defined in smartcontract/brownie-config.yaml

w/o summon

all envs in ./secrets.yml:dev have to be set manually

cd ./smartcontract/
brownie console --network kovan

start flask (connecting to kovan)

with summon
summon -e prod --up flask run --host='::' --port=8080
w/o summon

all envs in ./secrets.yml:prod have to be set manually

flask run --host='::' --port=8080

SETUP

add files needed for flask add node-packages from package.lock

nixify
node2nix -l

get ip

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

serve via ipv6

run flask

flask run --host='::' --port=8080

curl

curl -g -6 'http://[2a02:8070:279d:2700:4754:be88:8d7:61ac]:8080'

router

Quell IPv6Ziel IPv6ProtokollQuellportZielportErlaubenAktivierLöschen
AllAllTCP1 : 655358080110

only devel has hot reload

environment

in order to change the env

edit shell.nix stop flask reload shell.nix

change on env.toml

needs a flask-restart

TODOS

default.nix needs python implementation

DEVEL

INITIALISATION

in pyproj.toml

  1. rename project name
  2. add to project authors
    "NAME SURNAME <EMAIL>"
        

direnv

reload direnv

XOR
nfs
nfd
nff

flask

https://flask.palletsprojects.com/en/2.0.x/ https://flask.palletsprojects.com/en/2.0.x/quickstart/#a-minimal-application

run

flask run

debug

FLASK_ENV=development sets FLASK_DEBUG=1

poetry

https://python-poetry.org/docs/

commands

add dependency
poetry add requests
remove dependency
poetry remove requests
create lockFile
poetry lock --no-update
clear cache
poetry cache clear --all .

poetry2nix

uses default.nix

nix-build

python-pytest

searches the project-root to find the executable and tests

create

OR
  • git repo
  • .projectile
  • .dir-locals.el
    ((nil . ((eval . (setq projectile-project-root file-name-directory)))))
        

commands

reload dir-local

fb/reload-dir-locals-current-buffer SPC r d b

invalidate projectRoot (projectileCache)

projectile-invalidate-cache SPC p i

npm

add to package.json without installing

npm install --package-lock-only --no-package-lock @tailwindcss/custom-forms --save-dev

node2nix

dev-packages

by default only nonDevPackages will be made available
node2nix
use package-lock.json
node2nix -l
make only devPackages available
node2nix --development

About

a ethereum-based direct-democracy prototype

Resources

License

Stars

Watchers

Forks

Packages

No packages published