GithubHelp home page GithubHelp logo

navcoin / navcoin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitcoin/bitcoin

3.0 3.0 6.0 241.36 MB

Navcoin Core v8 [WIP]

Home Page: https://navcoin.org

License: MIT License

Shell 0.80% Python 14.44% Makefile 0.75% C++ 55.30% C 7.83% HTML 0.10% M4 0.91% Assembly 17.64% Scheme 0.11% CMake 0.35% Sage 0.27% Java 0.48% Cap'n Proto 0.01% Dockerfile 0.02% QMake 0.01% Batchfile 0.03% C# 0.48% Go 0.47% SWIG 0.01% JavaScript 0.01%
blockchain cryptocurrency p2p privacy proof-of-stake

navcoin's Introduction

Navcoin Core integration/staging tree

Navcoin Core is a fork of Bitcoin Core. This repository hosts the source code for the next version of Navcoin Core, which is not ready for production yet.

https://navcoin.org

For an immediately usable, binary version of the Navcoin Core software, see https://navcoin.org/get-started.

Further information about Navcoin Core is available in the doc folder, the wiki and the documentation website.

What is Navcoin?

Navcoin is an experimental digital currency that enables privacy-enhanced payments to anyone, anywhere in the world. Navcoin uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Navcoin Core is the name of open source software which enables the use of this currency.

License

Navcoin Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.

Development Process

The master branch is regularly built (see doc/build-*.md for instructions) and tested, but it is not guaranteed to be completely stable. Tags are created regularly from release branches to indicate new official, stable release versions of Navcoin Core.

The contribution workflow is described in CONTRIBUTING.md and useful hints for developers can be found in doc/developer-notes.md.

Testing

Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people lots of money.

Automated Testing

Developers are strongly encouraged to write unit tests for new code, and to submit new unit tests for old code. Unit tests can be compiled and run (assuming they weren't disabled in configure) with: make check. Further details on running and extending unit tests can be found in /src/test/README.md.

There are also regression and integration tests, written in Python. These tests can be run (if the test dependencies are installed) with: test/functional/test_runner.py

The CI (Continuous Integration) systems make sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically.

Manual Quality Assurance (QA) Testing

Changes should be tested by somebody other than the developer who wrote the code. This is especially important for large or high-risk changes. It is useful to add a test plan to the pull request description if testing the changes is not straightforward.

Translations

Changes to translations as well as new translations can be submitted to Navcoin Core's Transifex page.

Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works.

Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again.

navcoin's People

Contributors

achow101 avatar ajtowns avatar dongcarl avatar fanquake avatar gavinandresen avatar glozow avatar gmaxwell avatar gogoex avatar hebasto avatar jamesob avatar jnewbery avatar jonasschnelli avatar jonatack avatar kallewoof avatar laanwj avatar luke-jr avatar meshcollider avatar morcos avatar mxaddict avatar non-github-bitcoin avatar practicalswift avatar promag avatar ryanofsky avatar sdaftuar avatar sipa avatar sjors avatar thebluematt avatar thestack avatar theuni avatar vasild avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

navcoin's Issues

crypto: bulletproofs range proof over bls12-381

Depends on #14

Port src/blsct/bulletproofs.* from the old codebase using herumi/mcl and the classes created on #14.

Must include port of the test unit src/test/bulletproofsrangeproof_test.cpp.

The old codebase used gmp for arithmetic operations. We choose mcl over gmp for performance reasons.

p2p: update protocol magic bytes

Each network (mainnet, testnet, regnet) needs to get their protocol magic bytes updated to unique Navcoin values.

Ideally they should not be equal to other bitcoin-based networks, but for the sake of simplicity, they can be set randomly.

wallet: disable the wallet UI

Since after consideration we're not going to be using the GUI it can be perhaps disabled.
I put up this issue to see what you think.

wallet: remove libdb from build and source

Reasoning, since we are launching a new chain with this codebase, might make more sense to drop bdb support entirely and just use the new libsqlite wallet db exclusively.

The only reason for bdb support still remaining in upstream is for backwards compatibility with older wallet.dat files.

Rename binaries

  • [] Rename bitcoin* binaries to navcoin*
  • [] Update accordingly documentation in docs/

Address format

BLSCT addresses encode two BLS public keys. Each serialised public key takes 48 bytes.

Both base58check and bech32 encoding formats have issues encoding larger amounts of data, as the checksum is limited in its efficacy. The bech32 design explicitly limits the encoding and decoding to 41 bytes.

Therefor we will need to use our own modified version for the BLSCT addresses.

Tasks:

wallet: BLSCT key management

Depends on #55 and #28

The current wallet key manager needs to be updated to be a BLSCT-exclusive key store.

  • Derivation of BLSCT master keys from the wallet's master key.
masterKeyHash = DOUBLESHA256(masterKey);

masterBLSKey = derive_master_SK(masterKeyHash);

coinBLSKey = derive_child_SK(masterBLSKey, BIP32_HARDENED_KEY_LIMIT | 130);
transactionBLSKey = derive_child_SK(coinBLSKey, BIP32_HARDENED_KEY_LIMIT | 0);
blindingBLSKey = derive_child_SK(coinBLSKey, BIP32_HARDENED_KEY_LIMIT | 1);
viewBLSKey = derive_child_SK(transactionBLSKey, BIP32_HARDENED_KEY_LIMIT | 0);
spendBLSKey = derive_child_SK(transactionBLSKey, BIP32_HARDENED_KEY_LIMIT | 1);

{viewBLSKey, spendBLSKey, blindingBLSKey}
  • Storage of {viewBLSKey, spendBLSKey, blindingBLSKey} on the wallet key store.
  • Add support for generation of subaddresses. Check the documentation for reference.
  • Create a BLSCT sub address key pool.
  • Remove support and references of key management for SECP256k1 keys.

wallet: add mnemonic support

The currrent bitcoin core implementation does not support BIP-39 for wallet creation nor export, this task requires adding support for it:

  • RPC command dumpmnemonic with an optional argument specifying the dictionary language.
  • Command line options to create a wallet from a seed phrase. Add support to create a wallet from mnemonic with the rpc command createwallet and in the offline tool navcoin-wallet

crypto: create `blsctPublicKey`, `blsctDoublePublicKey` and `blsctKey` classes

Depends on #14

Two serialisable classes need to be created in src/blsct/:

  • blsctDoublePublicKey: wrapper around two G1Point elements.
  • blsctPublicKey: wrapper around one G1Point element.
  • blsctKey: wrapper around one Scalar element.

blsctDoublePublicKey will be used to hold a pair of BLS Public Keys (the View and Spend keys), which will later be used for address encoding and in wallet key management.

blsctPublicKey will represent a single BLS Public Key, which will later be used for signalling Token, NFT and dotNAV names ownership.

blsctKey will represent a single BLS Private Key. Special care needs to be taken so no trails of the private key data is left on memory after handling it. This can be achieved by using the bitcoin-core native CPrivKey class.

### blsctDoublePublicKey interface

    blsctDoublePublicKey();
    blsctDoublePublicKey(const G1Point& vk_, const G1Point& sk_);
    blsctDoublePublicKey(const std::vector<uint8_t>& vk_, const std::vector<uint8_t>& sk_);

    uint256 GetHash() const;
    CKeyID GetID() const;
    bool GetViewKey(G1Point &ret) const;
    bool GetSpendKey(G1Point &ret) const;
    bool operator<(const blsctDoublePublicKey& rhs) const;
    bool operator==(const blsctDoublePublicKey& rhs) const;
    bool IsValid() const;
    std::vector<uint8_t> GetVkVch() const;
    std::vector<uint8_t> GetSkVch() const;

### blsctPublicKey interface

    blsctPublicKey() { vk.clear(); }
    blsctPublicKey(const G1Point& vk_) : vk(vk_.Serialize()) {}
    blsctPublicKey(const std::vector<uint8_t>& vk_) : vk(vk_) {}

    uint256 GetHash() const;
    CKeyID GetID() const;
    bool GetG1Element(G1Point& ret) const;
    bool operator<(const blsctPublicKey& rhs) const;
    bool operator==(const blsctPublicKey& rhs) const;
    bool IsValid() const;
    std::vector<uint8_t> GetVch() const;

### blsctKey interface

    blsctKey();
    blsctKey(Scalar k_);
    blsctKey(CPrivKey k_);
    bool operator<(const blsctKey& rhs) const;
    bool operator==(const blsctKey& rhs) const;
    blsPublicKey GetPublicKey() const;
    bls::PrivateKey GetKey() const;
    Scalar GetScalar() const;

    bool IsValid() const;
    void SetToZero();

    // herumi/mcl does not implement key derivation so the 
    // next functions will be completed in a later task
    blsctKey PrivateChild(uint32_t i) const;
    blsctKey PrivateChildHash(uint256 h) const;
    blsctPublicKey PublicChild(uint32_t i) const;

### Code references

key.h

crypto: implement BLS signatures

Create a class blsct::Signature with the following methods:

Add the following methods to blsct::PrivateKey:

Splash screen is black until the end of loading

This is really low priority but on my Wayland machine (MS Windows 11) the splash screen does not show the graphics until the loading is done and the splash screen is taken down. I think I could investigate this and push back a patch upstream.

net: create devnet network

Add a new devnet network, which will be used for local development tests.

-devnet is used to use it.

This network will generate a new genesis block each time the node boots.

Old codebase hints

Look for devnet occurrences in the old codebase for the needed changes, specially (but not exclusively):

  • src/chainparams.cpp
  • src/chainparamsbase.cpp/h

doc: document performance improvements from the use of gmp

I'm attaching two benchmarks of herumi/mcl with and without using gmp.

with_gmp.txt
without_gmp.txt

The version without gmp was built using make MCL_USE_GMP=0.

Benchmarked using ./bin/bls12_test. gmp gives a ~20% speed up.

We should indicate in the documentation the benefits of installing gmp as a dependency (which will be automatically detected by mcl) and include it in our depends/ so reproducible builds benefit from it.

crypto: create classes for arithmetic operations on the bls12-381 curve

Depends on #11

Two serialisable classes need to be created in src/blsct/arith/:

  • Scalar: wrapper around mcl::bn:Fr
  • G1Point: wrapper around mcl::bn::G1

implementing operator overload for the arithmetic operations provided by herumi/mcl.

Additional bitwise operations need to be implemented, which are not covered by herumi/mcl.

Scalar interface

    Scalar(const uint64_t& n = 0);
    Scalar(const std::vector<uint8_t> &v);
    Scalar(const Scalar& n);
    Scalar(const uint256& n);

    void operator=(const uint64_t& n);

    Scalar operator+(const Scalar &b) const;
    Scalar operator-(const Scalar &b) const;
    Scalar operator*(const Scalar &b) const;
    Scalar operator/(const Scalar &b) const;
    Scalar operator|(const Scalar &b) const;
    Scalar operator^(const Scalar &b) const;
    Scalar operator&(const Scalar &b) const;
    Scalar operator~() const;
    Scalar operator<<(const int &b) const;
    Scalar operator>>(const int &b) const;

    bool operator==(const Scalar& b) const;
    bool operator==(const int &b) const;

    Scalar Invert() const;
    Scalar Negate() const;

    static Scalar Rand();
    static Scalar hashAndMap(std::vector<unsigned char>);

    bool GetBit(size_t n) const;
    int64_t GetInt64() const;

    std::vector<uint8_t> GetVch() const;
    void SetVch(const std::vector<uint8_t>& b);

    void SetPow2(const int& n);

    uint256 Hash(const int& n) const;

    std::string GetString();

G1Point interface

    G1Point();
    G1Point(const std::vector<uint8_t>& v);
    G1Point(const G1Point& n);
    G1Point(const uint256 &b);

    G1Point operator+(const Point &b) const;
    G1Point operator-(const Point &b) const;
    G1Point operator*(const Scalar &b) const;

    G1Point Normalize() const;
    G1Point Double() const;

    static G1Point getBasePoint();
    static G1Point hashAndMap(std::vector<unsigned char>);
    static G1Point mulVec(std::vector<G1Point>, std::vector<Scalar>);

    bool operator==(const Point& b) const;

    static G1Point Rand();

    bool IsUnity() const;

    std::vector<uint8_t> GetVch() const;
    void SetVch(const std::vector<uint8_t>& b);

    std::string GetString();

Documentation reference

https://github.com/herumi/mcl/blob/master/api.md

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.