Giter Site home page Giter Site logo

allenlai-ad / core-genesis-contract Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coredao-org/core-genesis-contract

0.0 0.0 0.0 1.1 MB

Core blockchain genesis contracts.

License: Other

Shell 0.06% JavaScript 2.26% Python 72.55% Solidity 25.12%

core-genesis-contract's Introduction

Core Genesis Contracts

This repo holds all the genesis contracts on Core blockchain, which are part of the core implementations of Satoshi Plus consensus. For more information about Core blockchain and Satoshi Plus consensus, please read the technical whitepaper.

List of Contracts

  • BTCLightClient.sol: This contract implements a BTC light client on Core blockchain. Relayers store BTC blocks to Core blockchain by calling this contract. This contract calculates powers of BTC miners in each round, which is used to calculate hybrid score and reward distribution.
  • Burn.sol: This contract burns CORE tokens up to pre defined CAP.
  • CandidateHub.sol: This contract manages all validator candidates on Core blockchain. It also exposes the method turnRound for the consensus engine to execute the turn round workflow.
  • Foundation.sol: This is the DAO Treasury smart contract. The funds in this contract can only be moved through governance vote.
  • GovHub.sol: This is the smart contract to manage governance votes.
  • PledgeAgent.sol: This contract manages user delegate, also known as stake, including both coin delegate and hash delegate.
  • RelayerHub.sol: This contract manages BTC relayers on Core blockchain.
  • SlashIndicator.sol: This contract manages slash/jail operations to validators on Core blockchain.
  • SystemReward.sol: This smart contract manages funds for relayers and verifiers.
  • ValidatorSet.sol: This contract manages elected validators in each round. All rewards for validators on Core blockchain are minted in genesis block and stored in this contract.

Prepare

Install dependency:

npm install

Run Tests

# install test dependency
pip install -r requirements.txt

# generate contracts for testing
node generate-system.js --mock true
node generate-candidatehub.js --mock true
node generate-pledgeagent.js --mock true
node generate-validatorset.js --mock true
node generate-slash.js -c 1112

# run brownie tests
brownie test -v --stateful false

Flatten all system contracts:

npm run flatten

Generate genesis.json

  1. Edit init_holders.js file to alloc the initial CORE holders.
  2. Edit validators.js file to alloc the initial validator set.
  3. Edit init_cycle.js file to change core blockchain parameters.
  4. Edit generate-btclightclient.js file to change initConsensusStateBytes.
  5. Run node generate-genesis.js to generate genesis.json.

License

The library is licensed under the Apache License, Version 2.0, also included in our repository in the LICENSE file.

core-genesis-contract's People

Contributors

charles2022wood avatar eric0x01 avatar jackcrypto9527 avatar zfliex924 avatar

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.