GithubHelp home page GithubHelp logo

brunoss8 / ic-wall Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kristoferlund/ic-wall

0.0 0.0 0.0 6.53 MB

Crossover Ethereum/Internet Computer dApp demo and proof of concept. Sign in using Metamask, link eth address to IC identity FTW! ∞

Home Page: https://rivyl-6aaaa-aaaaf-qaapq-cai.raw.ic0.app/

Makefile 1.13% Rust 15.38% TypeScript 77.49% JavaScript 5.40% CSS 0.60%

ic-wall's Introduction

Update 2021-06-09:

wallbanner The Internet Computer by Dfinity Foundation promises to create "a limitless environment for smart contracts that run at web speed, serve web, scale, and reduce compute costs by a million times or more".

Ethereum apps that wants to deliver above and beyond of what is possible on chain often resorts to using regular centralised server solutions. Could off chain functionality instead run on the IC to create a mixed breed of Ethereum/IC apps - truly distributed, serverless and unstoppable?

The purpose with The Wall is to try out and showcase a few concepts with regards to building these crossover Ethereum/IC apps. A proof of concept, a demo and possibly a template to use as a starting point for more advanced apps.

Key concepts

  1. Authentication: Can public key cryptography already used by Ethereum be used to login to the IC?
  2. Link eth adresses to IC identities: If owners of eth adresses can easily prove ownership and link that verification with IC identities, that would open up many interesting app possibilites - voting, membership and other various DAO use cases.

The Wall

The functionality of the app is super simple. Connect Metamask wallet, sign a login message, select a username. Then you can post messages to the wall.

Login details:

  1. User signs a login message using Metamask. The login includes a hashed secret that for the purpose of this demo is set by the app. To add an extra layer of security this secret (password) coud instead be chosen by the user.
  2. App generates the Ed25519KeyIdentity needed to authenticate with IC based on the signature hash.
  3. Message hash and signature is sent to IC where the eth address used to sign the message is recovered and linked to the IC identity.

That's it! Now, the app can interact securely with IC, and IC has verified knowledge of which eth address the user controls.

Run locally

1. Prerequisites

Make sure you have the following installed:

node
npm
git

2. Install DFINITY Canister SDK

Download and install the DFINITY Canister SDK package by running the following command:

DFX_VERSION=0.7.1 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

3. Install Rust / Cargo

The app backend is written in Rust. The commands below install Rust, the package manager Cargo, etc.

curl https://sh.rustup.rs -sSf | sh
rustup update
rustup target add wasm32-unknown-unknown
sudo apt-get -y install cmake
cargo install ic-cdk-optimizer --root target
export PATH="./target/bin:$PATH"

4. Clone this repo, install dependencies

git clone https://github.com/kristoferlund/ic-wall.git
npm install

5. Run!

Terminal 1

Start Internet Computer

dfx start

Terminal 2

Alt 1. Development mode with hot reload

  • Deploy backend canisters
  • Run next.js frontend in dev mode
dfx deploy wall
dfx deploy profile
npm run dev

Access on http://localhost:3000

Alt 2. Production mode

  • Export static production version of next.js frontend
  • Deploy all canisters
dfx deploy wall
dfx deploy profile
npm run export
dfx deploy ui

Access on http://localhost:8000

In case you receive "Could not find Canister ID from Request":

  • Get UI canister ID
dfx canister id ui

Access on http://localhost:8000/?canisterId={id received in previous step}

Author

Kristofer Lund, [email protected]

Telegram: @kristoferkristofer

Contributing

Yes, please! Raise an issue or post a pull request.

TODO

[ ] Error handling all over!

[ ] Refactor canisters - better structure, naming etc.

License

MIT

ic-wall's People

Contributors

kristoferlund avatar mihaiii avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.