def startForging(): url = 'http://'+ip+':8888/shareschain?requestType=startForging' data = {"secretPhrase":secretPhrase} obj = req.post(url, data) if obj['hitTime'] != '': print('启动锻造器成功!') else: print('启动锻造器失败!')
def sendMoney(): url = "http://"+ip+":8888/shareschain?requestType=sendMoney" data = {'chain':'SCTK', 'amountKER':1000000000, 'recipient':'dYGNW7A8GMoHqcbkH4n3xmVjFy2', 'secretPhrase':secretPhrase} obj = req.post(url, data) print("发起交易:") print(obj) return obj
def stopForging(): url = 'http://'+ip+':8888/shareschain?requestType=stopForging' data = {"secretPhrase": secretPhrase} obj = req.post(url, data) if obj['foundAndStopped']: print('结束锻造器成功!') else: findobj = findForgingBySecrePhrase(); if findobj['errorCode'] == 5: print('该账户未启动锻造器,或锻造器已停止!') else: print('结束锻造其失败!')
def getBlockchainStatus(): url = 'http://' + ip + ':8888/shareschain?requestType=getBlockchainStatus' data = {} obj = req.post(url, data) print obj return obj
def getBlockchainTransactions(account): url = "http://"+ip+":8888/shareschain?requestType=getTransaction" data = {'chain': 'SCTK', 'account': account} obj = req.post(url, data) return obj
def getTransaction(fullHash): url = "http://"+ip+":8888/shareschain?requestType=getTransaction" data = {'chain':'SCTK','fullHash':fullHash} obj = req.post(url, data) return obj
def getUnconfirmedTransactionIds(): url = "http://"+ip+":8888/shareschain?requestType=getUnconfirmedTransactionIds" data = {} obj = req.post(url, data) return obj
def getSmcTransaction(transaction,fullHash): url = "http://"+ip+":8888/shareschain?requestType=getSmcTransaction" data = {'transaction':transaction,'fullHash':fullHash} obj = req.post(url, data) return obj
def getNextBlockGenerators(): url = 'http://'+ip+':8888/shareschain?requestType=getNextBlockGenerators' data = {} obj = req.post(url, data) return obj
def findForgingBySecrePhrase(): url = 'http://'+ip+':8888/shareschain?requestType=getForging' data = {"secretPhrase": secretPhrase} obj = req.post(url, data) return obj
def getNodes(): url = "http://" + ip + ":8888/shareschain?requestType=getNodes" data = {} obj = req.post(url, data) return obj
def addNode(nodeIP): url = "http://" + ip + ":8888/shareschain?requestType=addNode" data = {'node': nodeIP} obj = req.post(url, data) return obj