github.com/koko1123/flow-go-1@v0.29.6/README.md (about)

     1  # Flow [![GoDoc](https://godoc.org/github.com/onflow/flow-go?status.svg)](https://godoc.org/github.com/onflow/flow-go)
     2  
     3  Flow is a fast, secure, and developer-friendly blockchain built to support the next generation of games, apps and the
     4  digital assets that power them. Read more about it [here](https://github.com/onflow/flow).
     5  
     6  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
     7  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
     8  
     9  ## Table of Contents
    10  
    11  - [Getting started](#getting-started)
    12  - [Documentation](#documentation)
    13  - [Installation](#installation)
    14      - [Clone Repository](#clone-repository)
    15      - [Install Dependencies](#install-dependencies)
    16  - [Development Workflow](#development-workflow)
    17      - [Testing](#testing)
    18      - [Building](#building)
    19      - [Local Network](#local-network)
    20      - [Code Generation](#code-generation)
    21  
    22  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
    23  
    24  ## Getting started
    25  
    26  - To install all dependencies and tools, see the [project setup](#installation) guide
    27  - To dig into more documentation about Flow, see the [documentation](#documentation)
    28  - To learn how to contribute, see the [contributing guide](/CONTRIBUTING.md)
    29  - To see information on developing Flow, see the [development workflow](#development-workflow)
    30  
    31  ## Documentation
    32  
    33  You can find an overview of the Flow architecture on the [documentation website](https://www.onflow.org/primer).
    34  
    35  Development on Flow is divided into work streams. Each work stream has a home directory containing high-level
    36  documentation for the stream, as well as links to documentation for relevant components used by that work stream.
    37  
    38  The following table lists all work streams and links to their home directory and documentation:
    39  
    40  | Work Stream        | Home directory                             |
    41  |--------------------|--------------------------------------------|
    42  | Access Node        | [/cmd/access](/cmd/access)                 |
    43  | Collection Node    | [/cmd/collection](/cmd/collection)         |
    44  | Consensus Node     | [/cmd/consensus](/cmd/consensus)           |
    45  | Execution Node     | [/cmd/execution](/cmd/execution)           |
    46  | Verification Node  | [/cmd/verification](/cmd/verification)     |
    47  | Observer Service   | [/cmd/observer](/cmd/observer)             |
    48  | HotStuff           | [/consensus/hotstuff](/consensus/hotstuff) |
    49  | Storage            | [/storage](/storage)                       |
    50  | Ledger             | [/ledger](/ledger)                         |
    51  | Networking         | [/network](/network/)                      |
    52  | Cryptography       | [/crypto](/crypto)                         |
    53  
    54  ## Installation
    55  
    56  ### Clone Repository
    57  
    58  - Clone this repository
    59  - Clone this repository's submodules:
    60  
    61      ```bash
    62      git submodule update --init --recursive
    63      ```
    64  
    65  ### Install Dependencies
    66  
    67  - Install [Go](https://golang.org/doc/install) (Flow supports Go 1.18 and later)
    68  - Install [CMake](https://cmake.org/install/), which is used for building the crypto library
    69  - Install [Docker](https://docs.docker.com/get-docker/), which is used for running a local network and integration tests
    70  - Make sure the [`GOPATH`](https://golang.org/cmd/go/#hdr-GOPATH_environment_variable) and `GOBIN` environment variables
    71    are set, and `GOBIN` is added to your path:
    72  
    73      ```bash
    74      export GOPATH=$(go env GOPATH)
    75      export GOBIN=$GOPATH/bin
    76      export PATH=$PATH:$GOBIN
    77      ```
    78  
    79    Add these to your shell profile to persist them for future runs.
    80  - Then, run the following command:
    81  
    82      ```bash
    83      make install-tools
    84      ```
    85  
    86  At this point, you should be ready to build, test, and run Flow! 🎉
    87  
    88  Note: Whenever the crypto module version imported by "go.mod" is updated to a version that was never locally imported before, the crypto dependency needs to be set-up. If not, you should notice errors about "relic" or "crypto". Run the following command to set-up the new module version:
    89  
    90  ```bash
    91  make crypto_setup_gopath
    92  ```
    93  
    94  ## Development Workflow
    95  
    96  ### Testing
    97  
    98  Flow has a unit test suite and an integration test suite. Unit tests for a module live within the module they are
    99  testing. Integration tests live in `integration/tests`.
   100  
   101  Run the unit test suite:
   102  
   103  ```bash
   104  make test
   105  ```
   106  
   107  Run the integration test suite:
   108  
   109  ```bash
   110  make integration-test
   111  ```
   112  
   113  ### Building
   114  
   115  The recommended way to build and run Flow for local development is using Docker.
   116  
   117  Build a Docker image for all nodes:
   118  
   119  ```bash
   120  make docker-build-flow
   121  ```
   122  
   123  Build a Docker image for a particular node role (replace `$ROLE` with `collection`, `consensus`, etc.):
   124  
   125  ```bash
   126  make docker-build-$ROLE
   127  ```
   128  
   129  ### Local Network
   130  
   131  A local version of the network can be run for manual testing and integration. See
   132  the [Local Network Guide](/integration/localnet/README.md) for instructions.
   133  
   134  ### Code Generation
   135  
   136  Generated code is kept up to date in the repository, so should be committed whenever it changes.
   137  
   138  Run all code generators:
   139  
   140  ```bash
   141  make generate
   142  ```
   143  
   144  Generate protobuf stubs:
   145  
   146  ```bash
   147  make generate-proto
   148  ```
   149  
   150  Generate OpenAPI schema models:
   151  
   152  ```bash
   153  make generate-openapi
   154  ```
   155  
   156  Generate mocks used for unit tests:
   157  
   158  ```bash
   159  make generate-mocks
   160  ```