ethereum 3.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 83

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.

#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

example/example.dart

/*
 * Package : Ethereum
 * Author : S. Hamblett <steve.hamblett@linux.com>
 * Date   : 03/11/2017
 * Copyright :  S.Hamblett
 */

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

/// Example client usage
/// Please refer to https://github.com/ethereum/wiki/wiki/JSON-RPC for further details of ports etc.
/// Also see the ethereum_test_configuration.dart file for details on how to run geth.
Future main() async {
  // Create a client using default parameters
  final EthereumServerClient client =
      new EthereumServerClient.withConnectionParameters("localhost");

  // 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 -->  ${client.rpcClient.id}");

  // You can have as many clients as you wish, this has its own transaction id
  final EthereumServerClient client2 =
      new EthereumServerClient.withConnectionParameters("localhost");

  client2.printError = true;
}

Use this package as a library

1. Depend on it

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


dependencies:
  ethereum: ^3.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:ethereum/ethereum.dart';
  
Version Uploaded Documentation Archive
3.0.0 Sep 14, 2018 Go to the documentation of ethereum 3.0.0 Download ethereum 3.0.0 archive
2.0.1 Aug 15, 2018 Go to the documentation of ethereum 2.0.1 Download ethereum 2.0.1 archive
2.0.0 Aug 15, 2018 Go to the documentation of ethereum 2.0.0 Download ethereum 2.0.0 archive
1.1.0 Jan 19, 2018 Go to the documentation of ethereum 1.1.0 Download ethereum 1.1.0 archive
1.0.1 Jan 16, 2018 Go to the documentation of ethereum 1.0.1 Download ethereum 1.0.1 archive
1.0.0 Jan 15, 2018 Go to the documentation of ethereum 1.0.0 Download ethereum 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
65
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6

Platforms

Detected platforms: Flutter, web, other

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

Dependencies

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