Dart wrapper for RandomX proof-of-work (PoW) algorithm.

Overview

dart_randomx

pub package Null Safety CI GitHub Tag New Commits Last Commits Pull Requests Code size License

Dart wrapper for RandomX proof-of-work (PoW) algorithm.

Usage

A simple usage example:

import 'dart:typed_data';
import 'package:dart_randomx/dart_randomx.dart';

Future<void> main() async {
  await RandomX.loadLib();

  var randomX = RandomX();

  print(randomX);

  var key = Uint8List.fromList([97, 98, 99, 100, 101, 102, 0]);
  randomX.init(key);

  var data = Uint8List.fromList([65, 66, 67, 68, 69, 0]);

  var hash = randomX.hash(data);
  print(hash);

  randomX.destroy();
}

RandomX Full Memory

The RandomX algorithm has 2 modes:

  • slow: uses less memory but is slower.
  • fast: faster (about 10x) but uses 2G+ of memory.

To activate the fast mode just initialize it passing fullMemory as true:

Future<void> main() async {
  await RandomX.loadLib();
  
  var randomX = RandomX();
  randomX.init(key, fullMemory: true);
}

Project Build

See the script build-ffi-lib.sh to build the libraries:

  • randomx: the RandomX PoW algorithm.
  • wrapper_randomx: dart:ffi wrapper of lib randomx.

The directory wrapper_randomx_library has the source code for the dart:ffi wrapper and the build scripts:

  • build-librandomx.sh:

    Will clone the RandomX project, build it and place the library file librandomx.a at wrapper_randomx_library/ to then build the wrapper.

  • build-wrapper.sh:

    Builds the wrapper, linking with librandomx.a.

NOTE: This process was tested on MaxOS and Ubuntu.

RandomX Project

The RandomX proof-of-work (PoW) algorithm can be found at:

NOTE: The script build-librandomx.sh automatically clones and builds it.

RandomX Configuration

The RandomX project recommends a different configuration for each coin, defined by the file RandomX/src/configuration.h. See the configuration documentation:

The default configuration for this project is the same of Monero:

  • wrapper_randomx_library/configuration-monero.h

NOTE: RandomX was originally developed for Monero.*

Author

Graciliano M. Passos: gmpassos@GitHub.

License

BSD-3-Clause License

You might also like...

A MangaDex API wrapper for Dart/Flutter

A MangaDex API wrapper for Dart Usage A simple usage example: import 'package:mangadex_api/mangadex_api.dart'; main() { var client = MDClient();

Dec 2, 2022

A most easily usable RESAS API wrapper in Dart. With this library, you can easily integrate your application with the RESAS API.

A most easily usable RESAS API wrapper library in Dart! 1. About 1.1. What Is RESAS? 1.2. Introduction 1.2.1. Install Library 1.2.2. Import It 1.2.3.

Apr 7, 2022

A most easily usable JSON wrapper library in Dart

A most easily usable JSON response wrapper library in Dart! 1. About 1.1. Introd

Jan 4, 2022

An api wrapper for FortniteApi.io in dart.

Fortnite An api wrapper for FortniteApi.io in dart. Installation Add this to your package's pubspec.yaml file: dependencies: fortnite_api_io: any

Jan 29, 2022

Dart wrapper for mpesa daraja api by safaricom

mpesa-daraja-plugin-flutter-dart dart wrapper for mpesa daraja api by safaricom Features [Done]Lipa na mpesa [x] [inprogress] C2B [inprogress] B2B [in

Nov 6, 2022

An asynchronous Kaboom wrapper, written in Dart.

Kaboom Dart An asynchronous Kaboom wrapper, written in Dart. Usage To get started, initialize a Kaboom instane: // Initializes a new Kaboom instance.

Apr 7, 2022

The lightweight and powerful wrapper library for Twitter Ads API written in Dart and Flutter 🐦

TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them. Features TODO: List w

Aug 26, 2022

WooCommerce App template that uses Flutter. Integrated to work with WooCommerce stores, connect and create an IOS and Android app from Flutter for IOS and Android

WooCommerce App template that uses Flutter. Integrated to work with WooCommerce stores, connect and create an IOS and Android app from Flutter for IOS and Android

WooCommerce App: Label StoreMax Label StoreMax - v5.3.1 Official WooSignal WooCommerce App About Label StoreMax Label StoreMax is an App Template for

Jan 9, 2023

Flutter Developers may add themselves to this app for the purpose of showcasing their work

Flutter Developers may add themselves to this app for the purpose of showcasing their work

Flutter Developers may add themselves to this app for the purpose of showcasing their work

Dec 6, 2022
Releases(1.0.6)
Owner
Graciliano Monteiro Passos
Graciliano Monteiro Passos
Tic Tac Toe game with single-player and multi-player options. Implemented minimax algorithm.

flutter_tic_tac_toe A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you star

null 0 Jan 1, 2022
The XOR Encryption algorithm is a effective and easy to implement method of symmetric encryption.

Symmetric XOR cipher library About XOR cipher XOR Encryption is an encryption method used to encrypt data and is hard to crack by brute-force method,

Plague Fox 7 Apr 20, 2022
Split Korean text into sentences using heuristic algorithm

Korean Sentence Splitter Split Korean text into sentences using heuristic algorithm. pub.dev

자유해결사 3 Nov 28, 2022
A most easily usable Duolingo API wrapper in Dart. Duolingo4D is an open-sourced Dart library.

A most easily usable Duolingo API wrapper in Dart! 1. About Duolingo4D Duolingo4D is an open-sourced Dart library. With Duolingo4D, you can easily int

Kato Shinya 18 Oct 17, 2022
Dart wrapper via `dart:js` for webusb

Dart wrapper via dart:js for https://wicg.github.io/webusb/ Features canUseUsb g

Woodemi Co., Ltd 1 Jan 25, 2022
Unsplash Client App written using dart and flutter. (Work in progress)

Upsplash Unofficial Unsplash client written using dart and flutter Sreenshots Architecture The goal of this pattern is to make it easy to separate pre

Arslan 25 Sep 1, 2022
A simple dart zeromq implementation/wrapper around the libzmq C++ library

dartzmq A simple dart zeromq implementation/wrapper around the libzmq C++ library Features Currently supported: Creating sockets (pair, pub, sub, req,

Moritz Wirger 18 Dec 29, 2022
Unofficial wrapper for using Rapid7 insightOps logs (former LogEntries) with Dart.

An unofficial wrapper for using Rapid7 insightOps logs (former LogEntries) with Dart. This package is using logging package to do the actual logging,

Kirill Bubochkin 2 Mar 3, 2021
A wrapper around our Cocoa and Java client library SDKs, providing iOS and Android support for those using Flutter and Dart.

Ably Flutter Plugin A Flutter plugin wrapping the ably-cocoa (iOS) and ably-java (Android) client library SDKs for Ably, the platform that powers sync

Ably Realtime - our client library SDKs and libraries 46 Dec 13, 2022
A Dart wrapper of the SMHI Open Data API

SMHI Open Data for Dart This package is in early development and some features may not work as intended. If so, feel free to submit a pull request. A

Lukas 1 Sep 19, 2022