Exemple #1
0
port = 2811  # Server will listen on this port - 2811 for official Duino-Coin server (14808 for old one)
serverVersion = 1.8  # Server version which will be sent to the clients
diff_incrase_per = 2000  # Difficulty will increase every x blocks (official server uses 5k)
duco_email = "xxx"  # E-mail and password to send registration mail from
duco_password = "******"

use_wrapper = True  # Choosing if you want to use wrapper or not

if use_wrapper:
    import tronpy  # tronpy isn't default installed, install it with "pip install tronpy"
    from tronpy.keys import PrivateKey, PublicKey
    wrapper_private_key = "removed because of it has to be private"  # private key used for interacting with blockchain, removed because of it's PRIVATE
    wrapper_public_key = PrivateKey(
        bytes.fromhex(wrapper_private_key)).public_key.to_base58check_address(
        )  # wrapper's public key
    tron = tronpy.Tron(network="shasta")
    wduco = tron.get_contract(
        "TXYTNzayd9itrDkJugAzevTpuUNrt9aUqp")  # wDUCO contract

# Registration email - text version
text = """\
Hi there!
Your e-mail address has been successfully verified and you are now registered on the Duino-Coin network!
We hope you'll have a great time using Duino-Coin.
If you have any difficulties there are a lot of guides on our website: https://duinocoin.com/getting-started
You can also join our Discord server: https://discord.gg/kvBkccy to chat, take part in giveaways, trade and get help from other Duino-Coin users.
Happy mining!
Duino-Coin Team"""
# Registration email - HTML version
html = """\
<html>
Exemple #2
0
            else:
                try:
                    priv_key = password_decrypt(
                        config["wrapper"]["priv_key"],
                        b64decode(config["wallet"]["password"]).decode(
                            "utf8")).decode("utf8")
                except InvalidToken:
                    print(getString("invalid_passphrase_wrapper"))
                    use_wrapper = False
                    wrong_passphrase = True

            pub_key = config["wrapper"]["pub_key"]

            while True:
                try:
                    tron = tronpy.Tron()
                    # wDUCO contract
                    wduco = tron.get_contract(
                        "TWYaXdxA12JywrUdou3PFD1fvx2PWjqK9U")
                    break
                except:
                    print("Retrying wDUCO contract fetch")
                    pass

            while True:
                try:
                    wbalance = wduco.functions.balanceOf(
                        config["wrapper"]["pub_key"])
                    break
                except:
                    print("Retrying wDUCO balance fetch")
Exemple #3
0
}

event = {
    'callbackAddr': '0x5a0d3ab8219a1bd91be27f8cbd8e12cf3fe1fcf6',
    'callbackFunctionId': '4357855e00000000000000000000000000000000000000000000000000000000',
    'cancelExpiration': '1602790200',
    'data': '',
    'dataVersion': '1',
    'payment': '1000000000000000',
    'requestId': '7907cb05f248e2cda73266426bdd3009557b112d385ea8baa1da79f1191f5df8',
    'requester': '0x5a0d3ab8219a1bd91be27f8cbd8e12cf3fe1fcf6',
    'specId': '3239666139616131336266313436383738386237636334613530306134356238',
}
"""

client = tronpy.Tron(network="nile")

print('request from')
print(client.to_base58check_address(event['callbackAddr']))

#reply_value = random.randint(0, 10000000000)
reply_value = 50

print('REPLY:', reply_value)

oracle = client.get_contract("TYZxQSHAhxGgUWzxYEZAohvWc9cQWXtNBt")

# fulfillOracleRequest(
#   bytes32 _requestId,
#   uint256 _payment,
#   address _callbackAddress,