Skip to content
Snippets Groups Projects
Commit 30a09594 authored by corentinstd's avatar corentinstd
Browse files

commit tmp

parent 1247428f
No related branches found
No related tags found
No related merge requests found
package fr.miage;
import java.security.NoSuchAlgorithmException;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
public static void main( String[] args ) throws NoSuchAlgorithmException
{
System.out.println("Début de la blockchain");
// Création de la blockchain
Blockchain blockchain = new Blockchain("BloBlockchain");
//Création de 2 wallets
Wallet bobWallet = new Wallet("publicKey1", "privateKey1");
Wallet aliceWallet = new Wallet("publicKey2", "privateKey2");
Wallet bobWallet = new Wallet("Ceci est la clé privé de bob");
///System.out.println(bobWallet.getPublicKey());
//System.out.println(bobWallet.getPrivateKey());
}
}
......@@ -6,9 +6,9 @@ public class Transaction {
private String id;
private List<UTxO> inputs;
private List<UTxO> outputs;
//private double fees;
private String signature;
private String typeTransaction;
private Bloc bloc;
public Transaction(String id, List<UTxO> inputs, List<UTxO> outputs, String signature, String typeTransaction) {
this.id = id;
......@@ -16,6 +16,21 @@ public class Transaction {
this.outputs = outputs;
this.signature = signature;
}
public void createTransaction(Wallet fromWallet, String toWallet, double amount, List<UTxO> utxoInput, List<UTxO> utxoOutput){
//créer transaction normale
this.signature = fromWallet.getPrivateKey();
}
public void createFirstTranscation(Wallet fromWallet, String toWallet, double amount, List<UTxO> utxoInput, List<UTxO> utxoOutput){
//créer transaction normale
this.signature = fromWallet.getPrivateKey();
utxoInput.add(new UTxO(fromWallet, null, amount))
}
//créer transaction coinbase
//un bloc avec que des coinbase avec un seul utxo de sortie
}
......@@ -2,13 +2,11 @@ package fr.miage;
public class UTxO {
//UTXO : Hash qui renvoie a la transaction d'avant
private String hashWallet; // hash du wallet
private Transaction transaction; // transaction précédente (provenance de l'argent) --> peut etre meme que le hash de la transaction
private Wallet hashWallet; // hash du wallet
private double montant;
public UTxO(String hashWallet, Transaction transaction, double montant) {
public UTxO(Wallet hashWallet, Transaction transaction, double montant) {
this.hashWallet = hashWallet;
this.transaction = transaction;
this.montant = montant;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment