Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scala.util.Failure
- import scala.util.Success
- import com.google.common.primitives.Bytes
- import com.google.common.primitives.Ints
- import scorex.crypto.EllipticCurveImpl
- import scorex.crypto.encode.Base58
- import scorex.crypto.hash.SecureCryptographicHash
- import scorex.waves.crypto.HashChain
- object WalletGenerator extends App {
- val walletSeed =
- Base58.decode(
- "paste here your base58 encoded walletSeed from settings.json") match {
- case Success(walletSeed) => {
- for (nonce <- 0 to 9) {
- val keySeed = SecureCryptographicHash(Bytes.concat(Ints.toByteArray(nonce), walletSeed))
- val pair = EllipticCurveImpl.createKeyPair(keySeed)
- val (privateKey, publicKey) = EllipticCurveImpl.createKeyPair(keySeed)
- val publicKeyHash = HashChain.hash(publicKey).take(20)
- val withoutChecksum: Array[Byte] = 1.toByte +: 'T'.toByte +: publicKeyHash
- val address = withoutChecksum ++ HashChain.hash(publicKey).take(4)
- println(s"address: ${Base58.encode(address)}, publicKey: ${Base58.encode(publicKey)}, privateKey: ${Base58.encode(privateKey)}")
- }
- }
- case Failure(e) => println("base58 seed decode failed")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement