From b02379d7698fce23c34164e342310aaefc20e300 Mon Sep 17 00:00:00 2001 From: aw3717 <1042.aw@gmail.com> Date: Sun, 15 Oct 2017 21:26:31 -0600 Subject: [PATCH 1/5] fixed type errors --- blockchain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockchain.py b/blockchain.py index f55b269..bc2568f 100644 --- a/blockchain.py +++ b/blockchain.py @@ -91,7 +91,7 @@ class Blockchain: return False - def new_block(self, proof: int, previous_hash: Optional[str]) -> Dict[str, Any]: + def new_block(self, proof: int, previous_hash: Optional[str]=None) -> Dict[str, Any]: """ Create a new Block in the Blockchain @@ -132,7 +132,7 @@ class Blockchain: return self.last_block['index'] + 1 @property - def last_block(self) -> Dict[str: Any]: + def last_block(self) -> Dict[str, Any]: return self.chain[-1] @staticmethod From 91126c457403543849d93b570fd0b7b6e99485ba Mon Sep 17 00:00:00 2001 From: davetoland Date: Wed, 29 Nov 2017 00:02:08 +0000 Subject: [PATCH 2/5] Update README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 0f46b5b..be44964 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,18 @@ $ docker run --rm -p 82:5000 blockchain $ docker run --rm -p 83:5000 blockchain ``` +## Installation (C# Implementation) + +1. Install a free copy of Visual Studio IDE (Community Edition): +https://www.visualstudio.com/vs/ + +2. Once installed, open the solution file (BlockChain.sln) using the File > Open > Project/Solution menu options within Visual Studio. + +3. From within the "Solution Explorer", right click the BlockChain.Console project and select the "Set As Startup Project" option. + +4. Click the "Start" button, or hit F5 to run. The program executes in a console window, and is controlled via HTTP with the same commands as the Python version. + + ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. From 36d30167cd170ad59322d6964d06d53e70373a0e Mon Sep 17 00:00:00 2001 From: Shuhei Kitagawa Date: Thu, 11 Jan 2018 09:31:24 +0900 Subject: [PATCH 3/5] change to user last_block instead of self.chain[-1] --- blockchain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockchain.py b/blockchain.py index 4e92d07..d3b6d34 100644 --- a/blockchain.py +++ b/blockchain.py @@ -104,7 +104,7 @@ class Blockchain: 'timestamp': time(), 'transactions': self.current_transactions, 'proof': proof, - 'previous_hash': previous_hash or self.hash(self.chain[-1]), + 'previous_hash': previous_hash or self.hash(last_block), } # Reset the current list of transactions From 93969fc8e740248d88b993d6f05efbf51c0234c3 Mon Sep 17 00:00:00 2001 From: Hassan Mehmood Date: Thu, 11 Jan 2018 16:56:53 +0500 Subject: [PATCH 4/5] update Docstring for method proof_of_work, remove duplication --- blockchain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockchain.py b/blockchain.py index 4e92d07..ac654fd 100644 --- a/blockchain.py +++ b/blockchain.py @@ -149,8 +149,8 @@ class Blockchain: def proof_of_work(self, last_proof): """ Simple Proof of Work Algorithm: - - Find a number p' such that hash(pp') contains leading 4 zeroes, where p is the previous p' - - p is the previous proof, and p' is the new proof + - Find a number p' such that hash(pp') contains leading 4 zeroes + - Where p is the previous proof, and p' is the new proof """ proof = 0 From a245174c24463bff01c6069b6eaf10fc88ce21c1 Mon Sep 17 00:00:00 2001 From: Daniel van Flymen Date: Tue, 23 Jan 2018 23:58:09 -0500 Subject: [PATCH 5/5] Fix tests --- blockchain.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blockchain.py b/blockchain.py index f47ec93..ac654fd 100644 --- a/blockchain.py +++ b/blockchain.py @@ -90,7 +90,7 @@ class Blockchain: return False - def new_block(self, proof: int, previous_hash: Optional[str]=None) -> Dict[str, Any]: + def new_block(self, proof, previous_hash): """ Create a new Block in the Blockchain @@ -104,7 +104,7 @@ class Blockchain: 'timestamp': time(), 'transactions': self.current_transactions, 'proof': proof, - 'previous_hash': previous_hash or self.hash(last_block), + 'previous_hash': previous_hash or self.hash(self.chain[-1]), } # Reset the current list of transactions @@ -131,7 +131,7 @@ class Blockchain: return self.last_block['index'] + 1 @property - def last_block(self) -> Dict[str, Any]: + def last_block(self): return self.chain[-1] @staticmethod