web3dart 0.4.3 copy "web3dart: ^0.4.3" to clipboard
web3dart: ^0.4.3 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.
}
476
likes
0
pub points
97%
popularity

Publisher

verified publisherpwa.ir

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

convert, http, meta, pointycastle, tuple, uuid

More

Packages that depend on web3dart