rlp 1.0.0

  • README.md
  • Installing
  • Versions
  • 56

rlp #

An Ethereum RLP library for Dart - https://pub.dartlang.org/packages/rlp

Build Status

The purpose of RLP (Recursive Length Prefix) is to encode arbitrarily nested arrays of binary data, and RLP is the main encoding method used to serialize objects in Ethereum

rlp takes a String, int or List and returns an RLP encoded List<int>

Usage #

A simple usage example:

import 'package:rlp/rlp.dart';

main() {
  var encoded = Rlp.encode(["dog", "cat"]);
  print(encoded); // List<int> [200, 131, 100, 111, 103, 131, 99, 97, 116]

A more complex usage example:

import 'dart:typed_data';

import 'package:convert/convert.dart';
import 'package:pointycastle/pointycastle.dart';
import 'package:rlp/rlp.dart';

main() {

  const sender = Address('0xba52c75764d6f594735dc735be7f1830cdf58ddf');
  const nonce = 3515;

  var encoded = Rlp.encode([sender, nonce]);

  var out = new Digest('SHA-3/256').process(Uint8List.fromList(encoded));
  var contractAddress = hex.encode(out.sublist(12));

  print('Cryptokitties contract address is 0x$contractAddress'); // 0x06012c8cf97bead5deae237070f9587f8e7a266d


Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.0.0 #

  • Initial release version. Encoder only.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  rlp: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:rlp/rlp.dart';
Version Uploaded Documentation Archive
1.0.1 Oct 20, 2018 Go to the documentation of rlp 1.0.1 Download rlp 1.0.1 archive
1.0.0 Oct 20, 2018 Go to the documentation of rlp 1.0.0 Download rlp 1.0.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on May 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:rlp/rlp.dart.

Health issues and suggestions

Document public APIs. (-1 points)

12 out of 12 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/rlp.dart.

Run dartfmt to format lib/rlp.dart.

Format lib/src/rlp_base.dart.

Run dartfmt to format lib/src/rlp_base.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and rlp.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
convert ^2.0.2 2.1.1
Transitive dependencies
charcode 1.1.2
typed_data 1.1.6
Dev dependencies
pointycastle 1.0.0-rc4
test ^1.0.4