Skip to content

jekabolt/solutions-dapp

Repository files navigation

art-admin

is a backend service for uploading storing mint requests offchain and in chain basic flow of the backend:

  1. Some user got paid for nft thru api on website after pictures and descriptions uploaded we put his mint request into pool with status StatusUnknown.
  2. We have a watcher with is update statuses for txs if users mint request transaction was successful we put a StatusPending for this mint request or it also can be StatusFailed if tx is left from blockchain.
  3. Than it can be appeared on admin panel where admin can review the pictures and create "NFT" from em.
  4. "NFT" is done admin can upload them offchain this is made because we bulk the uploads than our mint request got status StatusUploadedOffchain`.
  5. When we are ready to upload it to blockchain we can generate the metadata for our collection and than update the uri link for this in our smart contract
StatusUnknown          :"unknown"
StatusPending          :"pending"
StatusCompleted        :"completed"
StatusFailed           :"failed"
StatusBad              :"bad"
StatusUploadedOffchain :"uploadedOffchain"
StatusUploaded         :"uploaded"

the http api specification can be found here

configuration

KEY VALUE
SERVER_PORT 3999
S3_ACCESS_KEY xxx
S3_SECRET_ACCESS_KEY xxx
S3_ENDPOINT fra1.digitaloceanspaces.com
S3_BUCKET_NAME grbpwr
S3_BUCKET_LOCATION fra-1
S3_BASE_FOLDER solutions
S3_IMAGE_STORE_PREFIX grbpwr-com
S3_METADATA_STORE_PREFIX metadata
S3_IPFS_STORAGE_PATH ipfs
BUNT_DB_PATH /etc/bunt/storage.db
ETH_ETHERSCAN_API_KEY xxx
ETH_ETHERSCAN_NETWORK api-rinkeby
ETH_CONTRACT_ADDRESS 0x0TODO:
ETH_REFRESH_TIME 10m
MORALIS_API_KEY xxx
MORALIS_TIMEOUT 10s
MORALIS_BASE_URL https://deep-index.moralis.io/api/v2/
DESCRIPTIONS_PATH etc/descriptions.json
DESCRIPTIONS_COLLECTION_NAME Solutions #
NFT_TOTAL_SUPPLY 10000
AUTH_JWT_SECRET hehe
AUTH_ADMIN_PASSWORD hehe
AUTH_PASSWORD_HASHER_SALT 16
AUTH_PASSWORD_HASHER_ITERATIONS 100000
AUTH_JWT_TTL 60m

run locally

make install
make run

run in docker

make image-build
make image-run

dependencies

Need to solc & abigen be installed to envoke read methods from contract in go to make sure that payment went through.

install on mac:

brew update
brew upgrade
brew tap ethereum/ethereum
brew install solidity
brew install ethereum

install ubuntu:

add-apt-repository ppa:ethereum/ethereum
add-apt-repository ppa:ethereum/ethereum-dev
apt-get update
apt-get install solc
apt-get install ethereum

admin panel

for more backend api options check .env.example file

Run locally

make install-admin-panel

make dev-admin-panel

Build dist version

make build-dist-admin-panel

to use make generate-proto make sure you have GO .bin, protoc compiler and proto->http (protoc-gen-typescript-http) generator available in working dir

todo:

  • setup react app (typescript + react + webpack + scss)
  • generate types from backend (protobuff,rpc) (similar to tRPC types generation ?))
  • use useQuery for fetching data (if is has okay bundle size...didnt check yet)
  • change build dir to art-admin/..../static
  • add docker + make files, add run commands to readme
  • color mode (theme)
  • check bundle routing
  • prior todos
  • add protected wrapper to routes with auth
  • move proto files to upper scope (both client and server generates it)
  • think of todos
  • think of authToken lifetime (locastorage/sessionstorage/best way ?)