Exemple #1
0
    // Use this for initialization
    async void Start()
    {
        LndHelper.SetupEnvironmentVariables();
        if (readConfig)
        {
            config = LndHelper.ReadConfigFile(Application.dataPath + "/Resources/" + confname);
        }
        else
        {
            config = new LndConfig {
                Hostname = hostname, Port = port, MacaroonFile = macaroonFile, TlsFile = certFile
            };
        }


        cert = File.ReadAllText(Application.dataPath + "/Resources/" + config.TlsFile);

        mac = LndHelper.ToHex(File.ReadAllBytes(Application.dataPath + "/Resources/" + config.MacaroonFile));
        await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);

        SubscribeInvoices();

        var getInfo = await GetInfo();

        pubkey = getInfo.IdentityPubkey;
        Debug.Log(pubkey);
    }
Exemple #2
0
    public async void NeutrinoUnlock()
    {
        cert = File.ReadAllText(Application.dataPath + "/Resources/" + config.TlsFile);
        mac  = "";
        try
        {
            mac = LndHelper.ToHex(File.ReadAllBytes(Application.dataPath + "/Resources/" + config.MacaroonFile));
        }
        catch (Exception e)
        {
            UnityEngine.Debug.Log(e);
        }
        await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);

        var seed = await GenerateSeed();

        var s = await UnlockWallet("suchwowmuchhey", seed);


        await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);

        var getinfo = await GetInfo();

        Debug.Log(getinfo.IdentityPubkey);
    }
Exemple #3
0
    async void Start()
    {
        if (readConfig)
        {
            config = readConfigFile(Application.dataPath + "/Resources/donnertanks.conf");
            Debug.Log(config.WebServerPort);
        }
        else
        {
            config = new DonnerTanksConfig {
                Hostname = hostname, Port = port, MacaroonFile = macaroonFile, TlsFile = certFile
            };
        }
        LndHelper.SetupEnvironmentVariables();

        cert = File.ReadAllText(Application.dataPath + "/Resources/" + config.TlsFile);

        mac = LndHelper.ToHex(File.ReadAllBytes(Application.dataPath + "/Resources/" + config.MacaroonFile));

        //await ConnectToLnd(hostname + ":" + port, cert);
        await ConnectToLndWithMacaroon(hostname + ":" + port, cert, mac);

        OnInvoiceSettled += new InvoiceSettledEventHandler(ReadInvoice);
        SubscribeInvoices();
        var getInfo = await GetInfo();

        pubkey = getInfo.IdentityPubkey;
        webServer.StartServer(config.WebServerIp, config.WebServerPort);
    }
Exemple #4
0
    // Use this for initialization
    async void Start()
    {
        LndHelper.SetupEnvironmentVariables();
        if (readConfig)
        {
            config = LndHelper.ReadConfigFile(Application.dataPath + "/Resources/" + confname);
        }
        else
        {
            config = new LndConfig {
                Hostname = hostname, Port = port, MacaroonFile = macaroonFile, TlsFile = certFile
            };
        }
        if (config.Neutrino)
        {
            var neutrino = gameObject.AddComponent <NeutrinoTest>() as NeutrinoTest;
            neutrino.StartLnd(config);
            NeutrinoUnlock();
        }
        else
        {
            cert = File.ReadAllText(Application.dataPath + "/Resources/" + config.TlsFile);

            mac = LndHelper.ToHex(File.ReadAllBytes(Application.dataPath + "/Resources/" + config.MacaroonFile));
            await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);

            OnInvoiceSettled += new InvoiceSettledEventHandler(ChangeWeather);

            SubscribeInvoices();

            var getInfo = await GetInfo();

            pubkey = getInfo.IdentityPubkey;
        }
    }
Exemple #5
0
    // Use this for initialization
    async void Start()
    {
        LndHelper.SetupEnvironmentVariables();


        string name = "";

        if (m_PlayerNumber == 1)
        {
            name     = "bob";
            hostname = "localhost";
            port     = "10010";
        }
        else if (m_PlayerNumber == 2)
        {
            name     = "charlie";
            hostname = "localhost";
            port     = "10011";
        }
        cert = File.ReadAllText(Application.dataPath + "/Resources/" + name + ".cert");

        mac = LndHelper.ToHex(File.ReadAllBytes(Application.dataPath + "/Resources/" + name + "admin.macaroon"));
        //await ConnectToLnd(hostname + ":" + port, cert);
        await ConnectToLndWithMacaroon(hostname + ":" + port, cert, mac);

        gameLnd = GameObject.Find("GameManager").GetComponent <GameManagerLnd>();
    }
Exemple #6
0
    // Use this for initialization
    async void Start()
    {
        if (readConfig)
        {
            config = LndHelper.ReadConfigFile(Application.dataPath + "/Resources/donner.conf");
        }
        else
        {
            config = new LndConfig {
                Hostname = hostname, Port = port, MacaroonFile = macaroonFile, TlsFile = certFile
            };
        }
        LndHelper.SetupEnvironmentVariables();
        cert = File.ReadAllText(Application.dataPath + "/Resources/" + config.TlsFile);

        mac = LndHelper.ToHex(File.ReadAllBytes(Application.dataPath + "/Resources/" + config.MacaroonFile));


        await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);

        OnInvoiceSettled += new InvoiceSettledEventHandler(ChangeWeather);

        SubscribeInvoices();

        var getInfo = await GetInfo();

        pubkey = getInfo.IdentityPubkey;
    }
Exemple #7
0
    IEnumerator GetPublicIP()
    {
        using (WWW www = new WWW("https://ipv4.myexternalip.com/raw"))
        {
            yield return(www);

            var temp = www.text;
            externalIp = LndHelper.RemoveWhitespace(temp);
            Debug.Log(www.text);
        }
    }
    // Use this for initialization
    async void Start()
    {
        if (readConfig)
        {
            config = LndHelper.ReadConfigFile(Application.dataPath + "/Resources/donner.conf");
        }
        else
        {
            config = new LndConfig {
                Hostname = hostname, Port = port, MacaroonFile = macaroonFile, TlsFile = certFile
            };
        }
        LndHelper.SetupEnvironmentVariables();
        cert = File.ReadAllText(Application.dataPath + "/Resources/" + config.TlsFile);

        mac = LndHelper.ToHex(File.ReadAllBytes(Application.dataPath + "/Resources/" + config.MacaroonFile));

        await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);
    }
Exemple #9
0
    // Use this for initialization
    async void Start()
    {
        config = new LndConfig()
        {
            Hostname     = "localhost",
            Port         = "10013",
            MacaroonFile = "/Neutrino/neutrinoadmin.macaroon",
            TlsFile      = "/Neutrino/neutrino.cert"
        };

        lnd.StartLnd(config);

        try
        {
            cert = File.ReadAllText(Application.dataPath + "/Resources/" + config.TlsFile);
        }
        catch (Exception e)
        {
            cert = "";
            UnityEngine.Debug.Log(e);
        }

        try
        {
            mac = LndHelper.ToHex(File.ReadAllBytes(Application.dataPath + "/Resources/" + config.MacaroonFile));
        } catch (Exception e)
        {
            UnityEngine.Debug.Log(e);
            mac = "";
        }
        await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);

        var seed = await GenerateSeed();

        var s = await UnlockWallet("suchwowmuchhey", seed);


        await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);

        var getinfo = await GetInfo();

        Debug.Log(getinfo.IdentityPubkey);
    }
Exemple #10
0
    // Use this for initialization
    async void Start()
    {
        config = new LndConfig {
            Hostname = "localhost", Port = "10006"
        };
        var appdata = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);

        Debug.Log(appdata);
        cert = File.ReadAllText(appdata + "/lightning-app/lnd/tls.cert");
        mac  = LndHelper.ToHex(File.ReadAllBytes(appdata + "/lightning-app/lnd/data/chain/bitcoin/testnet/admin.macaroon"));
        await ConnectToLndWithMacaroon(config.Hostname + ":" + config.Port, cert, mac);

        SubscribeInvoices();

        var getInfo = await GetInfo();

        pubkey = getInfo.IdentityPubkey;
        Debug.Log(pubkey);
    }