ethereum 4.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

ethereum #

Build Status

An ethereum RPC 2 client for Dart.

This package provides a client to access the Ethereum JSON RPC API documented here It uses the JSON RPC2 interface and can be configured to use any of the endpoints described except ipc. The client runs on the server using HTTP, and in the browser using both HTTP and web sockets.

The package currently implements most of the eth API and some of the admin API. Work is ongoing to complete the implementation of the admin API.

The mapping of Ethereum RPC data types to Dart types is as follows :-

  • boolean - bool
  • string - String
  • quantity - int
  • data - BigInt

Examples can be found in the examples directory, also the unit test suite contains examples of calling every API interface.

The package was tested against a geth client.

#4.0.2 Linter updates

#4.0.1 Update for use with Dart 2.1.1

#4.0.0 Issue 5, new datatypes

#3.1.0 Issue 4 fixes, linter updates

#3.0.0 Issue 4, Interface updates - admin

#2.0.1 Issue 3, updates for Dart 2

#1.1.0 Minor API(default block parameter) and coverage updates

1.0.1 #

Updates from publishing analysis ob pub site.

1.0.0 #

Initial release


 * Package : Ethereum
 * Author : S. Hamblett <>
 * Date   : 03/11/2017
 * Copyright :  S.Hamblett

import 'dart:async';
import 'package:ethereum/ethereum_server_client.dart';

// ignore_for_file: omit_local_variable_types
// ignore_for_file: unnecessary_final
// ignore_for_file: cascade_invocations
// ignore_for_file: avoid_print

/// Example client usage.
/// Please refer to for further details of ports etc.
/// Also see the ethereum_test_configuration.dart file for details on
/// how to run geth.
FutureOr<void> main() async {
  // Create a client using default parameters
  final EthereumServerClient client =

  // Or, with a specified port for WS working in the browser
  // new EthereumBrowserWSClient.withConnectionParameters('localhost', 8546);

  // Turn on error printing if needed.
  client.printError = true;

  // Make an API call, the client is stateless form a connection point of view.
  // Note that API methods are grouped under the logical ethereum rpc
  // namespace they belong to.
  final String version = await client.eth.protocolVersion();

  // Check for an error if you think anything is wrong.
  // Methods that should return a value return null on failure,
  // methods that do not return a value from the RPC call return
  // true on success and false on failure.
  if (version == null) {
    print('We have errored -> ${client.lastError}');
  } else {
    print('We are OK -> ${client.lastError}');

  // The transaction id increments every time, first call sets it to one
  print('Transaction Id is -->  ${}');

  // You can have as many clients as you wish, this has its own transaction id
  final EthereumServerClient client2 =

  client2.printError = true;

Use this package as a library

1. Depend on it

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

  ethereum: ^4.0.2

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:ethereum/ethereum.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 Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
hex ^0.1.2 0.1.2
Dev dependencies
build_runner ^1.1.2
build_test ^0.10.2
build_web_compilers ^0.4.0
coverage ^0.12.2
dart_style ^1.1.3
test ^1.3.0