├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── _config.yml
├── blockchain
├── __init__.py
└── chain.py
├── bscli.py
├── setup.py
├── templates
├── blockdata.html
├── blocks.html
└── guide.html
└── web.py
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | chain.txt
3 | venv/
4 | build/
5 | dist/
6 | blockshell/
7 | blockshell.egg-info/
8 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at daxeelsoni44@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Try and play around Blockshell. If you found any bugs or want to integrate new feature, feel free to submit PR.
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Daxeel Soni
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 📖 README.md just includes installation guide. You can find detailed guide in this wiki page
2 |
3 | # BlockShell
4 | A command line utility for learning Blockchain technical concepts likechaining, mining, proof of work etc.
5 |
6 |
7 |
8 |
9 | ## ℹ️ About
10 | Anyone who wants to understand how blockchain technology works, then BlockShell should be a great start. Because I have created BlockShell keeping blockchain fundamentals in the center of development. With BlockShell you will actually create a tiny blockchain in your system where you can create blocks with data, explore blocks etc.
11 |
12 | So, by using BlockShell anyone can learn following blockchain concepts,
13 | * Block & Chaining
14 | * Hashing
15 | * Mining
16 | * Proof of Work
17 |
18 | ## 🌐 BlockShell Web Explorer
19 |
BlockShell comes with built-in blockchain explorer by which you can actully see how blocks are mined and what is stored and where.
20 | 21 | Latest Mined Blocks | Block Details 22 | :------------------------------:|:-------------------------: 23 |  |  24 | 25 | ## 📦 Installation 26 | Step 1 - Create project directory 27 | ``` 28 | mkdirHeight | 62 |{{data['index']}} | 63 |
Timestamp | 66 |{{data['timestamp']}} | 67 |
Data | 70 |{{data['data']}} | 71 |
Hash | 74 |{{data['hash']}} | 75 |
Previous Block Hash | 78 |{{data['previousHash']}} | 79 |
Nonce | 82 |{{data['nonce']}} | 83 |
86 |
87 |Project BlockShell is created by with a vision to teach blockchain concepts to students and programmers.
94 | Contact Creator 95 |64 |
65 |Project BlockShell is created by with a vision to teach blockchain concepts to students and programmers.
72 | Contact Creator 73 |Blockshell works on blockchain concepts and it creates a tiny blockchain in your local system. So, you will actually learn the concepts like blocks, mining, hashing, proof of work and lot more.
65 |So, with blockshell you will be creating blocks with simple commands and rest of the tasks will be handled by Blockshell. In this wiki I will try to explain how Blockshell works behind every commands and how it is executing blockchain.
66 |Let's get start!
67 |First we will initialize the new blockchain with following command in blockshell CLI.
69 |[BLOCKSHELL] $ blockshell init --difficulty 3
70 |Above command initializes new blockchain and creates chain.txt in your working directory where our blockchain data will be stored. You can compare this chain.txt file as real world blockchain's ledger.
71 |--difficulty number indicates the difficulty level for blockchain's proof of work. More the number, more time will be taken to mine new block in our blockchain.
72 |In our blockchain we have Initial Zeros Proof of Work algorithm. So, when we want to mine new block, our PoW will look for the hash that has the initial 3 characters are zeros(0) as right now our blockchain's difficulty level is set to 3 at the time of initialization.
73 |Eg. hash
74 |0002fdd96ffec46277a753fa983773599c816dcf100c956afae0a4853fd1ce32
75 |Let's store some data and Mine very first block of our blockchain by doing PoW.
77 |[BlockShell] $ dotx hello blockchain
78 |Blockshell comes with build-in command dotx which is used to create a new transaction and this will mine new block with given data (eg. hello blockchain)
79 |Output
80 |[Status] Mining block (1) with PoW ...
81 | [ Info ] Time Elapsed : 0.0164740085602 seconds.
82 | [ Info ] Mined Hash : 000eea381e45c9f6c1c330cf991b5b1e7d15f739da3894b703e412881b2c2edd
83 |
Mining this block will depend on the difficulty level of the blockchain. Right now difficulty is of 3 and thats why our block mined in less than a second. After mining action, we received hash of that block with 3 initials as zero as difficulty is 3.
85 |First block in blockchain is known as Genesis block and which is created manually at the time of blockchain development. In our case, creation of this genesis block is handled by Blockshell. When we initialized the blockchain, it also created genesis block. Lets check this out.
87 |Now, we have 2 blocks in our blockchain. First is genesis block and other we created in previous step and that contains data hello blockchain
89 |List all blocks in blockchain with following command
90 |[BlockShell] $ allblocks
91 |This lists hashes of all the blocks. 92 | Output 93 |
94 |338a2d1ac1b8135283ae19a304b2b426b69b9caba7ef462f246fc577a0297230 95 | 000eea381e45c9f6c1c330cf991b5b1e7d15f739da3894b703e412881b2c2edd 96 |
97 |Let's check what's inside each block. For this Blockshell has getblock command.
99 |Here, 338a2d1ac1b8135283ae19a304b2b426b69b9caba7ef462f246fc577a0297230 is genesis block. Let's look inside our genesis block
100 |[BlockShell] $ getblock 338a2d1ac1b8135283ae19a304b2b426b69b9caba7ef462f246fc577a0297230
101 |Output
102 |{
103 | 'nonce': 0,
104 | 'index': 0,
105 | 'hash': '338a2d1ac1b8135283ae19a304b2b426b69b9caba7ef462f246fc577a0297230',
106 | 'previousHash': '',
107 | 'timestamp': '2018-01-27 20:13:44.835930',
108 | 'data': 'Genesis Block'
109 | }
110 |
111 | Similarly, let's check what's inside our own created block.
112 |[BlockShell] $ getblock 000eea381e45c9f6c1c330cf991b5b1e7d15f739da3894b703e412881b2c2edd
113 |Output
114 |
115 | {
116 | 'nonce': 1959,
117 | 'index': 1,
118 | 'hash': '000eea381e45c9f6c1c330cf991b5b1e7d15f739da3894b703e412881b2c2edd',
119 | 'previousHash': '338a2d1ac1b8135283ae19a304b2b426b69b9caba7ef462f246fc577a0297230',
120 | 'timestamp': '2018-01-27 20:15:01.515716',
121 | 'data': 'hello blockchain'
122 | }
123 |
124 | Blockshell comes with built-in Blockchain web explorer. You can search blocks and data in your blockchain from your web browser.
127 |Open new terminal, go to cloned Blockshell directory and run web.py python script.
128 |python web.py
129 |Go to localhost 127.0.0.1:5000/allblocks in browser and give it a shot!
130 |Project BlockShell is created by with a vision to teach blockchain concepts to students and programmers.
137 | Contact Creator 138 |