Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hhatto/rust-ens

Rust ENS(Ethereum Name Service) interface
https://github.com/hhatto/rust-ens

ens ethereum rust

Last synced: 2 months ago
JSON representation

Rust ENS(Ethereum Name Service) interface

Awesome Lists containing this project

README

        

# rust-ens [![](https://travis-ci.org/hhatto/rust-ens.svg?branch=master)](https://travis-ci.org/hhatto/rust-ens) [![Latest Version](https://img.shields.io/crates/v/ens.svg)](https://crates.io/crates/ens)

Rust ENS(Ethereum Name Service) interface, based on [rust-web3](https://github.com/tomusdrw/rust-web3).

## Usage

Cargo.toml

```toml
[dependencies]
ens = "0.1"
```

```rust
extern crate ens;
extern crate web3;

use ens::ENS;

fn main() {
let (_evloop, transport) = web3::transports::Http::new(
"http://localhost:8545",
).unwrap();

let ens_name = "hexacosa.eth";

let ens = ENS::new(web3::Web3::new(transport));
match ens.address(ens_name) {
Ok(addr) => println!("{:?}", addr),
Err(_) => println!("unknown"),
};
}
```

## for Developer

### Contract

use ENS Contract from https://github.com/ensdomains/ens/tree/master/contracts .
* ENS.sol
* PublicResolver.sol

```
$ solc --bin --abi --optimize contract/ENS.sol -o contract
$ solc --bin --abi --optimize contract/PublicResolver.sol -o contract
$ ls contract
ENS.abi ENS.bin ENS.sol PublicResolver.abi PublicResolver.bin PublicResolver.sol
```