io-digital/ethereumj-android


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

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.io-digital:ethereumj-android:'
	}
	dependencies {
		implementation("com.github.io-digital:ethereumj-android:")
	}
	<dependency>
	    <groupId>com.github.io-digital</groupId>
	    <artifactId>ethereumj-android</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.io-digital" % "ethereumj-android" % ""
        
        

                            
    :dependencies [[com.github.io-digital/ethereumj-android ""]]
        
        

Readme


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? :thinking:

Legal

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