diff --git a/zdOSchain.py/README.md b/zdOSchain.py/README.md new file mode 100644 index 0000000..8c4bdf9 --- /dev/null +++ b/zdOSchain.py/README.md @@ -0,0 +1,43 @@ +Simple Python Blockchain with MINING! +===================================== + +Kalinet OS-dapp + +*https://github.com/madkali + +zdOS lab's was born from the passion of getting by and the ethereum ecosystem. The main purpose of zdOS is to be able to create the first "operating system-dapp" by merging collapse OS and Crypto-zombie dapp and my zdOS token. the idea of ​​this structure is to bring people to an educational purpose and a free computer system. zdOS has one and only founder and one employee and this will make creation a little faster. I ask you interested to contact me and zdOS and predisposed to the collaboration of all of you + +Collapse OS is a z80 kernel and a collection of programs, tools and documentation that allows you to assemble an OS that, when completed, will be able to: + + Run on minimal and improvised machines. + Interface through improvised means (serial, keyboard, display). + Edit text files. + Compile assembler source files for a wide range of MCUs and CPUs. + Read and write from a wide range of storage devices. + Replicate itself. + +Additionally, the goal of this project is to be as self-contained as possible. With a copy of this project, a capable and creative person should be able to manage to build and install Collapse OS without external resources (i.e. internet) on a machine of her design, built from scavenged parts with low-tech tools. +Organisation of this repository + + kernel: Pieces of code to be assembled by the user into a kernel. + apps: Pieces of code to be assembled into "userspace" application. + recipes: collection of recipes that assemble parts together on a specific machine. + doc: User guide for when you've successfully installed Collapse OS. + tools: Tools for working with Collapse OS from "modern" environments. Mostly development tools, but also contains emulated zasm, which is necessary to build Collapse OS from a non-Collapse OS machine. + +Each folder has a README with more details. +Status + +The project unfinished but is progressing well! See [Collapse OS' website][web] for more information. + +---- 19-3-20 update Kalinet ---- zdOS = wallet cita blockchain Collapse-dapp #work in progress# + +---- 29-3-20 update road-map ---- zdOS = airdrop kalinet by zdOS token -link's for free zdOS token and server Kalinet OS This project was born 5 years ago. I was able to go beyond my skills starting from improvised compuert and a very low programming capacity and despite the work and the little time I decided to give zdOS tokens that with your help as it is an open-source project to participate in evolving this reality by contributing not with money but it goes by following the referral links affiliate marketing server and mining and with a follow me in github + +---- 30-3-20 kalinet is started ---- + + https://www.stateofthedapps.com/dapps/zdos-dapp + +---- 31-3-20 bitmine ---- + + https://bitmine.farm/?i=109507& diff --git a/zdOSchain.py/blockchain.py b/zdOSchain.py/blockchain.py new file mode 100644 index 0000000..b90e855 --- /dev/null +++ b/zdOSchain.py/blockchain.py @@ -0,0 +1,65 @@ +import datetime +import hashlib + +class Block: + blockNo = 0 + data = None + next = None + hash = None + nonce = 0 + previous_hash = 0x0 + timestamp = datetime.datetime.now() + + def __init__(self, data): + self.data = data + + def hash(self): + h = hashlib.sha256() + h.update( + str(self.nonce).encode('utf-8') + + str(self.data).encode('utf-8') + + str(self.previous_hash).encode('utf-8') + + str(self.timestamp).encode('utf-8') + + str(self.blockNo).encode('utf-8') + ) + return h.hexdigest() + + def __str__(self): + return "Block Hash: " + str(self.hash()) + "\nBlockNo: " + str(self.blockNo) + "\nBlock Data: " + str(self.data) + "\nHashes: " + str(self.nonce) + "\n--------------" + + +# noinspection PyInterpreter +class Blockchain: + + diff = 0 + maxNonce = 2**32 + target = 2 ** (256-diff) + + block = Block("Genesis") + head = block + + def add(self, block): + + block.previous_hash = self.block.hash() + block.blockNo = self.block.blockNo + 1 + + self.block.next = block + self.block = self.block.next + + def mine(self, block): + for n in range(self.maxNonce): + if int(block.hash(), 16) <= self.target: + self.add(block) + print(block) + break + else: + block.nonce += 1 + +blockchain = Blockchain() + +for n in range(10): + blockchain.mine(Block("Block " + str(n+1))) + +while blockchain.head != None: + print(blockchain.head) + blockchain.head = blockchain.head.next diff --git a/zdOSchain.py/zdOStoken.py b/zdOSchain.py/zdOStoken.py new file mode 100644 index 0000000..5e49773 --- /dev/null +++ b/zdOSchain.py/zdOStoken.py @@ -0,0 +1,91 @@ +pragma solidity ^0.5.0; + +// ---------------------------------------------------------------------------- +// ERC Token Standard #20 Interface +// +// ---------------------------------------------------------------------------- +contract ERC20Interface { + function totalSupply() public view returns (uint); + function balanceOf(address tokenOwner) public view returns (uint balance); + function allowance(address tokenOwner, address spender) public view returns (uint remaining); + function transfer(address to, uint tokens) public returns (bool success); + function approve(address spender, uint tokens) public returns (bool success); + function transferFrom(address from, address to, uint tokens) public returns (bool success); + + event Transfer(address indexed from, address indexed to, uint tokens); + event Approval(address indexed tokenOwner, address indexed spender, uint tokens); +} + +// ---------------------------------------------------------------------------- +// Safe Math Library +// ---------------------------------------------------------------------------- +contract SafeMath { + function safeAdd(uint a, uint b) public pure returns (uint c) { + c = a + b; + require(c >= a); + } + function safeSub(uint a, uint b) public pure returns (uint c) { + require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); + c = a / b; + } +} + + +contract BlockonomiToken is ERC20Interface, SafeMath { + string public name; + string public symbol; + uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it + + uint256 public _totalSupply; + + mapping(address => uint) balances; + mapping(address => mapping(address => uint)) allowed; + + /** + * Constrctor function + * + * Initializes contract with initial supply tokens to the creator of the contract + */ + constructor() public { + name = "zdOS"; + symbol = "DNS"; + decimals = 18; + _totalSupply = 9999999999999999999999999913; + + balances[msg.sender] = _totalSupply; + emit Transfer(address(0), msg.sender, _totalSupply); + } + + function totalSupply() public view returns (uint) { + return _totalSupply - balances[address(0)]; + } + + function balanceOf(address tokenOwner) public view returns (uint balance) { + return balances[tokenOwner]; + } + + function allowance(address tokenOwner, address spender) public view returns (uint remaining) { + return allowed[tokenOwner][spender]; + } + + function approve(address spender, uint tokens) public returns (bool success) { + allowed[msg.sender][spender] = tokens; + emit Approval(msg.sender, spender, tokens); + return true; + } + + function transfer(address to, uint tokens) public returns (bool success) { + balances[msg.sender] = safeSub(balances[msg.sender], tokens); + balances[to] = safeAdd(balances[to], tokens); + emit Transfer(msg.sender, to, tokens); + return true; + } + + function transferFrom(address from, address to, uint tokens) public returns (bool success) { + balances[from] = safeSub(balances[from], tokens); + allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); + balances[to] = safeAdd(balances[to], tokens); + emit Transfer(from, to, tokens); + return true; + } +}