-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
store wallet with password protection, basic miner class
- Loading branch information
Showing
6 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
logs/ | ||
keys/ | ||
|
||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
|
25 changes: 25 additions & 0 deletions
25
src/main/java/hu/saborsoft/blockchain/example/wallet/WalletExample1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package hu.saborsoft.blockchain.example.wallet; | ||
|
||
import hu.saborsoft.blockchain.support.EncryptionAlgorithm; | ||
import hu.saborsoft.blockchain.wallet.Wallet; | ||
|
||
import java.util.Scanner; | ||
|
||
public class WalletExample1 { | ||
|
||
public static void main(String[] args) { | ||
Scanner in = new Scanner(System.in); | ||
System.out.println("To create a wallet, please give your name"); | ||
String name = in.nextLine(); | ||
System.out.println("please create a password"); | ||
String password = in.nextLine(); | ||
in.close(); | ||
Wallet w = new Wallet(name, password, EncryptionAlgorithm.AES); | ||
System.out.println("wallet created for " + w.getName()); | ||
|
||
// let's load this wallet | ||
Wallet w2 = new Wallet(name, password, EncryptionAlgorithm.AES); | ||
System.out.println("wallet loaded successfully, wallet name=" + w2.getName()); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/hu/saborsoft/blockchain/support/EncryptionAlgorithm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package hu.saborsoft.blockchain.support; | ||
|
||
public enum EncryptionAlgorithm { | ||
XOR, AES | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package hu.saborsoft.blockchain.wallet; | ||
|
||
import hu.saborsoft.blockchain.block.Block; | ||
|
||
public class Miner extends Wallet { | ||
|
||
public Miner(String minerName, String password) { | ||
super(minerName, password); | ||
} | ||
|
||
public boolean mineBlock(Block block) { | ||
return block.mineTheBlock(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters