Guest User

Untitled

a guest
Aug 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. import java.security.Security;
  2. import java.util.ArrayList;
  3. import java.util.Base64;
  4. import com.google.gson.GsonBuilder;
  5. public class NoobChain {
  6.  
  7. public static ArrayList<Block> blockchain = new ArrayList<Block>();
  8. public static int difficulty = 5;
  9. public static Wallet walletA;
  10. public static Wallet walletB;
  11. public static void main(String[] args) {
  12. // Setup Bouncey castle as a Security Provider
  13. Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  14. // 지갑 생성
  15. walletA = new Wallet();
  16. walletB = new Wallet();
  17. // 개인키, 공개키 테스트
  18. System.out.println("Private and public keys:");
  19. System.out.println(StringUtil.getStringFromKey(walletA.privateKey));
  20. System.out.println(StringUtil.getStringFromKey(walletA.publicKey));
  21. // 지갑A에서 지갑B로 송금하는 트랜잭션 테스트
  22. Transaction transaction = new Transaction(walletA.publicKey, walletB.publicKey, 5, null);
  23. // 서명
  24. transaction.generateSignature(walletA.privateKey);
  25. // 검증
  26. System.out.println("Is signature verified");
  27. System.out.println(transaction.verifiySignature());
  28.  
  29. }
Add Comment
Please, Sign In to add comment