Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .env.development.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ REACT_APP_RPC={}
REACT_APP_PROVIDER_SOCKET=ws://127.0.0.1:8000

# These keys are read-only, no harm in exposing them
REACT_APP_PINATA_API_KEY="86c94c7482c7ea399726"
REACT_APP_PINATA_API_SECRET="13d5d71e42a838f13f8cafa2f8ebc21b24d4060bbf50a3330ae3d85a07c9c6a7"
REACT_APP_PINATA_GATEWAY="https://azure-above-clam-231.mypinata.cloud"
REACT_APP_APILLON_API_KEY=bf5d1512-8d0f-488b-ade0-96f4e2a6f42e
REACT_APP_APILLON_API_SECRET=tpnApjlsU74$
REACT_APP_APILLON_BUCKET_UUID=7a4f9488-bd7b-4372-9fe8-a38fe03014f3

# Cloudflare Worker Upload Endpoint
REACT_APP_CLOUDFLARE_WORKER_URL=https://poi-upload-worker-prod.accounts-40a.workers.dev

# Provider Socket Options
# REACT_APP_PROVIDER_SOCKET=wss://rpc.ibp.network/kusama
Expand Down
12 changes: 8 additions & 4 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ REACT_APP_KEYRING_PREFIX=2
REACT_APP_RPC={}
REACT_APP_PROVIDER_SOCKET=wss://sys.ibp.network/asset-hub-kusama

# These keys are read-only, no harm in exposing them
REACT_APP_PINATA_API_KEY="86c94c7482c7ea399726"
REACT_APP_PINATA_API_SECRET="13d5d71e42a838f13f8cafa2f8ebc21b24d4060bbf50a3330ae3d85a07c9c6a7"
REACT_APP_PINATA_GATEWAY="https://azure-above-clam-231.mypinata.cloud"
# Apillon Storage Configuration (Read-Only)
# Frontend uses read-only API credentials to list files
REACT_APP_APILLON_API_KEY=bf5d1512-8d0f-488b-ade0-96f4e2a6f42e
REACT_APP_APILLON_API_SECRET=tpnApjlsU74$
REACT_APP_APILLON_BUCKET_UUID=7a4f9488-bd7b-4372-9fe8-a38fe03014f3

# Cloudflare Worker Upload Endpoint
REACT_APP_CLOUDFLARE_WORKER_URL=https://poi-upload-worker-prod.accounts-40a.workers.dev
11 changes: 7 additions & 4 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ REACT_APP_KEYRING_PREFIX=2
REACT_APP_RPC={}
REACT_APP_PROVIDER_SOCKET=wss://sys.ibp.network/asset-hub-kusama

# These keys are read-only, no harm in exposing them
REACT_APP_PINATA_API_KEY="6410248abd4b4babc313"
REACT_APP_PINATA_API_SECRET="f781dcdc8f87713609e047e7d97ea6ee395b68ea5b92abfa35caa92ed7d89919"
REACT_APP_PINATA_GATEWAY="https://peach-accurate-gull-904.mypinata.cloud"
# Apillon Storage Configuration (Read-Only)
REACT_APP_APILLON_API_KEY=test_apillon_api_key
REACT_APP_APILLON_API_SECRET=test_apillon_api_secret
REACT_APP_APILLON_BUCKET_UUID=test_apillon_bucket_uuid

# Cloudflare Worker Upload Endpoint
REACT_APP_CLOUDFLARE_WORKER_URL=https://poi-upload-worker-prod.accounts-40a.workers.dev
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
**/node_modules
/.pnp
.pnp.js
/.yarn
Expand Down
66 changes: 31 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ This is a dedicated interface for Kusama Society.

## Dependencies

* [Node v18.15.0](#)
* [yarn](https://yarnpkg.com)
- [Node v18.15.0](#)
- [yarn](https://yarnpkg.com)

## Setup

- Clone this repository.

- Copy the development sample config file on the root folder:

```bash
cp .env.development.sample .env.development
```
Expand All @@ -27,6 +28,7 @@ yarn install
## Running with Docker

- Run:

```bash
docker-compose up
```
Expand All @@ -38,86 +40,81 @@ docker-compose up
### Using Chopsticks:

- Copy the development sample config file on the config folder:

```bash
cp config/kusama.yml.sample config/kusama.yml
```

- Use [Chopsticks](https://github.com/AcalaNetwork/chopsticks) and set `"PROVIDER_SOCKET": "ws://127.0.0.1:8000"` on your `.env.development` to run a local fork of Kusama with predetermined Society storage and a custom runtime (uncomment the `wasm-override` parameter on the config file if you want a custom runtime):

```
yarn chopsticks
```

- Private keys for development accounts. Change hard derivation key to switch from `Alice` to `Bob`, `Charlie`, etc. Use this private key to import these development accounts to a wallet of your choice.

```
bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice
```

### Building and running your own custom runtime

Chopsticks allows for custom runtimes to be used. You can build a custom runtime using our fork of the runtimes repository, this version changes the rotation periods from days to seconds, in order to facilitate tests and development.

- Follow [this guide](https://docs.substrate.io/install/) to install Rust and the necessary dependencies to build Substrate
- Clone the [forked repository](https://github.com/KappaSigmaMu/custom-kusama-runtime) and checkout to this branch:

```
git checkout customized-society-pallet
```

- Change the code (if you need, if not you can skip this step and use our customized version)
- In the root folder of the forked repository, browse to Kusama's runtime directory

```
cd relay/kusama
```

- Inside the directory, run:

```
cargo build --release
```

- After finishing the build, browse back to the root directory and copy the wasm blob to this repository, renaming it to `custom-kusama-runtime.wasm`:

```
cp target/release/wbuild/staging-kusama-runtime/staging_kusama_runtime.wasm ../kappasigmamu.github.io/custom-kusama-runtime.wasm
```

- Uncomment the `wasm-override` parameter on `config/kusama.yml` and run Chopsticks:

```
yarn chopsticks
```

- You can also access [Polkadotjs pointing to your development node](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8000#/society) to interact with it.

### Managing Proof-of-Ink images
### Submitting Proof-of-Ink

We use IPFS to host the images and Pinata to pin the folder. The images are optimized and renamed to `<member_hash>.jpg` before getting uploaded. The scripts can be found inside `scripts/poi`.
Society members can submit their Kappa Sigma Mu tattoo images directly through the web interface at:

#### Requirements:
- Python libraries:
```
pip3 install Pillow pillow-heif python-dotenv
https://kappasigmamu.github.io/explore/poi/submit
```

#### Optimizing images
- Optimize an entire folder:
```
python3 optimize_multiple.py <folder_path>
```
- Rename and optimize single image:
```
python3 rename_and_optimize.py <image_path> <member_hash>
```
#### Submission Process:

#### Interacting with IPFS/Pinata
- PS: requires a `.env` inside `scripts/poi` with `PINATA_API_KEY` and `PINATA_API_SECRET`
- Install IPFS and run it:
```
ipfs daemon
```
- Upload folder to Pinata and pin it:
```
python3 upload.py <file_path>
```
- Download pinned folder:
```
python3 download.py <ipfs_hash> <download_path>
```
- Full job - takes a new image, renames and optimizes it, uploads the new folder to Pinata and pins it, and finally unpins the old folder. The optional param `force` let's you overwrite an image that already exists.
```
python3 job.py <image_path> <member_hash> [optional=force]
```
1. Navigate to the submit page
2. Upload your tattoo image (JPG, PNG, HEIC supported)
3. Submit for approval

#### Automated Workflow:

- **Society Members**: Automatically approved and uploaded to Apillon storage
- **Non-Members**: Submitted for manual review before approval
- Images are stored permanently on Apillon's decentralized storage
- Approval is handled by a Cloudflare Worker (`workers/poi-upload-worker`)

## Application:

Expand All @@ -133,7 +130,6 @@ yarn lint

You can automatically fix some issues with `yarn lint:fix`


## Tests

```
Expand Down
10 changes: 10 additions & 0 deletions scripts/apillon-bucket/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Apillon Configuration
# Get these from https://app.apillon.io

APILLON_API_KEY=your_api_key_here
APILLON_API_SECRET=your_api_secret_here
APILLON_BUCKET_UUID=your_bucket_uuid_here

# Optional: Matrix/Element Notifications
MATRIX_ROOM_ID=!YourRoomId:matrix.org
MATRIX_ACCESS_TOKEN=your_access_token
61 changes: 61 additions & 0 deletions scripts/apillon-bucket/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Apillon Bucket Setup Scripts

Scripts for setting up and migrating Proof-of-Ink tattoo images to Apillon IPFS storage.

## Quick Start

```bash
cd scripts/apillon-bucket
npm install
cp .env.example .env
# Edit .env with your credentials
npm run setup
npm run migrate
```

## Commands

### `npm run setup`

Initial bucket setup (run once):
- Creates folder structure (`pending/`, `approved/`, `rejected/`)
- Verifies configuration

### `npm run migrate`

Migrate images from Pinata to Apillon:
1. Downloads images from Pinata IPFS
2. Uploads to Apillon's `approved/` folder
3. Automatically skips duplicates

**Prerequisites:**
- Run `npm run setup` first
- Configure Pinata credentials in `.env`
- Optional: Create `filelist.txt` with one filename per line (156 images total)

## Environment Variables

Create `scripts/apillon-bucket/.env`:

```env
# Apillon credentials
APILLON_API_KEY=your_api_key
APILLON_API_SECRET=your_api_secret
APILLON_BUCKET_UUID=your_bucket_uuid

# Pinata credentials
PINATA_API_KEY=your_pinata_api_key
PINATA_API_SECRET=your_pinata_secret_api_key
PINATA_GATEWAY=https://your-gateway.mypinata.cloud
```

Get Apillon credentials from: https://app.apillon.io

## Bucket Structure

```
kappa-sigma-mu-poi/
├── pending/ # Awaiting approval
├── approved/ # Live in gallery
└── rejected/ # Archive
```
Loading