Golang implementation of RandomX
Go to file
DataHoarder b0265950b6
All checks were successful
continuous-integration/drone/push Build is passing
Disable large page testing on 32-bit platforms
2024-05-02 16:28:38 +02:00
internal Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
.drone.yml Add hard float support for arm platform, add tests 2024-05-02 04:16:52 +02:00
cache.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
cache_test.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
commitment.go Added CalculateCommitment api for RandomX v2 hashes, added further testing 2024-05-02 03:46:03 +02:00
commitment_test.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
config.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
dataset.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
exec.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
flags.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
go.mod Version v3.0.0, support full datataset mode in 64-bit targets, modified api, optimized allocations, full VM run JIT on amd64, optimize AES asm 2024-04-23 04:33:42 +02:00
go.sum Include softfloat64 and allow for purego implementation 2024-04-17 06:04:29 +02:00
jit_amd64.go Match functionality / API with upstream randomx 2024-05-02 02:25:17 +02:00
jit_generic.go Match functionality / API with upstream randomx 2024-05-02 02:25:17 +02:00
LICENSE Working RandomX with minimal assembly for rounding mode (AMD64,ARM64) 2024-04-11 08:46:34 +02:00
math.go Version v3.0.0, support full datataset mode in 64-bit targets, modified api, optimized allocations, full VM run JIT on amd64, optimize AES asm 2024-04-23 04:33:42 +02:00
math_test.go Added CalculateCommitment api for RandomX v2 hashes, added further testing 2024-05-02 03:46:03 +02:00
randomx.go Update 'randomx.go' 2019-10-15 20:31:51 +02:00
randomx_test.go Disable large page testing on 32-bit platforms 2024-05-02 16:28:38 +02:00
README.md Add hard float support for arm platform, add tests 2024-05-02 04:16:52 +02:00
register.go Reduce heap allocations under VM 2024-05-01 16:58:49 +02:00
superscalar.go Match functionality / API with upstream randomx 2024-05-02 02:25:17 +02:00
superscalar_instruction.go Match functionality / API with upstream randomx 2024-05-02 02:25:17 +02:00
superscalar_jit_amd64.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
superscalar_jit_amd64.s Ensure 16-byte alignment of dataset/scratchpad/register file and use more performance fetch/write SIMD on amd64 2024-05-02 12:06:38 +02:00
superscalar_noasm.go redo JIT superscalar to include less custom assembly 2024-04-19 17:53:43 +02:00
vm.go Support large pages, implement aligned / paged / large paged allocators 2024-05-02 16:18:50 +02:00
vm_bytecode.go amd64: Implemented VM JIT 2024-04-20 19:53:47 +02:00
vm_bytecode_jit_amd64.go Ensure 16-byte alignment of dataset/scratchpad/register file and use more performance fetch/write SIMD on amd64 2024-05-02 12:06:38 +02:00
vm_bytecode_jit_amd64.s Ensure 16-byte alignment of dataset/scratchpad/register file and use more performance fetch/write SIMD on amd64 2024-05-02 12:06:38 +02:00
vm_bytecode_jit_generic.go Version v3.0.0, support full datataset mode in 64-bit targets, modified api, optimized allocations, full VM run JIT on amd64, optimize AES asm 2024-04-23 04:33:42 +02:00
vm_bytecode_native.go Add hard float support for arm platform, add tests 2024-05-02 04:16:52 +02:00
vm_bytecode_purego.go Add hard float support for arm platform, add tests 2024-05-02 04:16:52 +02:00
vm_instruction.go Split hard/soft AES implementations 2024-05-01 16:25:35 +02:00
vm_instruction_native.go Include softfloat64 and allow for purego implementation 2024-04-17 06:04:29 +02:00
vm_instruction_purego.go Include softfloat64 and allow for purego implementation 2024-04-17 06:04:29 +02:00

RandomX (Golang Implementation)

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.


Fork from git.dero.io/DERO_Foundation/RandomX. Also related, their Analysis of RandomX writeup.

Original code failed RandomX testcases and was implemented using big.Float.


This package implements RandomX without CGO, using only Golang code, native float64 ops, some assembly, but with optional soft float purego implementation.

All test cases pass properly.

Supports Full mode and Light mode.

For the C++ implementation and design of RandomX, see github.com/tevador/RandomX

Feature 386 amd64 arm arm64 mips mips64 riscv64 wasm
purego
Full Mode
Float Operations hw hw hw hw soft soft soft soft
AES Operations soft hw soft soft soft soft soft soft
Superscalar Execution interpreter compiler interpreter interpreter interpreter interpreter interpreter interpreter
VM Execution interpreter compiler interpreter interpreter soft soft soft soft

A pure Golang implementation can be used on platforms without hard float support or via the purego build tag manually.

TinyGo is supported under the purego build tag.

Any platform with no hard float support or when enabled manually will use soft float, using softfloat64. This will be very slow.

Full mode is NOT recommended in 32-bit systems and is unsupported, although depending on system it might be able to run. You might want to manually run runtime.GC() if cleaning up dataset to free memory.

Native hard float can be added with supporting rounding mode under asm.

JIT only supported under Unix systems (Linux, *BSD, macOS), and can be hard-disabled via the disable_jit build flag, or at runtime.