Introduction
Clarity is a low-level Ethereum transaction library written in pure Rust.
Features
- Any-endian, 32/64-bit support
- Public/private key handling
- Transaction signing and verification
- ABI enconding for common data types (see
abi::Token
variants)
Getting started
Here's an example lifetime of an Alice-to-Bob Ethereum transaction made with Clarity:
extern crate clarity;
extern crate futures;
extern crate web3;
use ;
use Future;
use ;
// A helper for filling the keys
let mut key_buf: = random;
let alices_key = from_slice.unwrap;
key_buf = random;
let bobs_key = from_slice.unwrap;
// Create a new transaction
let tx = Transaction ;
let tx_signed: Transaction = tx.sign;
assert!;
// You can always derive the sender from a signed transaction
let sender: Address = tx_signed.sender.unwrap;
// Send the locally assembled raw transaction over web3 (no need to trust another
// machine with your wallet or host a node locally).
let = new.unwrap;
let web3 = new;
let res = web3
.eth
.send_raw_transaction
.wait
.unwrap;