Package Exports
- origin
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (origin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme

<<<<<<< HEAD

develop
Origin Protocol
Origin Protocol is a library of javascript code and Ethereum smart contracts which allow anyone to create decentralized marketplaces, including for fractional usage.
Please refer to our product brief and technical whitepaper for more detail.
Follow our progress and get involved
This repo is under active development. We welcome your participation!
Listen in on our weekly engineering call on Google Hangouts. It happens every week and everyone is welcome to listen in and participate. Join us on Google Hangouts on Wednesdays at 9pm GMT (Add to Calendar):
| Pacific | Mountain | Central | Eastern | GMT |
|---|---|---|---|---|
| Wed 1pm | Wed 2pm | Wed 3pm | Wed 4pm | Wed 9pm |
- Catch up on our meeting notes & weekly sprint planning docs (feel free to add comments):
- Read our simple contributing and style guide.
What we're building
This library is an abstraction layer for developers who want to build DApps on Origin Protocol, and is also used to build the Origin Demo DApp.
The library will make it easy for sellers to do things like:
- Create listings
- Update listings
- Delete listings
- Validate listings
And buyers to:
- Browse listing
- Create bookings
- Update bookings
- Cancel bookings
origin.js Documentation
Introduction
Welcome to the origin.js documentation! origin.js is a Javascript library for interacting with the Origin protocol.
Using the library you can create new listings from your applications, purchase them, or update them from your own off-chain applications.
Warning
This is still an alpha version which will evolve significantly before the main net release.
Using origin.js in your project
Plain javascript
A browser-compatible plain javascript file origin.js is available in the "Releases" tab, and will soon be hosted on originprotocol.com. It can be generated locally via npm build and will be placed in dist/origin.js.
Install
NPM
npm install @originprotocol/origin --saveYarn
yarn add @originprotocol/originLocal
git cloneyour fork. Note that the latest commits will be on thedevelopbranch. So switch to that branch if you want to submit a PR or check out recently merged code.Install:dev (shortcut for
npm install && npm link). Linking makes this available as a local npm package for local dapp development.npm run install:devStart the localblockchain and create the build. Code changes will trigger a live rebuild.
npm startIn order to conduct test transactions, you can create a new wallet using the following seed phrase (Mnemonic):
Be careful to back up the seed phrases and private keys for any existing wallets before creating a new one.
candy maple cake sugar pudding cream honey rich smooth crumble sweet treatTo develop against a working dapp and UI, see the instructions in our demo dapp.
Import
import Origin from '@originprotocol/origin'
let configOptions = {}
let { contractService, ipfsService, originService } = new Origin(configOptions)Configuration Options
Config options are passed into the Origin constructor at instantiation.
let configOptions = {
option: 'value'
}
let origin = new Origin(configOptions)Valid options:
ipfsDomainipfsApiPortipfsGatewayPortipfsGatewayProtocolattestationServerUrl
IPFS
If you are running a local IPFS daemon then set the following config options (see config options):
{
ipfsDomain: '127.0.0.1',
ipfsApiPort: '5001',
ipfsGatewayPort: '8080',
ipfsGatewayProtocol: 'http'
}Configure your local IPFS daemon with the following settings to avoid CORS errors:
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["localhost:*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["GET", "POST", "PUT"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'Troubleshooting
Python 3
If you have Python 3 installed, you may see this error when installing dependencies:
gyp ERR! stack Error: Python executable "/Users/aiham/.pyenv/shims/python" is v3.6.4, which is not supported by gyp.Resolve this by configuring npm to use Python 2 (where python2.7 is a binary accessible from your $PATH):
npm config set python python2.7Tests
Command Line (All Tests)
Our full test suite can be run with:
npm run testNote: you should not have the server running at this time, as these tests start their own local blockchain instance.
Command Line (Only Solidity Tests)
Our Solidity tests (which use Truffle) are located at contracts/test.
npm run test:contractsNote: you should not have the server running at this time, as these tests start their own local blockchain instance.
Browser Tests
A subset of our tests can be run from the browser. These tests are automatically served at http://localhost:8081 when you run npm start. These tests are automatically rerun when source or test code is changed.
Run a subset of these tests using the grep query string parameter, for example: http://localhost:8081/?grep=IpfsService
Documentation
Needed