go-randomx/README.md

36 lines
2.3 KiB
Markdown
Raw Normal View History

2019-10-15 19:55:56 +00:00
# RandomX (Golang Implementation)
2024-04-20 18:22:05 +00:00
RandomX is a proof-of-work (PoW) algorithm that is optimized for general-purpose CPUs.
RandomX uses random code execution (hence the name) together with several memory-hard techniques to minimize the efficiency advantage of specialized hardware.
---
2019-10-15 17:53:49 +00:00
2024-04-11 07:55:52 +00:00
Fork from [git.dero.io/DERO_Foundation/RandomX](https://git.dero.io/DERO_Foundation/RandomX). Also related, their [Analysis of RandomX writeup](https://medium.com/deroproject/analysis-of-randomx-dde9dfe9bbc6).
2019-10-15 19:27:36 +00:00
2024-04-11 07:55:52 +00:00
Original code failed RandomX testcases and was implemented using big.Float.
2019-10-15 19:27:36 +00:00
2024-04-20 18:22:05 +00:00
---
This package implements RandomX without CGO, using only Golang code, native float64 ops, some assembly, but with optional soft float _purego_ implementation.
2024-04-11 08:41:58 +00:00
All test cases pass properly.
2024-04-20 18:22:05 +00:00
For the C++ implementation and design of RandomX, see [github.com/tevador/RandomX](https://github.com/tevador/RandomX)
2024-04-20 18:22:05 +00:00
| Feature | 386 | amd64 | arm | arm64 | mips | mips64 | riscv64 | wasm |
|:----------------------------:|:---:|:-----:|:---:|:-----:|:----:|:------:|:-------:|:----:|
| purego | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Hardware Float Operations | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Hardware AES Operations | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Native Superscalar Execution | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Superscalar JIT Execution | ❌ | ✅* | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Native VM Execution | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| VM JIT Execution | ❌ | ✅* | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
2024-04-18 10:09:05 +00:00
2024-04-20 18:22:05 +00:00
A pure Golang implementation can be used on platforms without hard float support or via the `purego` build flag manually.
Any platform with no hard float support or when enabled manually will use soft float, using [softfloat64](https://git.gammaspectra.live/P2Pool/softfloat64). This will be very slow.
2024-04-18 10:09:05 +00:00
2024-04-20 18:22:05 +00:00
Native hard float can be added with supporting rounding mode under _asm_.
2024-04-18 10:09:05 +00:00
2024-04-20 18:22:05 +00:00
JIT only supported under Unix systems (Linux, *BSD, macOS), and can be hard-disabled via the `disable_jit` build flag, or at runtime.