npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@unification-com/xfund-vor

v0.2.6

Published

xFUND VOR

Downloads

11

Readme

GitHub release (latest by date) npm sc unit tests

Verified Open Randomness

A suite of Ethereum smart contracts, and accompanying Provider Oracle software for running VOR, and integrating VOR into your own smart contracts.

VOR Integration Quickstart

  1. Install the package
yarn add @unification-com/xfund-vor

or

npm i @unification-com/xfund-vor
  1. Import VORConsumerBase.sol into your contract and pass parameters to your constructor
import "@unification-com/xfund-vor/contracts/VORConsumerBase.sol";

contract MyRandomNumberContract is VORConsumerBase {
    constructor(address _vorCoordinator, address _xfund)
    public VORConsumerBase(_vorCoordinator, _xfund) {
        // other stuff...
    }
}
  1. Implement a requestRandomness function
    function requestRandomness(uint256 _userProvidedSeed, bytes32 _keyHash, unit256 _fee) 
    external
    returns (bytes32 requestId) {
        requestId = requestRandomness(_keyHash, _fee, _userProvidedSeed);
        // other stuff...
    }
  1. Implement the fulfillRandomness function for data Providers to send data
    function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
        // do something with the received number
        uint256 randVal = randomness.mod(999).add(1);
        // other stuff...
    }

Development and Testing

Clone of fork

git clone https://github.com/unification-com/xfund-vor
npx truffle compile

Dev Environment

A complete Dockerised development environment is available, which is useful for both contributing to the development of VOR and when developing your own VOR-enabled smart contracts.

The development environment can be run using:

make dev-env

Alternatively, run the docker commands as follows:

docker build -t vor_dev_env -f docker/dev.Dockerfile .
docker run -it -p 8545:8545 -p 8445:8445 vor_dev_env

The environment will:

  1. Spawn a deterministic ganach-cli development chain with 20 accounts funded with 100 ETH
  2. Compile and deploy the necessary VOR smart contracts
  3. Initialise the test accounts, send test tokens and register the Oracle's proving key
  4. Run the oracle application

The container exposes port 8545 allowing the Ganache chain to be accessible via http://127.0.0.1:8545

Additionally, port 8445 is exposed, allowing the oracle to be accessed using the oracle-cli tool.

Dev environment configuration

  • Ganache CLI wallet mnemonic: myth like bonus scare over problem client lizard pioneer submit female collect
  • Ganache CLI URL: http://127.0.0.1:8545
  • Ganache CLI Network/Chain ID: 696969
  • VORCoordinator Contract address: 0xCfEB869F69431e42cdB54A4F4f105C19C080A601
  • BlockHashStore contract address: 0x5b1869D9A4C187F2EAa108f3062412ecf0526b24
  • VOR Oracle Wallet Address: 0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0
  • VOR Oracle KeyHash: 0x1a7a24165e904cb38eb8344affcf8fdee72ac11b5c542428b35eef5769c409f0
  • VOR Oracle API key: 0pear3uoznba36fwzoaspwrvc164bkjd

oraclecli in the Dev environment

You will need to build the tool:

make build-oracle-cli

The oracle-cli commands should now be available when the dev environment is running, for example:

./oracle-cli/build/oraclecli about -c ./docker/assets/oracle-cli_settings.json

Note: you will need to pass the -c ./docker/assets/oracle-cli_settings.json flag with each command in order to use the correct connection settings.

Unit Testing

Run smart contract tests:

yarn test

Run oracle tests:

make test-oracle

This will run the go tests in a self-contained, dockerised environment. A Ganache network will be run within the container for the tests to run against.