Beispiel #1
0
def startForging():
    url = 'http://'+ip+':8888/shareschain?requestType=startForging'
    data = {"secretPhrase":secretPhrase}
    obj = req.post(url, data)

    if obj['hitTime'] != '':
        print('启动锻造器成功!')
    else:
        print('启动锻造器失败!')
Beispiel #2
0
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
Beispiel #3
0
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('结束锻造其失败!')
Beispiel #4
0
def getBlockchainStatus():
    url = 'http://' + ip + ':8888/shareschain?requestType=getBlockchainStatus'
    data = {}
    obj = req.post(url, data)
    print obj
    return obj
Beispiel #5
0
def getBlockchainTransactions(account):
    url = "http://"+ip+":8888/shareschain?requestType=getTransaction"
    data = {'chain': 'SCTK', 'account': account}
    obj = req.post(url, data)
    return obj
Beispiel #6
0
def getTransaction(fullHash):
    url = "http://"+ip+":8888/shareschain?requestType=getTransaction"
    data = {'chain':'SCTK','fullHash':fullHash}
    obj = req.post(url, data)
    return obj
Beispiel #7
0
def getUnconfirmedTransactionIds():
    url = "http://"+ip+":8888/shareschain?requestType=getUnconfirmedTransactionIds"
    data = {}
    obj = req.post(url, data)
    return obj
Beispiel #8
0
def getSmcTransaction(transaction,fullHash):
    url = "http://"+ip+":8888/shareschain?requestType=getSmcTransaction"
    data = {'transaction':transaction,'fullHash':fullHash}
    obj = req.post(url, data)
    return obj
Beispiel #9
0
def getNextBlockGenerators():
    url = 'http://'+ip+':8888/shareschain?requestType=getNextBlockGenerators'
    data = {}
    obj = req.post(url, data)
    return obj
Beispiel #10
0
def findForgingBySecrePhrase():
    url = 'http://'+ip+':8888/shareschain?requestType=getForging'
    data = {"secretPhrase": secretPhrase}
    obj = req.post(url, data)
    return obj
Beispiel #11
0
def getNodes():
    url = "http://" + ip + ":8888/shareschain?requestType=getNodes"
    data = {}
    obj = req.post(url, data)
    return obj
Beispiel #12
0
def addNode(nodeIP):
    url = "http://" + ip + ":8888/shareschain?requestType=addNode"
    data = {'node': nodeIP}
    obj = req.post(url, data)
    return obj