
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@energyweb/exchange
Advanced tools
The Exchange package is a NestJS application that provides backend services to manage the Exchange's functionality (account management and buying, selling and transferring Energy Attribute Certificates through an order book system).
It is a component of Energy Web Origin's Trade SDK.
See contributing.md
EW-Origin is a component of the Energy Web Decentralized Operating System (EW-DOS).
The purpose of EW-DOS is to develop and deploy an open and decentralized digital operating system for the energy sector in support of a low-carbon, customer-centric energy future.
We develop blockchain technology, full-stack applications and middleware packages that facilitate participation of Distributed Energy Resources on the grid and create open market places for transparent and efficient renewable energy trading.
For a deep-dive into the motivation and methodology behind our technical solutions, read our White Papers:
This project is licensed under the MIT License - see the LICENSE file for details
Exchange project is currently not meant to be run as a separate nest application. In order to run exchange project please refer to https://github.com/energywebfoundation/origin/tree/master/packages/origin-backend-app
Default TypeOrm configuration requires running PostgreSQL database. The detailed config with .env parameters is:
DB_HOST - default 'localhost'
DB_PORT - default 5432
DB_USERNAME - default 'postgres',
DB_PASSWORD - default 'postgres',
DB_DATABASE - default 'origin',
or
DATABASE_URL - postgres://{user}:{password}@{host}:{port}/{database}
Exchange project uses TypeORM mechanism to perform SQL data migrations. For detailed information please refer to https://github.com/typeorm/typeorm/blob/master/docs/migrations.md
yarn typeorm:run to update DB to latest exchange tables schemayarn typeorm:migrate SampleMigrationName to create new migration file based on the changes in the code entitiesDevelopment flow:
yarn typeorm:run - to apply latest migrationsyarn typeorm:migrate LastestChanges...yarn typeorm:run to apply newly created migrationWarning:
Existing migration files from /migration folder should never be edited after being committed.
docker pull postgres
docker run --name origin-postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres
docker pull dpage/pgadmin4
docker run -p 80:80 \
-e 'PGADMIN_DEFAULT_EMAIL=user@domain.com' \
-e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' \
-d dpage/pgadmin4
example/example.sql contains a dump of database filled in with the example data:
id=1 as a buyer (owner of the bid orders)id=2 as a seller (owner of the ask orders), with confirmed deposit of 100MWh (100000000){"deviceType":["Solar;Photovoltaic;Classic silicon"],"location":["Thailand;Central;Nakhon Pathom"],"deviceVintage":{"year":2016}}{"deviceType":["Solar;Photovoltaic;Classic silicon"],"location":["Thailand;Central;Nakhon Pathom"],"deviceVintage":{"year":2016}}{"deviceType":["Wind"],"location":["Thailand;Northeast"]{"deviceType":["Wind;Onshore"],"location":["Thailand;Northeast;Nakhon Ratchasima"],"deviceVintage":{"year":2014}}In order to deploy the data please use pgadmin or psql or similar tools to import *.sql tool.
Notice that you might need to remove previously imported data in case of PK violations. Use
TRUNCATE "account","asset","demand","order","trade","transfer" CASCADE
with caution.
This can be used for fast integrations and testing
Swagger endpoint can be found at
http://localhost:3033/api
FAQs
A service project hosting order book based exchange
We found that @energyweb/exchange demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.