rlp 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 44

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.


import 'package:rlp/rlp.dart';

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

Use this package as a library

1. Depend on it

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

  rlp: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub 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';
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 Jan 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

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.

Fix lib/src/pointycastle-utils.dart. (-1.99 points)

Analysis of lib/src/pointycastle-utils.dart reported 4 hints:

line 9 col 19: Unnecessary new keyword.

line 11 col 15: Unnecessary new keyword.

line 16 col 17: Unnecessary new keyword.

line 22 col 16: Unnecessary new keyword.

Maintenance suggestions

Package is getting outdated. (-27.12 points)

The package was last published 66 weeks ago.


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