diff --git a/pom.xml b/pom.xml
index 70c0861..ae3a3d8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
power-xml
power-reflection
power-mail
- power-blockchain
power-security
-
- 4.0.0
-
-
- org.nanoboot.powerframework
- power-framework
- 2.0.0-SNAPSHOT
-
-
- org.nanoboot.powerframework
- power-blockchain
- jar
-
- Power Blockchain
- Blockchain library
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 3.3.0
-
-
-
- org.nanoboot.powerframework.blockchain.orig.core.Main
-
-
-
- jar-with-dependencies
-
-
-
-
- make-assembly
- package
-
- single
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- org.nanoboot.powerframework.blockchain.orig.core.Main
-
-
-
-
-
-
-
-
-
-
- org.nanoboot.powerframework
- power-core
- ${power.version}
-
-
- org.nanoboot.powerframework
- power-time
- ${power.version}
-
-
- org.nanoboot.powerframework
- power-json
- ${power.version}
-
-
- org.nanoboot.powerframework
- power-random
- ${power.version}
-
-
- org.nanoboot.powerframework
- power-security
- ${power.version}
-
-
-
-
- junit
- junit
- 4.12
- test
-
-
- org.projectlombok
- lombok
- 1.18.10
- compile
-
-
-
-
diff --git a/power-blockchain/src/main/java/module-info.java b/power-blockchain/src/main/java/module-info.java
deleted file mode 100644
index 0689fa1..0000000
--- a/power-blockchain/src/main/java/module-info.java
+++ /dev/null
@@ -1,34 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-module powerframework.blockchain {
- requires lombok;
- requires powerframework.core;
- requires powerframework.time;
- requires powerframework.json;
- requires powerframework.random;
- requires powerframework.security;
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/.gitkeep b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/api/BlockDeserializer.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/api/BlockDeserializer.java
deleted file mode 100644
index 97eee57..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/api/BlockDeserializer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.api;
-
-import org.nanoboot.powerframework.blockchain.core.Block;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public interface BlockDeserializer {
- Block deserialize(String serializedBlock);
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/api/BlockSerializer.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/api/BlockSerializer.java
deleted file mode 100644
index 8a7ba93..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/api/BlockSerializer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.api;
-
-import org.nanoboot.powerframework.blockchain.core.Block;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public interface BlockSerializer {
- String serialize(Block block);
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/Block.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/Block.java
deleted file mode 100644
index 8115ecd..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/Block.java
+++ /dev/null
@@ -1,132 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.core;
-
-import org.nanoboot.powerframework.blockchain.api.BlockSerializer;
-import org.nanoboot.powerframework.json.JsonObject;
-import org.nanoboot.powerframework.json.JsonObjectSerializable;
-import org.nanoboot.powerframework.security.hash.api.HashCalculator;
-import org.nanoboot.powerframework.time.moment.UniversalDateTime;
-import lombok.Getter;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class Block implements JsonObjectSerializable {
- private static final String BLOCKCHAIN_PROTOCOL = "blockchainProtocol";
-
- private static final String HEIGHT = "height";
-
- private static final String PREVIOUS_HASH = "previousHash";
- private static final String TIMESTAMP = "timestamp";
- private static final String DIFFICULTY = "difficulty";
- private static final String DATA = "data";
- private static final String NONCE = "nonce";
-
- @Getter
- private final BlockchainProtocol blockchainProtocol;
-
- @Getter
- private final long height;
- @Getter
- private final String previousHash;
- @Getter
- private final String timeStamp;
- @Getter
- private final String difficultyTarget;
- @Getter
- private final byte[] data;
-
- @Getter
- private long nonce;
-
- //
- @Getter
- private String hash = null;
-
- //Block Constructor.
- public Block(BlockchainProtocol blockchainProtocol,
- long height,
- String previousHash,
- String difficultyTarget,
- byte[] data) {
- this.blockchainProtocol=blockchainProtocol;
- this.height = height;
- this.previousHash = previousHash;
- this.timeStamp = UniversalDateTime.now().toString();
- this.difficultyTarget = difficultyTarget;
- this.data = data;
- }
-
- //Calculate new hash based on blocks contents
- public String calculateHash(HashCalculator hashCalculator, BlockSerializer blockSerializer) {
- String serializedBlock = blockSerializer.serialize(this);
- String calculatedhash = hashCalculator.hash(serializedBlock);
- return calculatedhash;
- }
-
- //Increases nonce value until hash target is reached.
- public void mineBlock(HashCalculator hashCalculator, BlockSerializer blockSerializer) {
- String target = this.difficultyTarget;
-
- for (long i = 0; i <= Long.MAX_VALUE; i++) {
- this.nonce = i;
- if (nonce == Integer.MAX_VALUE) {
- throw new BlockChainException("Nonce was not found.");
- }
- if (nonce % 1000000 == 0) {
- System.out.println("Nonce # " + nonce);
- }
-
-
-
- String hash = calculateHash(hashCalculator, blockSerializer);
-
- if (hashCalculator.compareHexNumbers(hash, this.getDifficultyTarget()) <= 0) {
- System.out.println("Found nonce: " + nonce + " A new block was just mined: " + getHash() + "\n" /*+ block.toJsonObject().toPrettyString()*/);
- System.out.println("Block Mined!!! : " + hash);
- break;
- }
- }
-
- }
-
- @Override
- public JsonObject toJsonObject() {
-
- JsonObject jo = new JsonObject();
-
- jo.add(BLOCKCHAIN_PROTOCOL, blockchainProtocol.toJsonObject());
-
- jo.add(HEIGHT, height);
-
- jo.add(PREVIOUS_HASH, previousHash);
- jo.add(TIMESTAMP, timeStamp);
- jo.add(DIFFICULTY, difficultyTarget);
- jo.add(DATA, new String(data));
- jo.add(NONCE, nonce);
-
- return jo;
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockChainException.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockChainException.java
deleted file mode 100644
index 0fc92fb..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockChainException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.core;
-
-import org.nanoboot.powerframework.core.PowerException;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class BlockChainException extends PowerException {
- public BlockChainException(String msg) {
- super(msg);
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainEngine.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainEngine.java
deleted file mode 100644
index ba4b606..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainEngine.java
+++ /dev/null
@@ -1,40 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.core;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-import java.util.ArrayList;
-import java.util.List;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-@AllArgsConstructor
-public class BlockchainEngine {
- @Getter
- private final String protocolName;
- private List blockchainEngineVersionList = new ArrayList<>();
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainEngineVersion.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainEngineVersion.java
deleted file mode 100644
index 05ab32d..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainEngineVersion.java
+++ /dev/null
@@ -1,54 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.core;
-
-import org.nanoboot.powerframework.blockchain.api.BlockSerializer;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-@AllArgsConstructor
-public class BlockchainEngineVersion {
- @Getter
- private final String version;
- @Getter
- private final String hashCalculatorName;
- @Getter
- private final String targetDifficulty;
- @Getter
- private final BlockSerializer blockSerializer;
- @Getter
- private final long validFromBlock;
- @Getter
- private final long validUntilBlock;
-
- public String getMayorVersion() {
- return version.split(("\\."))[0];
- }
- public String getMinorVersion() {
- return version.split(("\\."))[1];
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainProtocol.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainProtocol.java
deleted file mode 100644
index 48814be..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/core/BlockchainProtocol.java
+++ /dev/null
@@ -1,56 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.core;
-
-import org.nanoboot.powerframework.json.JsonObject;
-import org.nanoboot.powerframework.json.JsonObjectSerializable;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-@AllArgsConstructor
-public class BlockchainProtocol implements JsonObjectSerializable {
- private static final String PROTOCOL_NAME = "protocolName";
- private static final String PROTOCOL_MAYOR_VERSION = "protocolMayorVersion";
- private static final String PROTOCOL_MINOR_VERSION = "protocolMinorVersion";
- @Getter
- private final String protocolName;
- @Getter
- private final int protocolMayorVersion;
- @Getter
- private final int protocolMinorVersion;
- @Override
- public JsonObject toJsonObject() {
-
- JsonObject jo = new JsonObject();
-
- jo.add(PROTOCOL_NAME, protocolName);
- jo.add(PROTOCOL_MAYOR_VERSION, protocolMayorVersion);
- jo.add(PROTOCOL_MINOR_VERSION, protocolMinorVersion);
-
- return jo;
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/impl/JsonBlockSerializer.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/impl/JsonBlockSerializer.java
deleted file mode 100644
index 23d0a42..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/impl/JsonBlockSerializer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.impl;
-
-import org.nanoboot.powerframework.blockchain.api.BlockSerializer;
-import org.nanoboot.powerframework.blockchain.core.Block;
-import org.nanoboot.powerframework.json.JsonObject;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class JsonBlockSerializer implements BlockSerializer {
-
- @Override
- public String serialize(Block block) {
- JsonObject jsonObject = block.toJsonObject();
- return jsonObject.toMinimalString();
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/impl/StringSerializer.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/impl/StringSerializer.java
deleted file mode 100644
index 5fe3ae6..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/impl/StringSerializer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.impl;
-
-import org.nanoboot.powerframework.blockchain.api.BlockSerializer;
-import org.nanoboot.powerframework.blockchain.core.Block;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-public class StringSerializer implements BlockSerializer {
-
- public static final String SEPARATOR = "::";
-
- @Override
- public String serialize(Block block) {
- return block.getBlockchainProtocol().toString() + SEPARATOR +
- block.getHeight() + SEPARATOR +
- block.getPreviousHash() + SEPARATOR +
- block.getTimeStamp() + SEPARATOR +
- block.getDifficultyTarget() + SEPARATOR +
- new String(block.getData()) + SEPARATOR +
- block.getNonce();
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockData.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockData.java
deleted file mode 100644
index f619d87..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockData.java
+++ /dev/null
@@ -1,31 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.api;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public interface BlockData {
- String convertToString();
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockDeserializer.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockDeserializer.java
deleted file mode 100644
index 3cda061..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockDeserializer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.api;
-
-import org.nanoboot.powerframework.blockchain.orig.base.Block;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public interface BlockDeserializer {
- Block deserialize(String serializedBlock);
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockMiner.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockMiner.java
deleted file mode 100644
index 24a1371..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockMiner.java
+++ /dev/null
@@ -1,35 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.api;
-
-import org.nanoboot.powerframework.blockchain.orig.base.Block;
-import org.nanoboot.powerframework.blockchain.orig.base.BlockFragment;
-import org.nanoboot.powerframework.blockchain.orig.base.BlockType;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public interface BlockMiner {
- Block mine(BlockFragment blockFragment, BlockType blockType);
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockSerializer.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockSerializer.java
deleted file mode 100644
index fb9c75f..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockSerializer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.api;
-
-import org.nanoboot.powerframework.blockchain.orig.base.Block;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public interface BlockSerializer {
- String serialize(Block block);
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockValidator.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockValidator.java
deleted file mode 100644
index 6eaad05..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/api/BlockValidator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.api;
-
-import org.nanoboot.powerframework.blockchain.orig.base.Block;
-import org.nanoboot.powerframework.blockchain.orig.base.BlockType;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public interface BlockValidator {
- BlockType getBlockType();
- void validate(Block block);
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/Block.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/Block.java
deleted file mode 100644
index 0a076ca..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/Block.java
+++ /dev/null
@@ -1,117 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.base;
-
-import org.nanoboot.powerframework.blockchain.orig.api.BlockData;
-import org.nanoboot.powerframework.blockchain.core.BlockChainException;
-import org.nanoboot.powerframework.json.JsonObject;
-import org.nanoboot.powerframework.json.JsonObjectSerializable;
-import lombok.Getter;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class Block implements JsonObjectSerializable {
- public static final String BLOCK_TYPE_ID = "blockTypeId";
- public static final String BLOCK_HEADER = "blockHeader";
- public static final String BLOCK_DATA = "blockData";
- public static final String NONCE = "nonce";
-
- @Getter
- private BlockHeader blockHeader;
-
- @Getter
- private BlockData blockData;
-
- private long nonce;
-
- @Getter
- private String hash;
- @Getter
- private boolean locked = false;
-
- @Getter
- private BlockType internalBlockType;
-
- public Block(BlockHeader blockHeader, JsonObject additionBlockHeader, BlockData blockData) {
- this.blockHeader = blockHeader;
-
- this.blockData = blockData;
- }
-
- public void injectBlockType(BlockType blockType) {
- this.internalBlockType = blockType;
- }
-
- public String calculateHashTest(long nonce) {
- this.nonce = nonce;
- String hashedSerializedBlock = internalCalculateHash();
- this.nonce = 0;//todo
- return hashedSerializedBlock;
- }
-
- private String internalCalculateHash() {
- if (nonce == 0) {
- throw new BlockChainException("Nonce cannot be zero.");
- }
- if (locked) {
- throw new BlockChainException("This block is already locked. Cannot set nonce and calculate nonce.");
- }
-
- if (internalBlockType == null) {
- throw new BlockChainException("internalBlockType was not injected.");
- }
- String serializedBlock = this.internalBlockType.getBlockSerializer().serialize(this);
-
- String hashedSerializedBlock = this.internalBlockType.getHashCalculator().hash(serializedBlock);
-
- //System.out.println("internalCalculateHash - hash for nonce " + nonce + " = " + hashedSerializedBlock);
- return hashedSerializedBlock;
- }
-
- public void lock(long nonce) {
- this.nonce = nonce;
- String hashedSerializedBlock = internalCalculateHash();
- this.hash = hashedSerializedBlock;
-
- this.locked = true;
- }
-
- @Override
- public JsonObject toJsonObject() {
- if (nonce == 0) {
- throw new BlockChainException("Nonce cannot be zero, if json object is created from this block instance.");
- }
- if (internalBlockType == null) {
- throw new BlockChainException("internalBlockType was not injected.");
- }
- JsonObject jo = new JsonObject();
- jo.add(BLOCK_TYPE_ID, internalBlockType.getBlockTypeId());
- jo.add(BLOCK_HEADER, blockHeader.toJsonObject());
-
- jo.add(BLOCK_DATA, blockData.convertToString());
- jo.add(NONCE, nonce);
- return jo;
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockChain.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockChain.java
deleted file mode 100644
index 4c0323e..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockChain.java
+++ /dev/null
@@ -1,100 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.base;
-
-import org.nanoboot.powerframework.blockchain.core.BlockChainException;
-
-import java.util.ArrayList;
-import java.util.List;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class BlockChain {
- private String blockChainEngineName;
- private List blocks = new ArrayList<>();
-
- public int getTotalHeight() {
- return blocks.size() - 1;
- }
-
- public boolean isEmpty() {
- return blocks.isEmpty();
- }
-
- public Block getGenesisBlock() {
- if (isEmpty()) {
- return null;
- }
- return getBlock(0);
- }
-
- public Block getLastBlock() {
- if (isEmpty()) {
- return null;
- }
- return getBlock(blocks.size() - 1);
- }
-
- public List getLastXBlocks(int xCount) {
- List result = new ArrayList<>();
-
- if (isEmpty()) {
- return result;
- }
- if (xCount <= blocks.size()) {
- for (Block b : blocks) {
- result.add(b);
- }
- return result;
- }
- for (int i = blocks.size() - xCount; i <= (blocks.size() - 1); i++) {
- result.add(blocks.get(i));
- }
- return result;
- }
-
- public void addBlock(Block block) {
- if (!block.isLocked()) {
- throw new BlockChainException("Block is not locked. It cannot be added");
- }
- if (blocks.isEmpty() && block.getBlockHeader().getHeight() != 0) {
- throw new BlockChainException("New block is a genesis block, but its height is not zero.");
- }
- Block lastBlock = getLastBlock();
- String previousBlockHash = lastBlock == null ? "0" : lastBlock.getHash();
-
- if (!block.getBlockHeader().getPreviousHash().equals(previousBlockHash)) {
- throw new BlockChainException("Block previous hash is not equal to the hash of the previous block. It cannot be added to the blockchain.");
- }
- blocks.add(block);
- }
-
- public Block getBlock(int blockHeight) {
- if (blockHeight >= blocks.size()) {
- throw new BlockChainException("There is no block with height " + blockHeight);
- }
- return blocks.get(blockHeight);
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockChainEngine.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockChainEngine.java
deleted file mode 100644
index ffe7f3b..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockChainEngine.java
+++ /dev/null
@@ -1,55 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.base;
-
-import org.nanoboot.powerframework.blockchain.core.BlockChainException;
-import lombok.AllArgsConstructor;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-@AllArgsConstructor
-public abstract class BlockChainEngine {
- private String blockChainEngineName;
- protected BlockChain blockChain;
- protected BlockTypeVersionList blockTypeVersionList;
-
- public void addData(String data) {
- BlockFragment blockFragment = createNewBlockFragment(data);
- BlockType blockType = blockTypeVersionList.findBlockType(blockFragment.getBlockHeader().getBlockTypeId());
- if (blockType == null) {
- throw new BlockChainException("blockType " + blockFragment.getBlockHeader().getBlockTypeId() + " was not found.");
- }
-
- Block block = blockType.getBlockMiner().mine(blockFragment, blockType);
- addBlock(block);
- }
-
- public abstract BlockFragment createNewBlockFragment(String data);
-
- public void addBlock(Block newBlock) {
- blockChain.addBlock(newBlock);
- }
-
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockFragment.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockFragment.java
deleted file mode 100644
index 0cedbf0..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockFragment.java
+++ /dev/null
@@ -1,42 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.base;
-
-import org.nanoboot.powerframework.blockchain.orig.api.BlockData;
-import org.nanoboot.powerframework.json.JsonObject;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-@AllArgsConstructor
-public class BlockFragment {
- @Getter
- private BlockHeader blockHeader;
-
- @Getter
- private BlockData blockData;
-
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockHeader.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockHeader.java
deleted file mode 100644
index 6272d74..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockHeader.java
+++ /dev/null
@@ -1,60 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.base;
-
-import org.nanoboot.powerframework.json.JsonObject;
-import org.nanoboot.powerframework.json.JsonObjectSerializable;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-@AllArgsConstructor
-public class BlockHeader implements JsonObjectSerializable {
- public static final String BLOCK_TYPE_ID = "blockTypeId";
- public static final String HEIGHT = "height";
- public static final String TIME_STAMP = "timeStamp";
- public static final String PREVIOUS_HASH = "previousHash";
- @Getter
- private String blockTypeId;
- @Getter
- private int height;
- @Getter
- private long timeStamp;
- @Getter
- private String previousHash;
- @Getter
- private String difficulty;
-
- public JsonObject toJsonObject() {
- JsonObject jo = new JsonObject();
- jo.add(BLOCK_TYPE_ID, blockTypeId);
- jo.add(HEIGHT, height);
- jo.add(TIME_STAMP, timeStamp);
- jo.add(PREVIOUS_HASH, previousHash);
- return jo;
- }
-
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockType.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockType.java
deleted file mode 100644
index 7280eb3..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockType.java
+++ /dev/null
@@ -1,55 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.base;
-
-import org.nanoboot.powerframework.blockchain.orig.api.BlockDeserializer;
-import org.nanoboot.powerframework.blockchain.orig.api.BlockMiner;
-import org.nanoboot.powerframework.blockchain.orig.api.BlockSerializer;
-import org.nanoboot.powerframework.security.hash.api.HashCalculator;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-@AllArgsConstructor
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class BlockType {
- @Getter
- private String type;
- @Getter
- private int mayorVersion;
- @Getter
- private int minorVersion;
- @Getter
- private HashCalculator hashCalculator;
- @Getter
- private BlockSerializer blockSerializer;
- @Getter
- private BlockDeserializer blockDeserializer;
- @Getter
- BlockMiner blockMiner;
- public String getBlockTypeId() {
- return type + ":" + mayorVersion + ":" + minorVersion;
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockTypeVersionList.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockTypeVersionList.java
deleted file mode 100644
index ec6b8d8..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/base/BlockTypeVersionList.java
+++ /dev/null
@@ -1,47 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.base;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class BlockTypeVersionList {
- private Map blockTypes;
-
- public BlockTypeVersionList(List blockTypesList) {
- blockTypes = new HashMap<>();
- for (BlockType bt : blockTypesList) {
- blockTypes.put(bt.getBlockTypeId(), bt);
- }
- }
-
- public BlockType findBlockType(String blockTypeId) {
- return blockTypes.get(blockTypeId);
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/Transaction.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/Transaction.java
deleted file mode 100644
index d794978..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/Transaction.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.cash;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-public class Transaction {
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/TransactionValidator.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/TransactionValidator.java
deleted file mode 100644
index 70e6ccf..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/TransactionValidator.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.cash;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-public class TransactionValidator {
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/Wallet.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/Wallet.java
deleted file mode 100644
index 0f09071..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/cash/Wallet.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.cash;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-public class Wallet {
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/core/Main.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/core/Main.java
deleted file mode 100644
index d14916c..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/core/Main.java
+++ /dev/null
@@ -1,48 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.core;
-
-import org.nanoboot.powerframework.blockchain.orig.base.BlockChain;
-import org.nanoboot.powerframework.blockchain.orig.impl.TestCash_BlockChainEngine;
-import org.nanoboot.powerframework.random.generators.linearcongruent.combined.w5.W5RandomGenerator;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class Main {
- public static void main(String[] args) {
-// HashCalculator.main(null);
-//
-// if(true) return;
- BlockChain blockChain = new BlockChain();
- TestCash_BlockChainEngine bce = new TestCash_BlockChainEngine(blockChain);
- bce.addData("ahoj");
- bce.addData("pavle");
- bce.addData("leo");
- for(int i =0;i<100000000;i++){
- bce.addData(W5RandomGenerator.getStaticInstance().nextText(8));
- }
-
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/JsonBlockSerializer.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/JsonBlockSerializer.java
deleted file mode 100644
index 5e6ae63..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/JsonBlockSerializer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.impl;
-
-import org.nanoboot.powerframework.blockchain.orig.api.BlockSerializer;
-import org.nanoboot.powerframework.blockchain.orig.base.Block;
-import org.nanoboot.powerframework.json.JsonObject;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-
-public class JsonBlockSerializer implements BlockSerializer {
-
- @Override
- public String serialize(Block block) {
- JsonObject jsonObject = block.toJsonObject();
- //System.out.println(jsonObject.toMinimalString());
- return jsonObject.toMinimalString();
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/SimpleBlockData.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/SimpleBlockData.java
deleted file mode 100644
index 53b1351..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/SimpleBlockData.java
+++ /dev/null
@@ -1,40 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.impl;
-
-import org.nanoboot.powerframework.blockchain.orig.api.BlockData;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-@AllArgsConstructor
-public class SimpleBlockData implements BlockData {
- @Getter
- private final String string;
- @Override
- public String convertToString() {
- return string;
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_Block.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_Block.java
deleted file mode 100644
index 2090d02..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_Block.java
+++ /dev/null
@@ -1,36 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.impl;
-
-import org.nanoboot.powerframework.blockchain.orig.api.BlockData;
-import org.nanoboot.powerframework.blockchain.orig.base.BlockHeader;
-import org.nanoboot.powerframework.blockchain.orig.base.Block;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-public class TestCash_1_0_Block extends Block {
- public TestCash_1_0_Block(BlockHeader blockHeader, BlockData blockData) {
- super(blockHeader, null, blockData);
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_BlockMiner.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_BlockMiner.java
deleted file mode 100644
index e0a132d..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_BlockMiner.java
+++ /dev/null
@@ -1,95 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.impl;
-
-import org.nanoboot.powerframework.blockchain.orig.api.BlockMiner;
-import org.nanoboot.powerframework.blockchain.orig.base.Block;
-import org.nanoboot.powerframework.blockchain.orig.base.BlockFragment;
-import org.nanoboot.powerframework.blockchain.orig.base.BlockType;
-import org.nanoboot.powerframework.blockchain.core.BlockChainException;
-import org.nanoboot.powerframework.security.hash.api.HashCalculator;
-import org.nanoboot.powerframework.time.duration.Duration;
-import org.nanoboot.powerframework.time.duration.StopWatch;
-import org.nanoboot.powerframework.time.utils.TimeUnit;
-
-import java.util.ArrayList;
-import java.util.List;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-public class TestCash_1_0_BlockMiner implements BlockMiner {
- public static List lastFiveBlockMiningTimesInMilliseconds = new ArrayList<>();
-
- @Override
- public Block mine(BlockFragment blockFragment, BlockType blockType) {
-
- TestCash_1_0_Block block = new TestCash_1_0_Block(blockFragment.getBlockHeader(), blockFragment.getBlockData());
- block.injectBlockType(blockType);
-
- ////System.out.println("Starting mining block # " + block.getBlockHeader().getHeight());
- //System.out.println("Note: One block should be mined in 1 minute, but the last time was " + countOfSecondsToMineLastBlock + " second(s).");
- //System.out.println("Starting mining block # " + block.getBlockHeader().getHeight());
- StopWatch sw = new StopWatch();
-
- //System.out.println("start: " + UniversalDateTime.now().toString());
- sw.start();
-
- ////System.out.println("Searching hash equal or less than " + block.getBlockHeader().getDifficulty());
- for (long nonce = 1; nonce <= Long.MAX_VALUE; nonce++) {
- if (nonce == Integer.MAX_VALUE) {
- throw new BlockChainException("Nonce was not found.");
- }
- if (nonce % 1000000 == 0) {
- System.out.println("Nonce # " + nonce);
- }
-
-
- HashCalculator hashCalculator = block.getInternalBlockType().getHashCalculator();
- String hash = block.calculateHashTest(nonce);
- //System.err.println("hashCalculator.compareHexNumbers("+hash+"+, block.getBlockHeader().getDifficulty()="+block.getBlockHeader().getDifficulty()+")="+hashCalculator.compareHexNumbers(hash, block.getBlockHeader().getDifficulty()));
- if (hashCalculator.compareHexNumbers(hash, block.getBlockHeader().getDifficulty()) <= 0) {
-
- //System.err.println("hashCalculator.compareHexNumbers("+hash+"+, block.getBlockHeader().getDifficulty()="+block.getBlockHeader().getDifficulty()+")="+hashCalculator.compareHexNumbers(hash, block.getBlockHeader().getDifficulty()));
- block.lock(nonce);
- ////System.out.println("Found nonce: " + nonce + " A new block was just mined: " + block.getHash() + "\n" /*+ block.toJsonObject().toPrettyString()*/);
-
- break;
- }
- }
-
- //System.out.println("end: " + UniversalDateTime.now().toString());
- sw.stop();
- Duration lastDuration = sw.getCurrentDuration();
- if (lastFiveBlockMiningTimesInMilliseconds.size() == 1000) {
- lastFiveBlockMiningTimesInMilliseconds.remove(0);
- }
- lastFiveBlockMiningTimesInMilliseconds.add((int) lastDuration.toTotal(TimeUnit.MILLISECOND));
- //countOfSecondsToMineLastBlock = (int) lastDuration.toTotal(TimeUnit.SECOND);
- if (block.getBlockHeader().getHeight() % 100 == 0)
- System.out.println("Mining block " + block.getBlockHeader().getHeight() + " + took " + lastDuration.toString() + " .");
- return block;
- }
-
-
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_BlockType.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_BlockType.java
deleted file mode 100644
index 284f671..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_1_0_BlockType.java
+++ /dev/null
@@ -1,39 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.impl;
-
-import org.nanoboot.powerframework.blockchain.orig.base.BlockType;
-import org.nanoboot.powerframework.security.hash.locator.HashCalculatorLocator;
-import org.nanoboot.powerframework.security.hash.locator.HashImpl;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-public class TestCash_1_0_BlockType extends BlockType {
-private static final String TYPE = "test_cash";
-private static final int MAYOR_VERSION = 1;
-private static final int MINOR_VERSION = 0;
- public TestCash_1_0_BlockType() {
- super(TYPE, MAYOR_VERSION, MINOR_VERSION, HashCalculatorLocator.locate(HashImpl.SHA_256), new JsonBlockSerializer(), null, new TestCash_1_0_BlockMiner());
- }
-}
diff --git a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_BlockChainEngine.java b/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_BlockChainEngine.java
deleted file mode 100644
index 5314529..0000000
--- a/power-blockchain/src/main/java/org/nanoboot/powerframework/blockchain/orig/impl/TestCash_BlockChainEngine.java
+++ /dev/null
@@ -1,136 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// power-framework: Java library with many purposes of usage.
-// Copyright (C) 2016-2022 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation;
-// version 2.1 of the License only.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.nanoboot.powerframework.blockchain.orig.impl;
-
-import org.nanoboot.powerframework.blockchain.orig.base.*;
-import org.nanoboot.powerframework.security.hash.api.HashCalculator;
-import org.nanoboot.powerframework.time.duration.Duration;
-import org.nanoboot.powerframework.time.moment.UniversalDateTime;
-import org.nanoboot.powerframework.time.utils.TimeUnit;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.List;
-/**
- *
- *
- * @author Robert Vokac
- * @since 0.0.0
- */
-public class TestCash_BlockChainEngine extends BlockChainEngine {
-
- public static final String TEST_CASH = "TestCash";
- public static final int COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK = 10;
- //public static final String DEFAULT_DIFFICULTY = "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
- public static final String DEFAULT_DIFFICULTY = "00184f329993e8d38cd0a31969b54367b4fc5af6ed86d827c1343dbf8b66a4a5";
-
- public static float DIFFICULTY_PERCENT_CHANGE = (float) 1;
-
- public TestCash_BlockChainEngine(BlockChain blockChain) {
- super(TEST_CASH, blockChain, new BlockTypeVersionList(List.of(new TestCash_1_0_BlockType())));
- }
-
- @Override
- public BlockFragment createNewBlockFragment(String data) {
- Block lastBlock = blockChain.getLastBlock();
- int newBlockHeight = lastBlock == null ? 0 : lastBlock.getBlockHeader().getHeight() + 1;
- long newTimeStamp = UniversalDateTime.now().toLong();
- String previousBlockHash = lastBlock == null ? "0" : lastBlock.getHash();
- String oldDifficulty = lastBlock == null ? DEFAULT_DIFFICULTY : lastBlock.getBlockHeader().getDifficulty();
- String newDifficulty = oldDifficulty;
-
- int newDifficultyPeriod = 1000;
- if (lastBlock != null && newBlockHeight % newDifficultyPeriod == 0) {
-
- List lastBlocks = blockChain.getLastXBlocks(newDifficultyPeriod);
- int lastBlocksCount = lastBlocks.size();
- Block blockStart = lastBlocks.get(0);
- Block blockEnd = lastBlocks.get(lastBlocks.size() - 1);
- long moment1 = blockStart.getBlockHeader().getTimeStamp();
- long moment2 = blockEnd.getBlockHeader().getTimeStamp();
- UniversalDateTime udt1 = new UniversalDateTime(moment1);
- UniversalDateTime udt2 = new UniversalDateTime(moment2);
- Duration duration = new org.nanoboot.powerframework.time.duration.Period(udt1, udt2).getDuration();
- duration.toTotal(TimeUnit.SECOND);
- double averageCountOfMillisecondsToMineABlockForTenLastBlocks = (duration.toTotal(TimeUnit.SECOND) / (lastBlocksCount - 1));
-
- int countX = 0;
- int sum = 0;
- for (Integer i : TestCash_1_0_BlockMiner.lastFiveBlockMiningTimesInMilliseconds) {
- sum = sum + i;
- countX = countX + 1;
- }
- System.out.println("sumInSeconds="+((double)sum));
-
- averageCountOfMillisecondsToMineABlockForTenLastBlocks = ((((double) sum) / ((double) countX)) /*/ 1*/);
- System.out.println("averageCountOfMillisecondsToMineABlockForTenLastBlocks=" + averageCountOfMillisecondsToMineABlockForTenLastBlocks);
- boolean plus = false;
- if(((int)Math.round(averageCountOfMillisecondsToMineABlockForTenLastBlocks))==COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK) {
- DIFFICULTY_PERCENT_CHANGE=1f/16;
- } else {
- if(DIFFICULTY_PERCENT_CHANGE != (float) 1f/1f) {
- DIFFICULTY_PERCENT_CHANGE = (float) 1f/1f;
- }
- }
- if (averageCountOfMillisecondsToMineABlockForTenLastBlocks < COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK) {
- plus = false;
- System.out.println("Difficulty +++ increasing");
-
- }
- if (averageCountOfMillisecondsToMineABlockForTenLastBlocks > COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK) {
- plus = true;
- System.out.println("Difficulty --- decreasing");
- }
-// if (DIFFICULTY_PERCENT_CHANGE >= 16) {
-// DIFFICULTY_PERCENT_CHANGE = 4;
-// }
-
- System.out.println("averageCountOfSecondsToMineABlockForTenLastBlocks=" + averageCountOfMillisecondsToMineABlockForTenLastBlocks);
- if (averageCountOfMillisecondsToMineABlockForTenLastBlocks != COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK) {
- //DIFFICULTY_PERCENT_CHANGE = DIFFICULTY_PERCENT_CHANGE * 2;
- double realDifficultyPercentChange = DIFFICULTY_PERCENT_CHANGE;
- double more = averageCountOfMillisecondsToMineABlockForTenLastBlocks > COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK ? averageCountOfMillisecondsToMineABlockForTenLastBlocks : COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK;
- double less = averageCountOfMillisecondsToMineABlockForTenLastBlocks < COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK ? averageCountOfMillisecondsToMineABlockForTenLastBlocks : COUNT_OF_MILLISECONDS_TO_MINE_A_BLOCK;
-
- if ((less / more) < 0.5) {
- realDifficultyPercentChange = 50;
- }
- double change = 1 + ((plus ? 1 : (-1)) * (realDifficultyPercentChange / 100));
-// if((double)(averageCountOfSecondsToMineABlockForTenLastBlocks) / (double)(COUNT_OF_SECONDS_TO_MINE_A_BLOCK)<0.9 || (double)(averageCountOfSecondsToMineABlockForTenLastBlocks) / (double)(COUNT_OF_SECONDS_TO_MINE_A_BLOCK)> 1.1){
-// change = 1 + ((plus ? 1 : (-1)) * (25f / 100));
-// }
- System.out.println(" Changing to " + change);
- BlockType blockType = blockTypeVersionList.findBlockType("test_cash:1:0");
- HashCalculator hashCalculator = blockType.getHashCalculator();
- String oldDifficultyAsDec = hashCalculator.convertHexStringToDecString(oldDifficulty);
- System.out.println("oldDifficultyAsDec=" + oldDifficultyAsDec);
- BigInteger bi = new BigDecimal(oldDifficultyAsDec).multiply(new BigDecimal(change)).toBigInteger();
- System.out.println("newDifficultyAsDec=" + bi.toString());
- newDifficulty = hashCalculator.convertDecStringToHexString(bi.toString());
- System.err.println("NEW_DIFFICULTY = " + newDifficulty);
- } else {
- //DIFFICULTY_PERCENT_CHANGE = DIFFICULTY_PERCENT_CHANGE / 2;
- }
- }
- BlockHeader blockHeader = new BlockHeader("test_cash:1:0", newBlockHeight, newTimeStamp, previousBlockHash, newDifficulty);
- return new BlockFragment(blockHeader, new SimpleBlockData(data));
- }
-}
diff --git a/power-blockchain/src/main/resources/.gitkeep b/power-blockchain/src/main/resources/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/power-blockchain/src/test/java/org/nanoboot/powerframework/blockchain/.gitkeep b/power-blockchain/src/test/java/org/nanoboot/powerframework/blockchain/.gitkeep
deleted file mode 100644
index e69de29..0000000