GithubHelp home page GithubHelp logo

oscoin

Oscoin full node reference implementation in Haskell.

Warning: this implementation is a work in progress, and not ready for production use. The source code is provided here for informational purposes only.

Building

Build the full node with:

stack build

Running

First, generate a key pair for your node:

stack exec oscoin-cli -- keypair generate

Then run the full node with:

stack exec oscoin -- --blockstore blockstore.db --nakamoto-consensus-lenient --block-time-lower 600 --beneficiary 0x0000000000000000000000000000000000000000

Testing

Run the tests with file-watching with:

stack test --file-watch --fast

To load the tests in the repl, run:

stack repl oscoin:lib oscoin:test

Then run :main from the repl to run the tests, and reload with :r as necessary. You can run a subset of tests with :main -p "test pattern".

Using the --crypto option allow the tests to be run with either the mock crypto:

stack test --ta "--crypto mock"

Or with the "real world" implementation (i.e. the same one used in production):

stack test --ta "--crypto realworld"

If no --crypto option is specified, it defaults to the mock one.

Test organization

All tests are contained in the test directory. The tests contained in a module are exported through the tests value. The tests export defines a is a tasty test group with with the same name as the module name. Tests from test modules are imported and collected in the Main module.

For unit tests there is a one-to-one correspondence between the tested module and the test module. For example the tests for the code in module A.B.C are contained in Test.A.B.C which exports

tests = testGroup "Test.A.B.C" [ someTest ]

Profiling

To profile the test-suite, run:

stack test --profile -j4 --work-dir .stack-work-prof

This will output a file, test.prof which you can convert to an interactive svg with:

ghc-prof-flamegraph test.prof

This will require installation of ghc-prof-flamegraph. Then open the .svg with any browser.

Docs

To generate local package documentation, run:

stack haddock oscoin

To open the docs, run:

stack haddock oscoin --open

It's also possible to browse documentation/tutorials for individual components in the docs directory:

These documents are literate Haskell files pre-processed with markdown-unlit, so that they are executable code which can be kept up-to-date with the codebase. We also have a test-suite which ensure these documentation files keep compiling.

Copyright (c) Monadic, 2017-2019

open source coin's Projects

open source coin doesn’t have any public repositories yet.

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.