Start page background

Cryptocurrency

All Tags

Another Way To Build A Blockchain Section 8: The Miner

April 11, 2018 | Category: Blockchain
Create the Miner Class Create a Miner class to tie all the concepts together. Create app/miner.js: Grab Valid Transactions The first step to writing the mine function that we have in the Miner class is to add a validTransactions function for the TransactionPool. With this validTransactions function…

Another Way To Build A Blockchain Section 7: The Transaction Pool

April 10, 2018 | Category: Blockchain
Get Transactions By giving each of users their own wallet, users of the application will have the ability to conduct transactions with each other, thus putting the cryptocurrency into action. Start in the index file of the app directory, where holds the main code for the interactive application…

Another Way To Build A Blockchain Section 6: Create The Wallet

April 09, 2018 | Category: Blockchain
Create the Util Key Gen To create the keyPair and publicKey objects objects, use a module called ‘elliptic’. Elliptic is a module in node that contains classes and methods that enable elliptic-curve based cryptography. Elliptic cryptography is an advanced mathematical subject, but essentially, it…

Another Way To Build A Blockchain Section 5: Proof Of Work

April 08, 2018 | Category: Blockchain
Dynamic Difficulty Create a system that automatically adjusts the difficulty as more miners are added to the blockchain. In config.js, create a constant to represent the millisecond rate that blocks should be mined: Add difficulty attributes to each block in the chain. In the class of : The…

Another Way To Build A Blockchain Section 4: The Peer Server

April 07, 2018 | Category: Blockchain
Connect to Peers The same class that creates the original websocket server will be used to connect to existing servers. In p2p-server.js: Start a P2pServer instance. Head to app/index.js, and require the P2pServer module: In one command line tab: In a second command line tab or window: Expect…

Another Way To Build A Blockchain Section 3: The API

April 06, 2018 | Category: Blockchain
Get Blocks Add the express module to create a Node API: $ npm i express --save Create a blockchain instance in the main app file. Then create a GET request to get the blockchain’s block. In app/index.js: Now in package.json, add the and scripts to the “scripts” section: Now open the Postman…

Another Way To Build A Blockchain Section 2: The Blockchain

April 05, 2018 | Category: Blockchain
Create the Blockchain Class Create the that creates a chain based on the class: Create blockchain.js Chain Validation Chain validation ensures that incoming chains are not corrupt once there are multiple contributors to the blockchain. To validate a chain, make sure it starts with the genesis…

Another Way To Build A Blockchain Section 1: The Blocks

April 04, 2018 | Category: Blockchain
Create the Block Class Create the block class with a file called block.js. Each black has a hash, lastHash, and timestamp attribute. Create block.js In block.js: Test the new block class. Create dev-test.js alongside block.js: In , find the scripts section and add: Then in the command line, run…
End page background

Get in touch!

Copyright © 2019 Justin Formentin — Built with Gatsby