added bitcoin block tool
parent
7ea9be8821
commit
0e0be52980
|
@ -0,0 +1,37 @@
|
||||||
|
'''
|
||||||
|
Onionr - P2P Microblogging Platform & Social network
|
||||||
|
|
||||||
|
Handle bitcoin operations
|
||||||
|
'''
|
||||||
|
'''
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
'''
|
||||||
|
from bitpeer.node import *
|
||||||
|
from bitpeer.storage.shelve import ShelveStorage
|
||||||
|
import logging, time
|
||||||
|
class OnionrBTC:
|
||||||
|
def __init__(self, lastBlock='00000000000000000021ee6242d08e3797764c9258e54e686bc2afff51baf599', lastHeight=510613):
|
||||||
|
stream = logging.StreamHandler()
|
||||||
|
logger = logging.getLogger('halfnode')
|
||||||
|
logger.addHandler(stream)
|
||||||
|
logger.setLevel (10)
|
||||||
|
|
||||||
|
LASTBLOCK = lastBlock
|
||||||
|
LASTBLOCKINDEX = lastHeight
|
||||||
|
self.node = Node ('BTC', ShelveStorage ('./btc-blocks.db'), lastblockhash=LASTBLOCK, lastblockheight=LASTBLOCKINDEX)
|
||||||
|
|
||||||
|
self.node.bootstrap ()
|
||||||
|
self.node.connect ()
|
||||||
|
self.node.loop ()
|
||||||
|
|
|
@ -8,3 +8,4 @@ sha3==0.2.1
|
||||||
pycrypto==2.6.1
|
pycrypto==2.6.1
|
||||||
pynacl==1.2.1
|
pynacl==1.2.1
|
||||||
PySocks==1.6.8
|
PySocks==1.6.8
|
||||||
|
bitpeer.py==0.4.7.5
|
||||||
|
|
Loading…
Reference in New Issue