web3dart 0.4.5 copy "web3dart: ^0.4.5" to clipboard
web3dart: ^0.4.5 copied to clipboard

outdated

Dart library to connect to Ethereum clients. Allows you to send transactions and build DApps in Dart.

example/web3dart_example.dart

import 'dart:async';

import 'package:http/http.dart';
import 'package:web3dart/web3dart.dart';

const String _PRIVATE_KEY = "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3";
const String _URL = "http://localhost:7545";

Future<Null> main() async {
	var httpClient = new Client();
	Web3Client client = new Web3Client(_URL, httpClient);
	client.printErrors = true;

	var credentials = Credentials.fromPrivateKeyHex(_PRIVATE_KEY);

	//Set up a new transaction
	new Transaction(keys: credentials, maximumGas: 100000)
		.prepareForSimpleTransaction( //that will transfer 2 ether
		  new EthereumAddress("0xf17f52151EbEF6C7334FAD080c5704D77216b732"),
			EtherAmount.fromUnitAndValue(EtherUnit.ether, 2))
		.send(client); //and send.
}
516
likes
30
points
27.5k
downloads

Publisher

verified publisherpwa.ir

Weekly Downloads

Dart library to connect to Ethereum clients. Allows you to send transactions and build DApps in Dart.

Repository (GitHub)

License

MIT (license)

Dependencies

convert, http, meta, pointycastle, tuple, uuid

More

Packages that depend on web3dart