1. 每日区块链首页
  2. 学院
  3. 技术文档

Chain Core Developer Edition

Blockchain production environment deployment

Chain Core Developer Edition

Chain Core

is software designed to operate and connect to highly scalable permissioned blockchain networks conforming to the Chain Protocol. Each network maintains a cryptographically-secured transaction log, known as a blockchain, which allows partipicants to define, issue, and transfer digital assets on a multi-asset shared ledger. Digital assets share a common, interoperable format and can represent any units of value that are guaranteed by a trusted issuer — such as currencies, bonds, securities, IOUs, or loyalty points. Each Chain Core holds a copy of the ledger and independently validates each update, or “block,” while a federation of block signers ensures global consistency of the ledger.

Chain Core Developer Edition

is a free, downloadable version of Chain Core that is open source and licensed under the AGPL. Individuals and organizations use Chain Core Developer Edition to learn, experiment, and build prototypes.

Chain Core Developer Edition can be run locally on Mac, Windows, or Linux to create a new blockchain network, connect to an existing blockchain network, or connect to the public Chain testnet, operated by Chain, Microsoft, and Cornell University’s IC3.

Contributing

Chain has adopted the code of conduct defined by the Contributor Covenant. It can be read in full here. This repository is the canonical source for Chain Core Developer Edition. Consequently, Chain engineers actively maintain this repository. If you are interested in contributing to this code base, please read our issue and pull request templates first.

Building from source

  • Go version 1.8, with $GOPATH set to your preferred directory
  • Postgres (we suggest Postgres.app), along with the command line tools
  • protoc 3.1.0 and protoc-gen-g, if you need to compile protos
  • CMake 3.4 or later, to compile RocksDB and its dependencies

Environment

Set the CHAIN environment variable, in .profile in your home directory, to point to the root of the Chain source code repo:

Chain Core Developer Edition

You should also add $CHAIN/bin to your path (as well as $(go env GOPATH)/bin, if it isn’t already):

Chain Core Developer Edition

You might want to open a new terminal window to pick up the change.

Installation

Clone this repository to $CHAIN:

Chain Core Developer Edition

You can build Chain Core using the build-cored-release script. The build product allows connections over HTTP, unauthenticated requests from localhost, and the ability to reset the Chain Core.

build-cored-release accepts a accepts a Git ref (branch, tag, or commit SHA) from the chain repository and an output directory:

Chain Core Developer Edition

This will create two binaries in the current directory:

  • cored: the Chain Core daemon and API server
  • corectl: control functions for a Chain Core

Set up the database:

Chain Core Developer Edition

Start Chain Core:

Chain Core Developer Edition

Access the dashboard:

Chain Core Developer Edition

Run tests:

Chain Core Developer Edition

Building from source

There are four build tags that change the behavior of the resulting binary:

  • reset: allows the core database to be reset through the api
  • localhost_auth: allows unauthenticated requests on the loopback device (localhost)
  • no_mockhsm: disables the MockHSM provided for development
  • http_ok: allows plain HTTP requests
  • init_cluster: automatically creates a single process cluster

The default build process creates a binary with three build tags enabled for a friendlier experience. To build from source with build tags, use the following command:

NOTE: when building from source, make sure to check out a specific tag to build. The main branch is not considered stable, and may contain in progress features or an inconsistent experience.

Chain Core Developer Edition

Developing Chain Core

Updating the schema with migrations

Chain Core Developer Edition

Dependencies

To add or update a Go dependency at import path x, do the following:

Copy the code from the package’s directory to $CHAIN/vendor/x. For example, to vendor the package github.com/kr/pretty, run

Chain Core Developer Edition

(Note: don’t put a trailing slash (/) on these paths. It can change the behavior of cp and put the files in the wrong place.)

In your commit message, include the commit hash of the upstream repo for the dependency. (You can find this with git rev-parse HEAD in the upstream repo.) Also, make sure the upstream working tree is clean. (Check with git status.)

 

原创文章,作者:每日区块链,如若转载,请注明出处:http://www.dayqkl.com/2745.html

发表评论

登录后才能评论
QR code