Esempio n. 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);
    }
Esempio n. 2
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;
        }
    }
Esempio n. 3
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;
    }
Esempio n. 4
0
    public void StartLnd(LndConfig config)
    {
        try
        {
            ProcessStartInfo lndStartinfo = new ProcessStartInfo();
            UnityEngine.Debug.Log(Application.dataPath);
            lndStartinfo.FileName               = Application.dataPath + "/Resources/Neutrino/lnd.exe";
            lndStartinfo.WorkingDirectory       = Application.dataPath + "/Resources/Neutrino/";
            lndStartinfo.Arguments              = "--configfile=test_data_neutrino/lnd.conf --rpclisten=" + config.Hostname + ":" + config.Port + " --restlisten=localhost:8089 --listen=0.0.0.0:9750";
            lndStartinfo.UseShellExecute        = false;
            lndStartinfo.RedirectStandardOutput = true;
            lndStartinfo.RedirectStandardError  = true;
            lndStartinfo.WindowStyle            = ProcessWindowStyle.Hidden;
            //lndStartinfo.CreateNoWindow = true;
            lnd = Process.Start(lndStartinfo);
            lnd.ErrorDataReceived  += Lnd_ErrorDataReceived;
            lnd.OutputDataReceived += Lnd_OutputDataReceived;

            lnd.BeginErrorReadLine();
            lnd.BeginOutputReadLine();

            //

            /*
             * lnd = new Process();
             * lnd.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
             * //lnd.StartInfo.CreateNoWindow = true;
             * lnd.StartInfo.UseShellExecute = false;
             * lnd.StartInfo.FileName = Application.dataPath + "/Resources/Neutrino/lndNeutrino.bat";
             *
             * //lnd.StartInfo.Arguments = "/c" + path;
             * lnd.EnableRaisingEvents = true;
             * lnd.StartInfo.RedirectStandardOutput = true;
             * lnd.OutputDataReceived += Lnd_OutputDataReceived;
             *
             * lnd.Start();
             * UnityEngine.Debug.Log(lnd.ProcessName);
             * lnd.BeginOutputReadLine();
             */
        }
        catch (Exception e)
        {
            UnityEngine.Debug.Log(e);
        }
    }
Esempio n. 5
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);
    }
Esempio n. 6
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);
    }
Esempio n. 7
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);
    }