Created
December 29, 2017 21:32
-
-
Save azamsharp/a04fafb04b5f53479bd10790ea8eea46 to your computer and use it in GitHub Desktop.
BlockChainService
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // BlockchainService.swift | |
| // Run | |
| // | |
| // Created by Mohammad Azam on 12/25/17. | |
| // | |
| import Foundation | |
| import Vapor | |
| class BlockchainService { | |
| typealias JSONDictionary = [String:String] | |
| private var blockchain :Blockchain = Blockchain() | |
| init() { | |
| } | |
| func addBlock(_ block :Block) { | |
| self.blockchain.addBlock(block) | |
| } | |
| func registerNode(_ blockchainNode :BlockchainNode) { | |
| self.blockchain.addNode(blockchainNode) | |
| } | |
| func getLastBlock() -> Block { | |
| return self.blockchain.blocks.last! | |
| } | |
| func getBlockchain() -> Blockchain? { | |
| return self.blockchain | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment