Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

An Android-friendly redistribution of ether.camp's ethereumj

Notifications You must be signed in to change notification settings

io-digital/ethereumj-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ethereumj-android

This library is an Android-friendly redistribution of ether.camp's ethereumj. It depends on SpongyCastle to provide a comprehensive security implementation suitable for generating and operating on Ethereum-compatible private keys.

Usage

package your.package.id;

import java.security.Security;
import java.security.SecureRandom;
import org.spongycastle.util.encoders.Hex;
import org.spongycastle.jce.provider.BouncyCastleProvider;
import za.co.io.ethereumj_android.crypto.ECKey;

class YourClass {

    static {
        Security.insertProviderAt(new BouncyCastleProvider(), 1);
    }

    public static void main(String[] args) {
        ECKey eck = new ECKey(Security.getProvider("SC"), new SecureRandom());
        System.out.println("Private key: " + Hex.toHexString(eck.getPrivKeyBytes()));
        System.out.println("Public key: " + Hex.toHexString(eck.getPubKey()));
        System.out.println("Address: " + ("0x" + Hex.toHexString(ECKey.computeAddress(eck.getPubKey()))));
    }

}

Notes

  • Shouldn't ethereumj have been named jthereum? 🤔

Legal

ethereumj is distributed under the MIT license by ether.camp (LICENSE)

Releases

No releases published

Packages

No packages published

Languages