Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Latest commit

 

History

History
112 lines (84 loc) · 3.47 KB

README.md

File metadata and controls

112 lines (84 loc) · 3.47 KB

Origin Protocol

An experimental decentralized e-commerce store served entirely from IPFS.

Create your store

First create a listing on shoporigin.com and make a note of the listing ID.

   # Clone and install
   git clone [email protected]:OriginProtocol/dshop.git dshop
   cd origin-store
   yarn
   cd shop

   # Copy example multi-product store data
   cp -r data/example data/mystore

   # OR single-product store data
   cp -r data/example-single data/mystore

   # Copy PGP dist files
   cp -r ../node_modules/openpgp/dist public

   # Generate PGP keys. Make a note of public and private keys.
   node scripts/genKey

   # Edit config in data/mystore/config.json

   # By default, the back-end uses Sqlite. If you want to use Postgres, do the following:
   - Create a new dshop database. For example under psql:
   #> CREATE DATABASE dshop;
   - Set DATABASE_URL to point to your newly created DB. For example:
   export DATABASE_URL="postgres://origin:origin@localhost/dshop"
   - Create the DB schema by running the migrations
   cd backend; yarn run migration; cd..

   # The backend uses redis for queues. While you can skip this,
   # it's highly recommended to run a local redis so your testing
   # matches production behavior
   export REDIS_URL=redis://localhost:6379/

   # Optional: If you want to use the super-admin to create new shops, build the bundle.
   cd shop; yarn run build:dist; cd ..

   # Start the stack (IPFS, local ganache blockchain, back-end, front-end):
   yarn start

   # This will start a browser pointing to the super-admin interface at:
     - Super admin: http://0.0.0.0:9000/#/super-admin

   # Create a super-admin account

   # Create a local shop

Troubleshooting

Vips error

If you encounter this error on MacOS while running yarn install:

../src/common.cc:25:10: fatal error: 'vips/vips8' file not found

Try to install vips manually by running: brew install vips

js-ipfs error

If you encounter this error while using the admin to create a new shop:

UnhandledPromiseRejectionWarning: Error: Invalid version, must be a number equal to 1 or 0
    at Function.validateCID

Upgrade the ipfs package to 0.43.2 or higher under packages/origin/services/package.json

Build

   PROVIDER=<provider> NETWORK=<mainnet|rinkeby> DATA_DIR=mystore npm run build

Host on IPFS

First, sign up for Pinata

   export IPFS_DEPLOY_PINATA__API_KEY=<YOUR PINATA API KEY>
   export IPFS_DEPLOY_PINATA__SECRET_API_KEY=<YOUR PINATA SECRET KEY>
   DATA_DIR=mystore yarn build
   cp -r data/mystore public
   npx ipfs-deploy -p pinata

Make a note of the IPFS hash as you'll need it later...

Setup domain via Cloudflare

  1. Create a CNAME from subdomain.yourdomain.com to cloudflare-ipfs.com
  2. Add a TXT record with the name _dnslink.subdomain.yourdomain.com and value dnslink=/ipfs/<your_ipfs_hash_here>
  3. Visit this page on Cloudflare, scroll to the bottom and add your domain to the form
  4. Ignore the 'Authentication Error' if there is one
  5. Wait a minute or so, then visit your URL in a browser

Setup ENS

  1. Visit the ENS App
  2. Ensure your wallet (MetaMask et al) is pointing to Mainnet
  3. Register your ENS domain
  4. Use the Public resolver
  5. Set content hash to ipfs://<your_ipfs_hash_here>
  6. Wait a few minutes, then visit https://your-ens-domain.eth.link