Giter Site home page Giter Site logo

ambrosus-nop's Introduction

Build Status

Ambrosus protocol

This repository contains smart contracts constituting Ambrosus protocol, in particular:

  • Smart contracts constituting Ambrosus protocol
  • Amber - ERC20 Token representing powering Ambrosus protocol
  • ICO Contribution contract

Installation and use

To add ambrosus to your project:

npm i -S ambrosus

And import to module in your application:

import ambrosus from 'ambrosus'

Architecture:

Ambrosus architecture consists of 3 main layers:

  • dependencies - to run properly Amborsus requires Ethereum and IPFS
  • smart contracts - building blocks of Ambrosus protocol
  • javascript library - that allows to create and operate Ambrosus contracts and objects

Architecture overview

All 3 parts are stored in this repository. Following is a description of 3 layers introduced above.

Smart Contracts

Smart contracts are the core of ambrosus protocol. The system of contracts is written in Solidity and compiled to EVM (Ethereum Virtual Machine). Contracts are combined together to co-operate and create services around quality assurance in food and pharma supply chains. They are abstract building blocks for different applications.

There are some basic abstractions in the protocol, including:

  • Measurements - a contract abstraction used to store measurements - a basic unit of a history of an item in supply chain
  • Requirements - a basic way to describe expectations about product in supply chain
  • Validator - a way to check if given product's history (list of measurements) meets specific validation rules (e.g. meet requirements)
  • Agreement - represents agreement between Parties, with specific rules considering product in supply chain

In a top of those abstractions are build implementations for specific use cases. They are more concrete building blocks. Examples are:

  • MeasurementsOnChain - allows measurements devices to store measurements on the Ethereum blockchain, note: this might very inefficient and therefore one should for production purposes use the following contract.
  • MeasurementsOffChain - allows measurements devices to store measurements off the blockchain, in this case on the IPFS. Measurements can be later verified using this contract on their origin (e.g. if they come from authorized devices) and completeness (if any thing is missing)
  • Range requirements - allow expressing expectations in future or past measurements

In the top of that we build more complete solutions per use case e.g.:

  • Market - a marketplace for buying and selling food. Suppliers can create profiles using their Ethereum wallets. Buyer can sellers can make agreements directly on the market.
  • DeliveryAgreement - allows parties to make a delivery agreement in the form of contract on Ethereum. Agreement uses building blocks like Requirements to define the quality standard of food agreed upon. Measurements to store information delivered by measurement devices along the way. The agreement can use escrow, so the money for the supplier is automatically released if all conditions from the agreement are met. On the other hand, the buyer can reimburse if delivered food did not meet quality standard agreed upon.

Ambrosus.js

Ambrosus comes with a javascript library that makes using protocol easy and straight forward. Eg. to create a new offer on the market on can use following code:

    let exampleOffer = {
        name: 'Tune',
        origin: 'Japan',
        category: 'Fish',
        packageWeight: 100,
        pricePerUnit: 100,
        pricePerPackage: 100,
        imageHash: 'QmWWQSuPMS6aXCbZKpEjPHPUZN2NjB3YrhJTHsV4X3vb2t', //Image hash on IPFS
        seller: ..., // Seller wallet address 
        measurementsAddress: ..., // Measurements contract address
        requirementsAddress: ..., // Requirements contract address
        validatorAddress: ..., // Validator contract address
    };

And to put in on the market:

    offerRepo = new OfferRepository(OfferContract);
    marketRepo = new MarketRepository(MarketContract);
    market = ...;
    await offerRepo.save(market.getAddress(), exampleOffer);

Or to create a new market:

    await marketRepo.create(accounts[0]);

Below is an example architecture overview for two apps build in top of Ambrosus protocol.

Example architecture overview

Detailed documentation coming soon.

Contribution

  1. Clone repository

    git clone [email protected]:ambrosus/Ambrosus.git
    cd Ambrosus
    
  2. Install global dependencies, such as Truffle (requires NodeJS 5.0+) and Testrpc, then install local dependencies:

    npm install
    
  3. Before running tests make sure testrpc is up:

    testrpc
    
  4. Running tests

    truffle test
    

Acknowledgements

Contribution and token contracts have been influenced by the work of MelonPort and by Condition-Orientated Programming approach.

ambrosus-nop's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ambrosus-nop's Issues

Ubuntu 18.04 Installscript error web3

Running on a fresh 18.04.2 LTS installation on Vultr the script runs into an error at install of the web3.

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'

This I was able to bypass installing the devtool
sudo apt-get install python3-setuptools

Then the next error is again at web3 install
error: invalid command 'bdist_wheel'
So I also installed pip3 install wheel
Again errors -> Resolution to install apt-get install python-dev

Now the dependencies are resolved, you can start the installer again.

Feature Request: Allow Running Parity Outside of Docker

my node (the docker host) runs with a LAN address. Node is working fine but I see the firewall dropping a lot of connections on 30303.

I would like to create a NIC dedicated for the parity docker, so that the docker container uses an interface managed by the firewall (10.10.10.x), not a 172.0.20.x.

Any suggestions on how to go about that? The options I've looked into are

Long story short: It'd be much simpler for me to use parity outside of docker. Is this possible?

Parity Chaindata Size

Is there a particular reason to not run the parity node with parity +warp -ancient?

140GB+ for chaindata (size since the config is for warp = false) seems unnecessary, but again I am not in full understanding of what the parity node will be used for. (will the parity node go away once AMB is on mainnet?)

Also, parity with these flags will not sync (or take weeks to sync) unless the disk is NVME SSD.

Or do I have misundersood this entirely and the node is using parity, on Ethereum ports, to run the AMB chain?

update.sh: yarn not found

# ./update.sh 
net.ipv6.conf.all.disable_ipv6 = 1
Updated 0 paths from the index
From https://github.com/ambrosus/ambrosus-nop
 * branch            master     -> FETCH_HEAD
Already up to date.
=> nvm is already installed in /root/.nvm, trying to update using git
=> => Compressing and cleaning up git repository

=> nvm source string already in /root/.bashrc
=> bash_completion source string already in /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
The nvm has been installed.
Now using node v14.18.1 (npm v6.14.15)
default -> 14 (-> v14.18.1)
./update.sh: line 35: yarn: command not found

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.