wangyi160 / chiapos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chia Proof of Space

Build PyPI PyPI - Format GitHub

Total alerts Language grade: Python Language grade: C/C++

Chia's proof of space is written in C++. Includes a plotter, prover, and verifier. It exclusively runs on 64 bit architectures. Read the Proof of Space document to learn about what proof of space is and how it works.

C++ Usage Instructions

Compile

# Requires cmake 3.14+

mkdir -p build && cd build
cmake ../
cmake --build . -- -j 6

Run tests

./RunTests

CLI usage

./ProofOfSpace -k 25 -f "plot.dat" -m "0x1234" create
./ProofOfSpace -k 25 -f "final-plot.dat" -m "0x4567" -t TMPDIR -2 SECOND_TMPDIR create
./ProofOfSpace -f "plot.dat" prove <32 byte hex challenge>
./ProofOfSpace -k 25 verify <hex proof> <32 byte hex challenge>
./ProofOfSpace -f "plot.dat" check <iterations>

Benchmark

time ./ProofOfSpace -k 25 create

Hellman Attacks usage

There is an experimental implementation which implements some of the Hellman Attacks that can provide significant space savings for the final file.

./HellmanAttacks -k 18 -f "plot.dat" -m "0x1234" create
./HellmanAttacks -f "plot.dat" check <iterations>

Python

Finally, python bindings are provided in the python-bindings directory.

Install

python3 -m venv .venv
. .venv/bin/activate
pip3 install .

Run python tests

Testings uses pytest. Linting uses flake8 and mypy.

py.test ./tests -s -v

ci Building

The primary build process for this repository is to use GitHub Actions to build binary wheels for MacOS, Linux (x64 and aarch64), and Windows and publish them with a source wheel on PyPi. See .github/workflows/build.yml. CMake uses FetchContent to download pybind11. Building is then managed by cibuildwheel. Further installation is then available via pip install chiapos e.g.

Contributing and workflow

Contributions are welcome and more details are available in chia-blockchain's CONTRIBUTING.md.

The main branch is usually the currently released latest version on PyPI. Note that at times chiapos will be ahead of the release version that chia-blockchain requires in it's main/release version in preparation for a new chia-blockchain release. Please branch or fork main and then create a pull request to the main branch. Linear merging is enforced on main and merging requires a completed review. PRs will kick off a GitHub actions ci build and analysis of chiapos at lgtm.com. Please make sure your build is passing and that it does not increase alerts at lgtm.

修改说明:

  1. 临时文件位置调整

调整了一下tmp文件的位置,用于sort的文件位于 -t 指定的文件夹,而table和2.tmp文件位于 -2 指定的文件夹。 因此该版本的使用方法是一定要同时配置 -t 和 -2 参数,否则会出错。

  1. 排序算法的策略修改

尽量的使用uniform sort,因为经测试,该种排序方式要比quick sort速度更快,平均时间只有quick sort的50%左右,但是它要占用更大的内存空间。 因此该版本的使用方法是在 -k 32 的情况下,应设置8G的内存,-b 8000。(没有测试下限为多少,可能在6G左右)

About

License:Apache License 2.0


Languages

Language:HTML 37.5%Language:C++ 36.2%Language:C 19.7%Language:Assembly 5.9%Language:Python 0.5%Language:CMake 0.1%Language:Gnuplot 0.0%Language:Dockerfile 0.0%Language:Shell 0.0%