-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOptis.php
51 lines (39 loc) · 1 KB
/
Optis.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace optis;
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author Lynn Digital
* @link https://lynndigital.com
*/
use optis\blockchain\Chain;
use optis\blockchain\Block;
use optis\network\Server;
use optis\network\Client;
class Optis {
/**@var Chain*/
public $chain;
/**@var Server*/
public $server;
/**@var Client*/
public $client;
/**
* Optis constructor.
* @param Chain $chain
*/
public function __construct(Chain $chain) {
$this->chain = $chain;
$this->chain->init();
$this->client = new Client($this);
}
public function addBlock(Block $block) {
$this->chain->addBlock($block);
$this->client->pushBlock($block);
}
public function stop() {
$this->chain->save();
}
}