Example #1
0
        public string[] GenerateWallet(Guid password)
        {
            var mnemo = new Mnemonic(Wordlist.English, WordCount.Twelve);

            Wallet = new Wallet(string.Join(' ', mnemo.Words), password.ToString());
            return(mnemo.Words);
        }
Example #2
0
    // Use this for initialization
    void Start()
    {
        if (Instance != null)
        {
            UnityEngine.Debug.LogError("EthKeyManager is already set. Additional EthKeyManager dit not get started.");
            return;
        }

        LandManager = GetComponent <LandManager>();

        if (string.IsNullOrEmpty(RpcUrl))
        {
            //RpcUrl = "http://localhost:9545";
            //RpcUrl = "http://116.203.118.82:8545";
            //RpcUrl = "https://rpc.tau1.artis.network";
            RpcUrl = "http://40.71.213.163:8545";
        }

        //if (!string.IsNullOrEmpty(PreselectedPrivateKey))
        //{
        //    privateKey = PreselectedPrivateKey;
        //}



        Wallet = new Nethereum.HdWallet.Wallet(Words, Password);

        Account = Wallet.GetAccount(0);



        Debug.Log("Address: " + Account.Address);
        //Wallet.GetAccount(0);
        //todo: find out how to create Key Pair
        Web3 = new Nethereum.Web3.Web3(Account, RpcUrl);


        Web3.Eth.TransactionManager.DefaultGas      = new BigInteger(1000000);
        Web3.Eth.TransactionManager.DefaultGasPrice = new BigInteger(1000000000);
        // Account.TransactionManager.DefaultGas

        //WorldsRegistry = new Galleass3D.Contracts.WorldsRegistry.WorldsRegistryService(Web3, WorldsRegistryAddress);



        //TODO: find out how to call a async function on purpose.
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        StartBlockchainCommunication();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
    }
Example #3
0
 public string GetAddress(int index)
 {
     if (!(Wallet is null))
     {
         return(Wallet.GetAccount(index).Address);
     }
Example #4
0
 public string ExportExtendedPublicKey() => Wallet?.GetMasterExtPubKey()?.ToBytes()?.ToHex() ?? throw new NullReferenceException();
Example #5
0
 public void GenerateWallet(string[] seed, Guid password)
 {
     Wallet = new Wallet(string.Join(' ', seed), password.ToString());
 }