Exemple #1
0
def sendTransaction(w3, nonce, from_address):
    # print(nonce)
    to_address = w3.toChecksumAddress(
        "0x54a7a3c6822eb222c53F76443772a60b0f9A8bab")
    tmp_from_address = w3.toChecksumAddress(from_address)
    platon = PlatON(w3)
    transaction_dict = {
        "to": to_address,
        "gasPrice": platon.gasPrice,
        "gas": 21000,
        "nonce": nonce,
        "data": "",
        "chainId": 100,
        "value": 1000,
        'from': tmp_from_address,
    }

    signedTransactionDict = platon.account.signTransaction(
        transaction_dict,
        "a689f0879f53710e9e0c1025af410a530d6381eebb5916773195326e123b822b")

    # log.debug("signedTransactionDict:::::::{},nonce::::::::::{}".format(signedTransactionDict, nonce))

    data = signedTransactionDict.rawTransaction
    return HexBytes(platon.sendRawTransaction(data)).hex()
Exemple #2
0
def unit_test_address(url):
    w3 = Web3(HTTPProvider(url))
    platon = PlatON(w3)
    print(platon.net_type)
    ppos = Ppos(w3)
    pip = Pip(w3)
    print(ppos.getPackageReward())
    print('w3 net_type is:{}'.format(platon.net_type))
    print('platon net_type is:{}'.format(platon.net_type))
    print('stakingAddress is:{}'.format(ppos.stakingAddress))
    print('penaltyAddress is:{}'.format(ppos.penaltyAddress))
    print('delegateRewardAddress is:{}'.format(ppos.delegateRewardAddress))
    print('restrictingAddress is:{}'.format(ppos.restrictingAddress))
    print('pipAddress is:{}'.format(pip.pipAddress))
Exemple #3
0
from client_sdk_python.packages.eth_utils import to_checksum_address

true = True
false = False

# w3 = Web3(HTTPProvider("http://10.1.1.5:6789"))
# platon = PlatON(w3)
# print(w3.isConnected())
#
# from_address = "lax1yjjzvjph3tw4h2quw6mse25y492xy7fzwdtqja"
# print(from_address)
#
# send_privatekey = "16e80ad4079462cc7f9748af2f9cf03e8f7384bed597c086db4f11a98c3b08f0"

w3 = Web3(HTTPProvider("http://10.1.1.2:6789"))
platon = PlatON(w3)
print(w3.isConnected())

from_address = "lax1uqug0zq7rcxddndleq4ux2ft3tv6dqljphydrl"
print(from_address)

send_privatekey = "983759fe9aac227c535b21d78792d79c2f399b1d43db46ae6d50a33875301557"


def contract_deploy(bytecode, fromAddress):
    bytecode = bytecode
    transactionHash = platon.sendTransaction({
        "from": fromAddress,
        "gas": 1000000,
        "gasPrice": 1000000000,
        "data": bytecode,
Exemple #4
0
#     function transfer(address payable addr) public payable{
#         addr.transfer(msg.value);
#     }
# }
# '''

true = True
false = False

# w3 = Web3(HTTPProvider("http://10.1.1.2:6789"))
# platon = PlatON(w3)
# print(w3.isConnected())
# from_address = "lax1uqug0zq7rcxddndleq4ux2ft3tv6dqljphydrl"
# send_privatekey = "983759fe9aac227c535b21d78792d79c2f399b1d43db46ae6d50a33875301557"
w3 = Web3(HTTPProvider("http://10.1.1.5:6789"))
platon = PlatON(w3)
print(w3.isConnected())
from_address = "lax1yjjzvjph3tw4h2quw6mse25y492xy7fzwdtqja"
print(from_address)

send_privatekey = "b7a7372e78160f71a1a75e03c4aa72705806a05cf14ef39c87fdee93d108588c"
# bytecode = '608060405234801561001057600080fd5b506040518060400160405280600581526020017f48656c6c6f0000000000000000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610107565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a357805160ff19168380011785556100d1565b828001600101855582156100d1579182015b828111156100d05782518255916020019190600101906100b5565b5b5090506100de91906100e2565b5090565b61010491905b808211156101005760008160009055506001016100e8565b5090565b90565b610465806101166000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063a413686214610046578063cfae321714610101578063ef690cc014610184575b600080fd5b6100ff6004803603602081101561005c57600080fd5b810190808035906020019064010000000081111561007957600080fd5b82018360208201111561008b57600080fd5b803590602001918460018302840111640100000000831117156100ad57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610207565b005b610109610221565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014957808201518184015260208101905061012e565b50505050905090810190601f1680156101765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61018c6102c3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cc5780820151818401526020810190506101b1565b50505050905090810190601f1680156101f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b806000908051906020019061021d929190610361565b5050565b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102b95780601f1061028e576101008083540402835291602001916102b9565b820191906000526020600020905b81548152906001019060200180831161029c57829003601f168201915b5050505050905090565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103595780601f1061032e57610100808354040283529160200191610359565b820191906000526020600020905b81548152906001019060200180831161033c57829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106103a257805160ff19168380011785556103d0565b828001600101855582156103d0579182015b828111156103cf5782518255916020019190600101906103b4565b5b5090506103dd91906103e1565b5090565b61040391905b808211156103ff5760008160009055506001016103e7565b5090565b9056fea265627a7a7231582049d7f8a29a0126f071821d6483cb3a246925e56555044971726b41b649dd7e6864736f6c63782c302e352e31332d646576656c6f702e323032302e352e31382b636f6d6d69742e33616239633638642e6d6f64005c'
# bytecode = '608060405234801561001057600080fd5b506040516106243803806106248339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101b0565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b6101ad91905b808211156101a9576000816000905550600101610191565b5090565b90565b610465806101bf6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063a413686214610046578063cfae321714610101578063ef690cc014610184575b600080fd5b6100ff6004803603602081101561005c57600080fd5b810190808035906020019064010000000081111561007957600080fd5b82018360208201111561008b57600080fd5b803590602001918460018302840111640100000000831117156100ad57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610207565b005b610109610221565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014957808201518184015260208101905061012e565b50505050905090810190601f1680156101765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61018c6102c3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cc5780820151818401526020810190506101b1565b50505050905090810190601f1680156101f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b806000908051906020019061021d929190610361565b5050565b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102b95780601f1061028e576101008083540402835291602001916102b9565b820191906000526020600020905b81548152906001019060200180831161029c57829003601f168201915b5050505050905090565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103595780601f1061032e57610100808354040283529160200191610359565b820191906000526020600020905b81548152906001019060200180831161033c57829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106103a257805160ff19168380011785556103d0565b828001600101855582156103d0579182015b828111156103cf5782518255916020019190600101906103b4565b5b5090506103dd91906103e1565b5090565b61040391905b808211156103ff5760008160009055506001016103e7565b5090565b9056fea265627a7a72315820f67de41e40b8cf679e7bae0565040506f43456684b3fa204030df4e564ea476264736f6c63782c302e352e31332d646576656c6f702e323032302e352e31382b636f6d6d69742e33616239633638642e6d6f64005c'
# bytecode = '608060405234801561001057600080fd5b506101a1806100206000396000f3fe6080604052600436106100295760003560e01c80631a6952301461002e578063c84aae1714610072575b600080fd5b6100706004803603602081101561004457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506100d7565b005b34801561007e57600080fd5b506100c16004803603602081101561009557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610121565b6040518082815260200191505060405180910390f35b8073ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561011d573d6000803e3d6000fd5b5050565b60008173ffffffffffffffffffffffffffffffffffffffff1631905091905056fea265627a7a723158205ec5e488bb1e8d852f1da0fafa9a4557d3c92d3bf9b839b176c551d75c76b51064736f6c63782c302e352e31332d646576656c6f702e323032302e352e31382b636f6d6d69742e33616239633638642e6d6f64005c'
bytecode = '608060405234801561001057600080fd5b506102b7806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806371e5ee5f1461003b578063e590cf7f146100a9575b600080fd5b6100676004803603602081101561005157600080fd5b81019080803590602001909291905050506101b6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61015f600480360360208110156100bf57600080fd5b81019080803590602001906401000000008111156100dc57600080fd5b8201836020820111156100ee57600080fd5b8035906020019184602083028401116401000000008311171561011057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506101f2565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101a2578082015181840152602081019050610187565b505050509050019250505060405180910390f35b600081815481106101c357fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60607324a42648378add5ba81c76b70caa84a9546279228260008151811061021657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505081905091905056fea265627a7a7231582095e2e313d166a0c2ce2537b858b388dfa0f631c0c8622519a5b282644d0682ef64736f6c63782c302e352e31332d646576656c6f702e323032302e352e31382b636f6d6d69742e33616239633638642e6d6f64005c'

# abi = [{"constant":false,"inputs":[],"name":"doWhileControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"doWhileControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forBreakControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forBreakControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forContinueControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forContinueControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forReturnControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forReturnControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"int256","name":"age","type":"int256"}],"name":"forThreeControlControl","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forThreeControlControlResult","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForBreakControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForContinueControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForReturnControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForThreeControlControlResult","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getIfControlResult","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getdoWhileResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"age","type":"uint256"}],"name":"ifControl","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ifControlResult","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}]
# abi = [{'inputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'constant': True, 'inputs': [], 'name': 'greet', 'outputs': [{'internalType': 'string', 'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'greeting', 'outputs': [{'internalType': 'string', 'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'internalType': 'string', 'name': '_greeting', 'type': 'string'}], 'name': 'setGreeting', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}]
# abi = [{'inputs': [{'internalType': 'string', 'name': '_greeting', 'type': 'string'}], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'constant': True, 'inputs': [], 'name': 'greet', 'outputs': [{'internalType': 'string', 'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'greeting', 'outputs': [{'internalType': 'string', 'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'internalType': 'string', 'name': '_greeting', 'type': 'string'}], 'name': 'setGreeting', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}]
# abi = [{'constant': True, 'inputs': [{'internalType': 'address', 'name': 'addr', 'type': 'address'}], 'name': 'getBalances', 'outputs': [{'internalType': 'uint256', 'name': '', 'type': 'uint256'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'internalType': 'address payable', 'name': 'addr', 'type': 'address'}], 'name': 'transfer', 'outputs': [], 'payable': True, 'stateMutability': 'payable', 'type': 'function'}]
abi = [{
#
#     function setGreeting(string _greeting) public {
#         greeting = _greeting;
#     }
#
#     function greet() view public returns (string) {
#         return greeting;
#     }
# }
# '''

true = True
false = False

w3 = Web3(HTTPProvider("http://10.1.1.5:6789"))
platon = PlatON(w3)
print(w3.isConnected())

from_address = "lax1l0sm6ath520sa8tsq499ya8a5j9qkzh2zxgddm"
print(from_address)

send_privatekey = "16e80ad4079462cc7f9748af2f9cf03e8f7384bed597c086db4f11a98c3b08f0"

bytecode = '608060405234801561001057600080fd5b506040518060400160405280600581526020017f48656c6c6f0000000000000000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610107565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a357805160ff19168380011785556100d1565b828001600101855582156100d1579182015b828111156100d05782518255916020019190600101906100b5565b5b5090506100de91906100e2565b5090565b61010491905b808211156101005760008160009055506001016100e8565b5090565b90565b610465806101166000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063a413686214610046578063cfae321714610101578063ef690cc014610184575b600080fd5b6100ff6004803603602081101561005c57600080fd5b810190808035906020019064010000000081111561007957600080fd5b82018360208201111561008b57600080fd5b803590602001918460018302840111640100000000831117156100ad57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610207565b005b610109610221565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014957808201518184015260208101905061012e565b50505050905090810190601f1680156101765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61018c6102c3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cc5780820151818401526020810190506101b1565b50505050905090810190601f1680156101f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b806000908051906020019061021d929190610361565b5050565b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102b95780601f1061028e576101008083540402835291602001916102b9565b820191906000526020600020905b81548152906001019060200180831161029c57829003601f168201915b5050505050905090565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103595780601f1061032e57610100808354040283529160200191610359565b820191906000526020600020905b81548152906001019060200180831161033c57829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106103a257805160ff19168380011785556103d0565b828001600101855582156103d0579182015b828111156103cf5782518255916020019190600101906103b4565b5b5090506103dd91906103e1565b5090565b61040391905b808211156103ff5760008160009055506001016103e7565b5090565b9056fea265627a7a7231582049d7f8a29a0126f071821d6483cb3a246925e56555044971726b41b649dd7e6864736f6c63782c302e352e31332d646576656c6f702e323032302e352e31382b636f6d6d69742e33616239633638642e6d6f64005c'

# abi = [{"constant":false,"inputs":[],"name":"doWhileControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"doWhileControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forBreakControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forBreakControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forContinueControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forContinueControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forReturnControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forReturnControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"int256","name":"age","type":"int256"}],"name":"forThreeControlControl","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"forThreeControlControlResult","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForBreakControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForContinueControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForReturnControlResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getForThreeControlControlResult","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getIfControlResult","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getdoWhileResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"age","type":"uint256"}],"name":"ifControl","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ifControlResult","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}]
abi = [{'inputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'constant': True, 'inputs': [], 'name': 'greet', 'outputs': [{'internalType': 'string', 'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'greeting', 'outputs': [{'internalType': 'string', 'name': '', 'type': 'string'}], 'payable': False, 'stateMutability': 'view', 'type': 'function'}, {'constant': False, 'inputs': [{'internalType': 'string', 'name': '_greeting', 'type': 'string'}], 'name': 'setGreeting', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}]
# platon.defaultAccount = platon.accounts[0]
# Instantiate and deploy contract
Greeter = platon.contract(abi=abi, bytecode=bytecode)
print(Greeter)
from client_sdk_python import Web3, HTTPProvider
from client_sdk_python.eth import PlatON
from hexbytes import HexBytes

# get blockNumber
w3 = Web3(HTTPProvider("http://localhost:6789"))
platon = PlatON(w3)
block_number = platon.blockNumber
print(block_number)

# get Balance
address = '0x493301712671Ada506ba6Ca7891F436D29185821'
balance = platon.getBalance(address)
print(balance)

# sendtransaction
to = '0xC1f330B214668beAc2E6418Dd651B09C759a4Bf5'
w3.personal.unlockAccount(address, "password", 60)
data = {
    "from": address,
    "to": to,
    "value": 0x10909,
}
transaction_hex = HexBytes(platon.sendTransaction(data)).hex()
result = platon.waitForTransactionReceipt(transaction_hex)
print(result)
# bytecode=binascii.b2a_hex(contents)

true = True
false = False
#10.1.1.5 ./keytool genkeypair
# Address:     lax1du4w3q0h5gpxh2vpdvtl7m8h2p9qj40a2krhx7
# PrivateKey:  de66562d36f1db46a55f966cfb0eb0981e3e219aa6050612e9f3cb29b8b5c89d
# PublicKey :  6c71c6cfaed8732dafe6ce8888165ac6c8a126e286c226d0ea08fcac768ece512d1eeffad2c442ade2376b2c47472dcea7e30882855f5a3557261b95a72ae9d8

# 10.1.1.8  juzix@juzix:~/linux/bin$ ./keytool genkeypair
# Address:     lax13gz7uf8eht4p0leeq3r5z6c88es458twj2tfu9
# PrivateKey:  a90f9b646e699909cc5a5c8a95bff1bfd744755fa99a0db03327212527d3c33b
# PublicKey :  fc731c6429a0b752e896aa9593afdbae9c10f5f7b77fbcb28820aa9600c2273cf2291deca15670432feac9dbdd56097772bc4cb8d219d094055107e004da6e3d

w3 = Web3(HTTPProvider("http://10.1.1.2:6789"))
platon = PlatON(w3)
print(w3.isConnected())
# from_address = "lax1du4w3q0h5gpxh2vpdvtl7m8h2p9qj40a2krhx7"
from_address = "lax1uqug0zq7rcxddndleq4ux2ft3tv6dqljphydrl"
print(from_address)

# send_privatekey = "de66562d36f1db46a55f966cfb0eb0981e3e219aa6050612e9f3cb29b8b5c89d"
send_privatekey = "983759fe9aac227c535b21d78792d79c2f399b1d43db46ae6d50a33875301557"

# bytecode='0061736d0100000001480d60027f7f0060017f017f60017f0060027f7f017f60037f7f7f017f60000060037f7f7f0060047f7f7f7f017f60047f7f7f7f0060027f7e006000017f60027f7e017f60017f017e02a9010703656e760c706c61746f6e5f70616e6963000503656e7617706c61746f6e5f6765745f696e7075745f6c656e677468000a03656e7610706c61746f6e5f6765745f696e707574000203656e7617706c61746f6e5f6765745f73746174655f6c656e677468000303656e7610706c61746f6e5f6765745f7374617465000703656e7610706c61746f6e5f7365745f7374617465000803656e760d706c61746f6e5f72657475726e0000034e4d05000003030307000201000201050104060201000c000101010902000b0203030507010201000003090404060002000104000003000403020000080001000407020406020000050601010800000405017001030305030100020608017f0141d088040b073904066d656d6f72790200115f5f7761736d5f63616c6c5f63746f727300070f5f5f66756e63735f6f6e5f65786974002706696e766f6b6500140908010041010b0208080ac9644d0400104d0b0b00200041186a200110090b800101027f230041206b22032400024020002802042202200028020847044020022001100b1a2000200028020441246a3602040c010b200341086a2000200220002802006b41246d220241016a100c2002200041086a100d22022802082001100b1a2002200228020841246a36020820002002100e2002100f0b200341206a24000ba10101037f20004200370200200041086a2202410036020020012d0000410171450440200020012902003702002002200141086a28020036020020000f0b20012802082103024020012802042201410a4d0440200020014101743a0000200041016a21020c010b200141106a4170712204101321022000200136020420002004410172360200200020023602080b200220032001104e200120026a41003a000020000b250020002001100a1a2000410c6a2001410c6a100a1a200041186a200141186a100a1a20000b2f01017f2001200028020820002802006b41246d2200410174220220022001491b41c7e3f138200041e3f1b81c491b0b4c01017f2000410036020c200041106a2003360200200104402001101021040b2000200436020020002004200241246c6a220236020820002004200141246c6a36020c2000200236020420000b900101027f2000280204210220002802002103034020022003464504402001280204415c6a2002415c6a2202101120012001280204415c6a3602040c010b0b200028020021022000200128020436020020012002360204200028020421022000200128020836020420012002360208200028020821022000200128020c3602082001200236020c200120012802043602000b2b01027f200028020821012000280204210203402001200247044020002001415c6a22013602080c010b0b0b0900200041246c10130b620020002001290200370200200041086a200141086a28020036020020011012200041146a200141146a2802003602002000200129020c37020c2001410c6a1012200041206a200141206a28020036020020002001290218370218200141186a10120b2201017f03402001410c470440200020016a4100360200200141046a21010c010b0b0b0b002000410120001b10150b9f0602057f017e230041a0016b22002400104d10012201101522031002200041206a200041086a200320011016220241001017200041206a101802400240200041206a1019450d002000280224450d0020002802202d000041c001490d010b10000b20004180016a200041206a101a200028028401220141094f044010000b20002802800121030340200104402001417f6a210120033100002005420886842105200341016a21030c010b0b024002402005500d00418008101b200551044020024101101c0c020b418508101b200551044020024102101c0c020b419108101b20055104402002101d410147044010000b200041206a101e21032000413c6a280200210220002802382104200041d8006a101f210120004198016a410036020020004190016a420037030020004188016a4200370300200042003703800120004180016a200220046b41246d41ff0171ad22051020200028028001210220004180016a4104721021200120021022200120051023220128020c200141106a28020047044010000b200128020020012802041006200128020c22020440200120023602100b200310240c020b41a208101b2005520d002002101d410247044010000b200041206a200241011017200041206a101802400240200041206a1019450d002000280224450d0020002802202d000041c001490d010b10000b20004180016a200041206a101a200028028401220141024f044010000b4100210220002802800121030340200104402001417f6a210120032d00002102200341016a21030c010b0b200041206a101e2103200041c8006a200041206a280218200241ff017141246c6a410c6a100a1a200041d8006a101f210120004198016a410036020020004190016a420037030020004188016a4200370300200042003703800120004180016a200041f0006a200041c8006a100a102521022000280280012104200241046a1021200120041022200120004180016a200041c8006a100a1026220128020c200141106a28020047044010000b200128020020012802041006200128020c22020440200120023602100b200310240c010b10000b1027200041a0016a24000b9b0101047f230041106b220124002001200036020c2000047f41c808200041086a2202411076220041c8082802006a220336020041c40841c408280200220420026a41076a417871220236020002400240200341107420024d044041c808200341016a360200200041016a21000c010b2000450d010b200040000d0010000b20042001410c6a4104103c41086a0541000b2100200141106a240020000b0c00200020012002411c10280bc90202067f017e230041106b220324002001280208220520024b0440200341086a2001102d20012003280208200328020c102e36020c20032001102d410021052001027f410020032802002207450d001a410020032802042208200128020c2206490d001a200820062006417f461b210420070b360210200141146a2004360200200141003602080b200141106a210603402001280214210402402005200249044020040d01410021040b200020062802002004411410281a200341106a24000f0b20032001102d41002104027f410020032802002205450d001a410020032802042208200128020c2207490d001a200820076b2104200520076a0b2105200120043602142001200536021020032006410020052004102e10512001200329030022093702102001200128020c2009422088a76a36020c2001200128020841016a22053602080c000b000b4101017f200028020445044010000b0240200028020022012d0000418101470d00200028020441014d047f100020002802000520010b2c00014100480d0010000b0b980101037f200028020445044041000f0b20001018200028020022022c0000220141004e044020014100470f0b027f4101200141807f460d001a200141ff0171220341b7014d0440200028020441014d047f100020002802000520020b2d00014100470f0b4100200341bf014b0d001a2000280204200141ff017141ca7e6a22014d047f100020002802000520020b20016a2d00004100470b0bd50101047f200110292204200128020422024b04401000200128020421020b200128020021052000027f02400240200204404100210120052c00002203417f4a0d01027f200341ff0171220141bf014d04404100200341ff017141b801490d011a200141c97e6a0c010b4100200341ff017141f801490d001a200141897e6a0b41016a21010c010b4101210120050d000c010b41002103200120046a20024b0d0020022001490d00410020022004490d011a200120056a2103200220016b20042004417f461b0c010b41000b360204200020033602000b3901027e42a5c688a1c89ca7f94b210103402000300000220250450440200041016a2100200142b383808080207e20028521010c010b0b20010b6701027f23004180016b22022400200241306a102a200241306a102b21032000101d410247044010000b200241086a200041011017200241086a2003102c200241086a101e2100200241086a200241d8006a2003100b20011100002000102420024180016a24000b800101047f230041106b2201240002402000280204450d0020002802002d000041c001490d00200141086a2000102d200128020c210003402000450d01200141002001280208220320032000102e22046a20034520002004497222031b3602084100200020046b20031b2100200241016a21020c000b000b200141106a240020020be906010c7f230041b0016b22042400200042003702182000428ed1dd82cbd38f9ca07f3703102000410036020820004200370200200041206a4100360200200441206a101f22072000290310102f200728020c200741106a28020047044010000b200041186a21052000411c6a21090240200728020022022007280204220810032206450d002006101321030340200120036a41003a00002006200141016a2201470d000b20022008200320011004417f460440410021010c010b02400240200441086a200341016a200120036a2003417f736a10162203280204450d0020032802002d000041c001490d002003101d21012000280220200028021822026b41246d20014904402005200441386a2001200028021c20026b41246d200041206a100d2201100e2001100f0b20044188016a2003410110302101200441f8006a2003410010302108200041206a210b20012802042103034020082802042003464100200128020822022008280208461b0d02200441e0006a20032002411c1028200441386a102b2203102c0240200028021c220220002802204904402002200310112009200928020041246a3602000c010b20044198016a2005200220052802006b41246d220241016a100c2002200b100d210220042802a00120031011200420042802a00141246a3602a00120052002100e2002100f0b20012001280204220320012802086a410020031b22033602042001280200220204402001200236020820032002102e210a2001027f2001280204220c4504404100210241000c010b41002102410020012802082203200a490d001a2003200a200a417f461b2102200c0b2203ad2002ad42208684370204200141002001280200220a20026b22022002200a4b1b3602000c0105200141003602080c010b000b000b10000b200621010b200728020c22030440200720033602100b024020010d0020002802042206200028020022036b41246d22022000280220200028021822016b41246d4d04402002200928020020016b41246d22084b044020032003200841246c6a2202200110311a20022006200910320c020b2005200320062001103110330c010b200104402005103420004100360220200042003702180b200020052002100c2202101022013602182000200136021c20002001200241246c6a36022020032006200910320b200441b0016a240020000b29002000410036020820004200370200200041001035200041146a41003602002000420037020c20000b840102027f017e4101210320014280015a0440034020012004845045044020044238862001420888842101200241016a2102200442088821040c010b0b200241384f047f2002103620026a0520020b41016a21030b200041186a28020022020440200041086a280200200041146a2802002002103721000b2000200028020020036a3602000bea0101047f230041106b22042400200028020422012000280210220241087641fcffff07716a2103027f410020012000280208460d001a2003280200200241ff07714102746a0b2101200441086a20001038200428020c210203400240200120024604402000410036021420002802082103200028020421010340200320016b41027522024103490d022000200141046a22013602040c000b000b200141046a220120032802006b418020470d0120032802042101200341046a21030c010b0b2002417f6a220241014d04402000418004418008200241016b1b3602100b200020011039200441106a24000b1300200028020820014904402000200110350b0bbc0202037f037e024020015004402000418001103f0c010b20014280015a044020012107034020062007845045044020064238862007420888842107200241016a2102200642088821060c010b0b0240200241384f04402002210303402003044020034108762103200441016a21040c010b0b200441c9004f044010000b2000200441b77f6a41ff0171103f2000200028020420046a1053200028020420002802006a417f6a21042002210303402003450d02200420033a0000200341087621032004417f6a21040c000b000b200020024180017341ff0171103f0b2000200028020420026a1053200028020420002802006a417f6a210203402001200584500d02200220013c0000200542388620014208888421012002417f6a2102200542088821050c000b000b20002001a741ff0171103f0b20004101104220000be206010d7f230041b0016b22012400200141186a101f2106200141a8016a22024100360200200141a0016a2205420037030020014198016a22044200370300200142003703900120014190016a20002903101020200128029001210720014190016a410472102120062007102220062000290310102f200628020c200641106a28020047044010000b200628020421092006280200210a2001101f21032002410036020020054200370300200442003703002001420037039001027f20002802182000411c6a280200460440200141013602900141010c010b20014190016a4100103a2107200028021c200028021822026b2105037f2005047f20074100103a22042002103b2004200141d0006a2002410c6a100a102520014180016a200241186a100a10254101103a1a2005415c6a2105200241246a21020c010520074101103a1a2001280290010b0b0b210420014190016a410472102141011013220241fe013a0000200328020c200341106a28020047044010000b200241016a21072003280204220541016a220820032802084b047f20032008103520032802040520050b20032802006a20024101103c1a2003200328020441016a3602042003200420026b20076a10222003200028021c20002802186b41246d103d210b200028021c200028021822026b2105200141d0006a410472210c20014190016a410472210d034020050440200b4103103d210420014100360268200142003703602001420037035820014200370350200141d0006a2002103b200141d0006a200141406b2002410c6a2207100a1025200141306a200241186a2208100a10251a20042001280250102220044101103d2104200141003602a801200142003703a0012001420037039801200142003703900120014190016a20014180016a2002100a10251a200420012802900110222004200141f0006a2002100a10262104200d1021200420014190016a2007100a102620014180016a2008100a10261a200c10212005415c6a2105200241246a21020c010b0b0240200328020c2003280210460440200328020021020c010b100020032802002102200328020c2003280210460d0010000b200a2009200220032802041005200328020c22020440200320023602100b200628020c22020440200620023602100b200041186a103e2000103e200141b0016a24000ba10101037f41012103024002400240200128020420012d00002202410176200241017122041b220241014d0440200241016b0d032001280208200141016a20041b2c0000417f4c0d010c030b200241374b0d010b200241016a21030c010b2002103620026a41016a21030b027f200041186a28020022010440200041086a280200200041146a280200200110370c010b20000b2201200128020020036a36020020000b910101047f410121022001280208200141016a20012d0000220441017122051b210302400240024002402001280204200441017620051b2201410146044020032c000022014100480d012000200141ff0171103f0c040b200141374b0d01200121020b200020024180017341ff0171103f0c010b200020011040200121020b200020032002410010410b20004101104220000b880101037f41b408410136020041b8082802002100034020000440034041bc0841bc082802002201417f6a2202360200200141014845044041b4084100360200200020024102746a22004184016a280200200041046a28020011020041b408410136020041b80828020021000c010b0b41bc08412036020041b808200028020022003602000c010b0b0b730020004200370210200042ffffffff0f370208200020023602042000200136020002402003410871450d002000104f20024f0d002003410471044010000c010b200042003702000b02402003411071450d002000104f20024d0d0020034104710440100020000f0b200042003702000b20000bff0201037f200028020445044041000f0b2000101841012102024020002802002c00002201417f4a0d00200141ff0171220341b7014d0440200341807f6a0f0b02400240200141ff0171220141bf014d0440024020002802042201200341c97e6a22024d047f100020002802040520010b4102490d0020002802002d00010d0010000b200241054f044010000b20002802002d000145044010000b4100210241b7012101034020012003460440200241384f0d030c0405200028020020016a41ca7e6a2d00002002410874722102200141016a21010c010b000b000b200141f7014d0440200341c07e6a0f0b024020002802042201200341897e6a22024d047f100020002802040520010b4102490d0020002802002d00010d0010000b200241054f044010000b20002802002d000145044010000b4100210241f701210103402001200346044020024138490d0305200028020020016a418a7e6a2d00002002410874722102200141016a21010c010b0b0b200241ff7d490d010b10000b20020bc50201027f200041003a0000200041246a2202417f6a41003a0000200041003a0002200041003a00012002417d6a41003a00002002417e6a41003a0000200041003a00032002417c6a41003a00002000410020006b41037122016a220241003602002002412420016b417c7122016a2200417c6a4100360200024020014109490d002002410036020820024100360204200041786a4100360200200041746a410036020020014119490d002002410036021820024100360214200241003602102002410036020c200041706a41003602002000416c6a4100360200200041686a4100360200200041646a41003602002001200241047141187222016b2100200120026a2101034020004120490d0120014200370300200141186a4200370300200141106a4200370300200141086a4200370300200141206a2101200041606a21000c000b000b0b16002000104a2000410c6a104a200041186a104a20000b5e01017f230041306b220224002002200041001017200241186a200241001017200241186a2001104b200241186a200041011017200241186a2001410c6a104b200241186a200041021017200241186a200141186a104b200241306a24000b2101017f20011029220220012802044b044010000b2000200120011050200210510b2701017f230041206b22022400200241086a2000200141141028104f2100200241206a240020000b09002000200110231a0be70101037f230041106b2204240020004200370200200041086a410036020020012802042103024002402002450440200321020c010b410021022003450d002003210220012802002d000041c001490d00200441086a2001102d20004100200428020c2201200428020822022001102e22032003417f461b20024520012003497222031b220536020820004100200220031b3602042000200120056b3602000c010b20012802002103200128020421012000410036020020004100200220016b20034520022001497222021b36020820004100200120036a20021b3602040b200441106a240020000b3e000340200020014645044020022000104c2002410c6a2000410c6a104c200241186a200041186a104c200241246a2102200041246a21000c010b0b20020b2e000340200020014645044020022802002000100b1a2002200228020041246a360200200041246a21000c010b0b0b0900200020013602040b0b002000200028020010330b2f01017f200028020820014904402001101520002802002000280204103c210220002001360208200020023602000b0b1e01017f03402000044020004108762100200141016a21010c010b0b20010b25002000200120026a417f6a220241087641fcffff07716a280200200241ff07714102746a0b4f01037f20012802042203200128021020012802146a220441087641fcffff07716a21022000027f410020032001280208460d001a2002280200200441ff07714102746a0b360204200020023602000b2501017f200028020821020340200120024645044020002002417c6a22023602080c010b0b0bc30c02077f027e230041306b22042400200041046a2107027f20014101460440200041086a280200200041146a280200200041186a220228020022031037280200210120022003417f6a360200200710434180104f044020072000410c6a280200417c6a10390b200141384f047f2001103620016a0520010b41016a2102200041186a28020022010440200041086a280200200041146a280200200110370c020b20000c010b0240200710430d00200041146a28020022014180084f0440200020014180786a360214200041086a2201280200220228020021032001200241046a360200200420033602182007200441186a10440c010b2000410c6a2802002202200041086a2802006b4102752203200041106a2205280200220620002802046b220141027549044041802010132105200220064704400240200028020c220120002802102202470d0020002802082203200028020422064b04402000200320012003200320066b41027541016a417e6d41027422026a1045220136020c2000200028020820026a3602080c010b200441186a200220066b2201410175410120011b22012001410276200041106a10462102200028020c210320002802082101034020012003470440200228020820012802003602002002200228020841046a360208200141046a21010c010b0b200029020421092000200229020037020420022009370200200029020c21092000200229020837020c2002200937020820021047200028020c21010b200120053602002000200028020c41046a36020c0c020b02402000280208220120002802042202470d00200028020c2203200028021022064904402000200120032003200620036b41027541016a41026d41027422026a104822013602082000200028020c20026a36020c0c010b200441186a200620026b2201410175410120011b2201200141036a410276200041106a10462102200028020c210320002802082101034020012003470440200228020820012802003602002002200228020841046a360208200141046a21010c010b0b200029020421092000200229020037020420022009370200200029020c21092000200229020837020c2002200937020820021047200028020821010b2001417c6a2005360200200020002802082201417c6a22023602082002280200210220002001360208200420023602182007200441186a10440c010b20042001410175410120011b200320051046210241802010132106024020022802082201200228020c2203470d0020022802042205200228020022084b04402002200520012005200520086b41027541016a417e6d41027422036a104522013602082002200228020420036a3602040c010b200441186a200320086b2201410175410120011b22012001410276200241106a280200104621032002280208210520022802042101034020012005470440200328020820012802003602002003200328020841046a360208200141046a21010c010b0b20022902002109200220032902003702002003200937020020022902082109200220032902083702082003200937020820031047200228020821010b200120063602002002200228020841046a360208200028020c2105034020002802082005460440200028020421012000200228020036020420022001360200200228020421012002200536020420002001360208200029020c21092000200229020837020c2002200937020820021047052005417c6a210502402002280204220120022802002203470d0020022802082206200228020c22084904402002200120062006200820066b41027541016a41026d41027422036a104822013602042002200228020820036a3602080c010b200441186a200820036b2201410175410120011b2201200141036a4102762002280210104621062002280208210320022802042101034020012003470440200428022020012802003602002004200428022041046a360220200141046a21010c010b0b20022902002109200220042903183702002002290208210a20022004290320370208200420093703182004200a37032020061047200228020421010b2001417c6a200528020036020020022002280204417c6a3602040c010b0b0b200441186a20071038200428021c410036020041012102200041186a0b2201200128020020026a360200200441306a240020000b2701017f230041106b2202240020004100103a20022001100a10254101103a1a200241106a24000bfc0801067f03400240200020046a2105200120046a210320022004460d002003410371450d00200520032d00003a0000200441016a21040c010b0b200220046b210602402005410371220745044003402006411049450440200020046a2203200120046a2205290200370200200341086a200541086a290200370200200441106a2104200641706a21060c010b0b027f2006410871450440200120046a2103200020046a0c010b200020046a2205200120046a2204290200370200200441086a2103200541086a0b21042006410471044020042003280200360200200341046a2103200441046a21040b20064102710440200420032f00003b0000200341026a2103200441026a21040b2006410171450d01200420032d00003a000020000f0b024020064120490d002007417f6a220741024b0d00024002400240024002400240200741016b0e020102000b2005200120046a220328020022073a0000200541016a200341016a2f00003b0000200041036a2108200220046b417d6a2106034020064111490d03200420086a2203200120046a220541046a2802002202410874200741187672360200200341046a200541086a2802002207410874200241187672360200200341086a2005410c6a28020022024108742007411876723602002003410c6a200541106a2802002207410874200241187672360200200441106a2104200641706a21060c000b000b2005200120046a220328020022073a0000200541016a200341016a2d00003a0000200041026a2108200220046b417e6a2106034020064112490d03200420086a2203200120046a220541046a2802002202411074200741107672360200200341046a200541086a2802002207411074200241107672360200200341086a2005410c6a28020022024110742007411076723602002003410c6a200541106a2802002207411074200241107672360200200441106a2104200641706a21060c000b000b2005200120046a28020022073a0000200041016a21082004417f7320026a2106034020064113490d03200420086a2203200120046a220541046a2802002202411874200741087672360200200341046a200541086a2802002207411874200241087672360200200341086a2005410c6a28020022024118742007410876723602002003410c6a200541106a2802002207411874200241087672360200200441106a2104200641706a21060c000b000b200120046a41036a2103200020046a41036a21050c020b200120046a41026a2103200020046a41026a21050c010b200120046a41016a2103200020046a41016a21050b20064110710440200520032d00003a00002005200328000136000120052003290005370005200520032f000d3b000d200520032d000f3a000f200541106a2105200341106a21030b2006410871044020052003290000370000200541086a2105200341086a21030b2006410471044020052003280000360000200541046a2105200341046a21030b20064102710440200520032f00003b0000200541026a2105200341026a21030b2006410171450d00200520032d00003a00000b20000b8c0201057f2001044020002802042105200041106a2802002202200041146a280200220349044020022001ad2005ad422086843702002000200028021041086a36021020000f0b027f41002002200028020c22046b410375220641016a2202200320046b2203410275220420042002491b41ffffffff01200341037541ffffffff00491b2204450d001a200441037410130b2102200220064103746a22032001ad2005ad4220868437020020032000280210200028020c22066b22016b2105200220044103746a2102200341086a2103200141014e0440200520062001103c1a0b20002002360214200020033602102000200536020c20000f0b200041c001103f2000410041004101104120000b0e0020002802000440200010340b0b2500200041011052200028020020002802046a20013a00002000200028020441016a3602040b5e01027f20011036220241b7016a22034180024e044010000b2000200341ff0171103f2000200028020420026a1053200028020420002802006a417f6a2100034020010440200020013a0000200141087621012000417f6a21000c010b0b0b2d00200020021052200028020020002802046a20012002103c1a2000200028020420026a3602042000200310420b820201047f02402001450d00034020002802102202200028020c460d01200241786a28020020014904401000200028021021020b200241786a2203200328020020016b220136020020010d012000200336021020004101200028020422032002417c6a28020022016b22021036220441016a20024138491b220520036a1053200120002802006a220320056a2003200210490240200241374d0440200028020020016a200241406a3a00000c010b200441f7016a220341ff014d0440200028020020016a20033a00002000280200200120046a6a210103402002450d02200120023a0000200241087621022001417f6a21010c000b000b10000b410121010c000b000b0b2801017f200028020820002802046b2201410874417f6a410020011b200028021420002802106a6b0ba10202057f017e230041206b22052400024020002802082202200028020c2203470d0020002802042204200028020022064b04402000200420022004200420066b41027541016a417e6d41027422036a104522023602082000200028020420036a3602040c010b200541086a200320066b2202410175410120021b220220024102762000410c6a10462103200028020821042000280204210203402002200446450440200328020820022802003602002003200328020841046a360208200241046a21020c010b0b20002902002107200020032902003702002003200737020020002902082107200020032902083702082003200737020820031047200028020821020b200220012802003602002000200028020841046a360208200541206a24000b2501017f200120006b220141027521032001044020022000200110490b200220034102746a0b4f01017f2000410036020c200041106a2003360200200104402001410274101321040b200020043602002000200420024102746a22023602082000200420014102746a36020c2000200236020420000b2b01027f200028020821012000280204210203402001200247044020002001417c6a22013602080c010b0b0b1b00200120006b22010440200220016b22022000200110490b20020b8d0301037f024020002001460d00200120006b20026b410020024101746b4d0440200020012002103c1a0c010b20002001734103712103027f024020002001490440200020030d021a410021030340200120036a2105200020036a2204410371450440200220036b210241002103034020024104490d04200320046a200320056a280200360200200341046a21032002417c6a21020c000b000b20022003460d04200420052d00003a0000200341016a21030c000b000b024020030d002001417f6a21040340200020026a22034103714504402001417c6a21032000417c6a2104034020024104490d03200220046a200220036a2802003602002002417c6a21020c000b000b2002450d042003417f6a200220046a2d00003a00002002417f6a21020c000b000b2001417f6a210103402002450d03200020026a417f6a200120026a2d00003a00002002417f6a21020c000b000b200320056a2101200320046a0b210303402002450d01200320012d00003a00002002417f6a2102200341016a2103200141016a21010c000b000b0b170020004200370200200041086a4100360200200010120bf30201057f230041206b22022400024002402000280204044020002802002d000041c001490d010b200241086a104a0c010b200241186a2000101a2000102921030240024002400240200228021822000440200228021c220520034f0d010b41002100200241106a410036020020024200370308410021050c010b200241106a4100360200200242003703082000200520032003417f461b22046a21052004410a4b0d010b200220044101743a0008200241086a41017221030c010b200441106a4170712206101321032002200436020c20022006410172360208200220033602100b03402000200546450440200320002d00003a0000200341016a2103200041016a21000c010b0b200341003a00000b024020012d0000410171450440200141003b01000c010b200128020841003a00002001410036020420012d0000410171450d00200141003602000b20012002290308370200200141086a200241106a280200360200200241086a1012200241206a24000b8c0201047f20002001470440200128020420012d00002202410176200241017122041b2102200141016a210320012802082105410a21012005200320041b210420002d0000410171220304402000280200417e71417f6a21010b200220014d0440027f2003044020002802080c010b200041016a0b21012002044020012004200210490b200120026a41003a000020002d00004101710440200020023602040f0b200020024101743a00000f0b416f2103200141e6ffffff074d0440410b20014101742201200220022001491b220141106a4170712001410b491b21030b20031013220120042002104e200020023602042000200341017236020020002001360208200120026a41003a00000b0b3501017f230041106b220041d0880436020c41c008200028020c41076a417871220036020041c408200036020041c8083f003602000b100020020440200020012002103c1a0b0b2e01017f200028020445044041000f0b4101210120002802002c0000417f4c047f20001050200010296a0520010b0b5b00027f027f41002000280204450d001a410020002802002c0000417f4a0d011a20002802002d0000220041bf014d04404100200041b801490d011a200041c97e6a0c010b4100200041f801490d001a200041897e6a0b41016a0b0b5b01027f2000027f0240200128020022054504400c010b200220036a200128020422014b0d0020012002490d00410020012003490d011a200220056a2104200120026b20032003417f461b0c010b41000b360204200020043602000b1b00200028020420016a220120002802084b04402000200110350b0b0f00200020011035200020013602040b0b3901004180080b32696e6974006164645f6d657373616765006765745f6d6573736167655f73697a65006765745f6d6573736167655f626f64790a'
# abi=[{"baseclass":[],"fields":[{"name":"head","type":"string"}],"name":"message","type":"struct"},{"baseclass":["message"],"fields":[{"name":"body","type":"string"},{"name":"end","type":"string"}],"name":"my_message","type":"struct"},{"constant":false,"input":[{"name":"one_message","type":"my_message"}],"name":"init","output":"void","type":"Action"},{"constant":false,"input":[{"name":"one_message","type":"my_message"}],"name":"add_message","output":"void","type":"Action"},{"constant":true,"input":[],"name":"get_message_size","output":"uint8","type":"Action"},{"constant":true,"input":[{"name":"index","type":"uint8"}],"name":"get_message_body","output":"string","type":"Action"}]
bytecode = '0061736d0100000001470d60017f017f60027f7f0060000060017f0060037f7f7f0060047f7f7f7f0060027f7f017f60037f7f7f017f60047f7f7f7f017f60017f017e60027f7e006000017f60017e017f02a9010703656e760c706c61746f6e5f70616e6963000203656e7617706c61746f6e5f6765745f696e7075745f6c656e677468000b03656e7610706c61746f6e5f6765745f696e707574000303656e7617706c61746f6e5f6765745f73746174655f6c656e677468000603656e7610706c61746f6e5f6765745f7374617465000803656e7610706c61746f6e5f7365745f7374617465000503656e760d706c61746f6e5f72657475726e000103201f0202000704090903000300000c010a020803000001070106010104020000050405017001010105030100020608017f0141b088040b073904066d656d6f72790200115f5f7761736d5f63616c6c5f63746f727300070f5f5f66756e63735f6f6e5f65786974001606696e766f6b6500080ad02a1f040010220b940202047f017e230041d0006b22012400102210012200100922021002200141386a200141086a20022000100a22004100100b02400240200141386a100c2204500d00418008100d20045104402000100e200141386a100f10100c020b418508100d200451044020001011410247044010000b200141386a20004101100b200141386a100c2104200141386a100f210020012004370348200010100c020b418908100d2004520d002000100e200141206a100f210220012903302104200141386a10122200200410131014200020041015200028020c200041106a28020047044010000b200028020020002802041006200028020c22030440200020033602100b200210100c010b10000b1016200141d0006a24000b9b0101047f230041106b220124002001200036020c2000047f41a408200041086a2202411076220041a4082802006a220336020041a00841a008280200220420026a41076a417871220236020002400240200341107420024d044041a408200341016a360200200041016a21000c010b2000450d010b200040000d0010000b20042001410c6a4104101c41086a0541000b2100200141106a240020000b0c00200020012002411c10170bc90202067f017e230041106b220324002001280208220520024b0440200341086a2001101d20012003280208200328020c101e36020c20032001101d410021052001027f410020032802002207450d001a410020032802042208200128020c2206490d001a200820062006417f461b210420070b360210200141146a2004360200200141003602080b200141106a210603402001280214210402402005200249044020040d01410021040b200020062802002004411410171a200341106a24000f0b20032001101d41002104027f410020032802002205450d001a410020032802042208200128020c2207490d001a200820076b2104200520076a0b2105200120043602142001200536021020032006410020052004101e10252001200329030022093702102001200128020c2009422088a76a36020c2001200128020841016a22053602080c000b000bad0302057f017e20001018024002402000280204450d00200010180240200028020022012c0000220241004e044020020d010c020b200241807f460d00200241ff0171220341b7014d0440200028020441014d04401000200028020021010b20012d00010d010c020b200341bf014b0d012000280204200241ff017141ca7e6a22024d04401000200028020021010b200120026a2d0000450d010b2000280204450d0020012d000041c001490d010b10000b200010192204200028020422014b04401000200028020421010b20002802002105024002400240200104404100210320052c00002200417f4a0d01027f200041ff0171220341bf014d04404100200041ff017141b801490d011a200341c97e6a0c010b4100200041ff017141f801490d001a200341897e6a0b41016a21030c010b4101210320050d00410021000c010b41002100200320046a20014b0d0020012004490d004100210220012003490d01200320056a2102200120036b20042004417f461b22004109490d0110000c010b410021020b0340200004402000417f6a210020023100002006420886842106200241016a21020c010b0b20060b3901027e42a5c688a1c89ca7f94b210103402000300000220250450440200041016a2100200142b383808080207e20028521010c010b0b20010b0e0020001011410147044010000b0bda0101077f230041306b22052400200042d1f0fad48ae09ad34537030820004200370300200541186a1012220220002903081015200228020c200241106a28020047044010000b02400240200228020022062002280204220710032204450d002004101a21030340200120036a41003a00002004200141016a2201470d000b20062007200320011004417f460d0020002005200341016a200120036a2003417f736a100a100c3703100c010b410021040b200228020c22010440200220013602100b2004450440200020002903003703100b200541306a240020000bb40201097f230041306b22032400200341186a10122202200029030810131014200220002903081015200228020c200241106a28020047044010000b20022802042105200228020021062003101221012000290310101321074101101a220441fe013a0000200128020c200141106a28020047044010000b2001280204220841016a220920012802084b047f20012009101b20012802040520080b20012802006a20044101101c1a2001200128020441016a3602042001200441016a200720046b6a10142001200029031010150240200128020c2001280210460440200128020021000c010b100020012802002100200128020c2001280210460d0010000b20062005200020012802041005200128020c22000440200120003602100b200228020c22010440200220013602100b200341306a24000b800101047f230041106b2201240002402000280204450d0020002802002d000041c001490d00200141086a2000101d200128020c210003402000450d01200141002001280208220320032000101e22046a20034520002004497222031b3602084100200020046b20031b2100200241016a21020c000b000b200141106a240020020b2900200041003602082000420037020020004100101b200041146a41003602002000420037020c20000b7002027f017e4101210120004280015a047f41002101034020002003845045044020034238862000420888842100200141016a2101200342088821030c010b0b024020014138490d002001210203402002450d01200141016a2101200241087621020c000b000b200141016a0520010b0b13002000280208200149044020002001101b0b0bc10402057f027e024020015004402000418001101f0c010b20014280015a044020012108034020072008845045044020074238862008420888842108200241016a2102200742088821070c010b0b0240200241384f04402002210403402004044020044108762104200341016a21030c010b0b200341c9004f044010000b2000200341b77f6a41ff0171101f2000200028020420036a1020200028020420002802006a417f6a21032002210403402004450d02200320043a0000200441087621042003417f6a21030c000b000b200020024180017341ff0171101f0b2000200028020420026a1020200028020420002802006a417f6a21024200210703402001200784500d02200220013c0000200742388620014208888421012002417f6a2102200742088821070c000b000b20002001a741ff0171101f0b0340024020002802102202200028020c460d00200241786a2802004504401000200028021021020b200241786a22042004280200417f6a220336020020030d002000200436021041002104200028020422062002417c6a28020022056b2203210203402002044020024108762102200441016a21040c010b0b20004101200441016a20034138491b220220066a1020200028020020056a220620026a200620031021200341374d0440200028020020056a200341406a3a00000c020b200441084d0440200028020020056a200441776a3a0000200028020020056a20046a210203402003450d03200220033a0000200341087621032002417f6a21020c000b000510000c020b000b0b0b880101037f4190084101360200419408280200210003402000044003404198084198082802002201417f6a220236020020014101484504404190084100360200200020024102746a22004184016a280200200041046a280200110300419008410136020041940828020021000c010b0b4198084120360200419408200028020022003602000c010b0b0b730020004200370210200042ffffffff0f370208200020023602042000200136020002402003410871450d002000102320024f0d002003410471044010000c010b200042003702000b02402003411071450d002000102320024d0d0020034104710440100020000f0b200042003702000b20000b4101017f200028020445044010000b0240200028020022012d0000418101470d00200028020441014d047f100020002802000520010b2c00014100480d0010000b0bff0201037f200028020445044041000f0b2000101841012102024020002802002c00002201417f4a0d00200141ff0171220341b7014d0440200341807f6a0f0b02400240200141ff0171220141bf014d0440024020002802042201200341c97e6a22024d047f100020002802040520010b4102490d0020002802002d00010d0010000b200241054f044010000b20002802002d000145044010000b4100210241b7012101034020012003460440200241384f0d030c0405200028020020016a41ca7e6a2d00002002410874722102200141016a21010c010b000b000b200141f7014d0440200341c07e6a0f0b024020002802042201200341897e6a22024d047f100020002802040520010b4102490d0020002802002d00010d0010000b200241054f044010000b20002802002d000145044010000b4100210241f701210103402001200346044020024138490d0305200028020020016a418a7e6a2d00002002410874722102200141016a21010c010b0b0b200241ff7d490d010b10000b20020b0b002000410120001b10090b2f01017f200028020820014904402001100920002802002000280204101c210220002001360208200020023602000b0bfc0801067f03400240200020046a2105200120046a210320022004460d002003410371450d00200520032d00003a0000200441016a21040c010b0b200220046b210602402005410371220745044003402006411049450440200020046a2203200120046a2205290200370200200341086a200541086a290200370200200441106a2104200641706a21060c010b0b027f2006410871450440200120046a2103200020046a0c010b200020046a2205200120046a2204290200370200200441086a2103200541086a0b21042006410471044020042003280200360200200341046a2103200441046a21040b20064102710440200420032f00003b0000200341026a2103200441026a21040b2006410171450d01200420032d00003a000020000f0b024020064120490d002007417f6a220741024b0d00024002400240024002400240200741016b0e020102000b2005200120046a220328020022073a0000200541016a200341016a2f00003b0000200041036a2108200220046b417d6a2106034020064111490d03200420086a2203200120046a220541046a2802002202410874200741187672360200200341046a200541086a2802002207410874200241187672360200200341086a2005410c6a28020022024108742007411876723602002003410c6a200541106a2802002207410874200241187672360200200441106a2104200641706a21060c000b000b2005200120046a220328020022073a0000200541016a200341016a2d00003a0000200041026a2108200220046b417e6a2106034020064112490d03200420086a2203200120046a220541046a2802002202411074200741107672360200200341046a200541086a2802002207411074200241107672360200200341086a2005410c6a28020022024110742007411076723602002003410c6a200541106a2802002207411074200241107672360200200441106a2104200641706a21060c000b000b2005200120046a28020022073a0000200041016a21082004417f7320026a2106034020064113490d03200420086a2203200120046a220541046a2802002202411874200741087672360200200341046a200541086a2802002207411874200241087672360200200341086a2005410c6a28020022024118742007410876723602002003410c6a200541106a2802002207411874200241087672360200200441106a2104200641706a21060c000b000b200120046a41036a2103200020046a41036a21050c020b200120046a41026a2103200020046a41026a21050c010b200120046a41016a2103200020046a41016a21050b20064110710440200520032d00003a00002005200328000136000120052003290005370005200520032f000d3b000d200520032d000f3a000f200541106a2105200341106a21030b2006410871044020052003290000370000200541086a2105200341086a21030b2006410471044020052003280000360000200541046a2105200341046a21030b20064102710440200520032f00003b0000200541026a2105200341026a21030b2006410171450d00200520032d00003a00000b20000b2101017f20011019220220012802044b044010000b2000200120011024200210250b2701017f230041206b22022400200241086a200020014114101710232100200241206a240020000b3f01027f2000280204220241016a220320002802084b047f20002003101b20002802040520020b20002802006a20013a00002000200028020441016a3602040b0f0020002001101b200020013602040b8d0301037f024020002001460d00200120006b20026b410020024101746b4d0440200020012002101c1a0c010b20002001734103712103027f024020002001490440200020030d021a410021030340200120036a2105200020036a2204410371450440200220036b210241002103034020024104490d04200320046a200320056a280200360200200341046a21032002417c6a21020c000b000b20022003460d04200420052d00003a0000200341016a21030c000b000b024020030d002001417f6a21040340200020026a22034103714504402001417c6a21032000417c6a2104034020024104490d03200220046a200220036a2802003602002002417c6a21020c000b000b2002450d042003417f6a200220046a2d00003a00002002417f6a21020c000b000b2001417f6a210103402002450d03200020026a417f6a200120026a2d00003a00002002417f6a21020c000b000b200320056a2101200320046a0b210303402002450d01200320012d00003a00002002417f6a2102200341016a2103200141016a21010c000b000b0b3501017f230041106b220041b0880436020c419c08200028020c41076a417871220036020041a008200036020041a4083f003602000b2e01017f200028020445044041000f0b4101210120002802002c0000417f4c047f20001024200010196a0520010b0b5b00027f027f41002000280204450d001a410020002802002c0000417f4a0d011a20002802002d0000220041bf014d04404100200041b801490d011a200041c97e6a0c010b4100200041f801490d001a200041897e6a0b41016a0b0b5b01027f2000027f0240200128020022054504400c010b200220036a200128020422014b0d0020012002490d00410020012003490d011a200220056a2104200120026b20032003417f461b0c010b41000b360204200020043602000b0b1301004180080b0c696e69740073657400676574'
abi = [{
    "constant": false,
    "input": [{
        "name": "input",
import rlp
import time
import random as _
import binascii
import json
import os
from hexbytes import HexBytes
from client_sdk_python import Web3, HTTPProvider
from client_sdk_python.eth import PlatON
from client_sdk_python.utils.transactions import get_block_gas_limit

w3 = Web3(HTTPProvider("http://192.168.21.75:6789"))
platon = PlatON(w3)
from_address = 'lat1c6a7wyxedrs3pgmf5ansd3xlrkd7zyhvy94sn3'
gas = get_block_gas_limit(w3) - 1

# unlock account
# w3.personal.unlockAccount('lat1c6a7wyxedrs3pgmf5ansd3xlrkd7zyhvy94sn3', "123456", 3600*100)


class HexJsonEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, HexBytes):
            return obj.hex()
        return super().default(obj)


def hex_json_encode(dict_):
    return json.dumps(dict(dict_), cls=HexJsonEncoder, indent=2)

from client_sdk_python import Web3, HTTPProvider
from client_sdk_python.eth import PlatON
from client_sdk_python.packages.platon_keys.utils import bech32, address
from hexbytes import HexBytes
from client_sdk_python.packages.eth_utils import to_checksum_address

true = True
false = False
# get blockNumber
# w3 = Web3(HTTPProvider("http://10.1.1.2:6789"))
# platon = PlatON(w3)
w3 = Web3(HTTPProvider("http://10.1.1.5:6789"))
platon = PlatON(w3)
print(w3.isConnected())
from_address = "lax1yjjzvjph3tw4h2quw6mse25y492xy7fzwdtqja"
send_privatekey = "b7a7372e78160f71a1a75e03c4aa72705806a05cf14ef39c87fdee93d108588c"
block_number = platon.blockNumber
print(block_number)
print(platon.protocolVersion)
print(platon.accounts)
print(platon.syncing)
print(platon.gasPrice)
print(platon.evidences)
print(platon.consensusStatus)

# get Balance
from_address = 'lax1yjjzvjph3tw4h2quw6mse25y492xy7fzwdtqja'
# address = '0x493301712671Ada506ba6Ca7891F436D29185821'
balance = platon.getBalance(from_address)
print(balance)
platon.getPrepareQC()