Exemplo n.º 1
0
        //根据公钥地址创建已定义用户
        static KeyPair CreateAccount(Account source, long nativeAmount, string EssAccountID)
        {
            var dest = KeyPair.FromAccountId(EssAccountID);

            var operation =
                new CreateAccountOperation.Builder(dest, nativeAmount)
                .SetSourceAccount(source.KeyPair)
                .Build();

            source.IncrementSequenceNumber();

            Ess.Sdk.Transaction transaction =
                new Ess.Sdk.Transaction.Builder(source)
                .AddOperation(operation)
                .Build();

            transaction.Sign(source.KeyPair);

            var tx = transaction.ToEnvelopeXdrBase64();

            var response = PostResult(tx);

            Console.WriteLine("response:" + response.ReasonPhrase);
            Console.WriteLine(dest.Address);
            //    Console.WriteLine(dest.Seed);
            //  Console.WriteLine();

            return(dest);
        }
Exemplo n.º 2
0
        static void Payment(KeyPair from, KeyPair to, long amount)
        {
            Account source = new Account(from, GetSequence(from.Address));

            // load asset
            Asset asset = new Asset();

            var operation =
                new PaymentOperation.Builder(to, asset, amount)
                .SetSourceAccount(from)
                .Build();

            source.IncrementSequenceNumber();

            Ess.Sdk.Transaction transaction =
                new Ess.Sdk.Transaction.Builder(source)
                .AddOperation(operation)
                .Build();

            transaction.Sign(source.KeyPair);

            var tx = transaction.ToEnvelopeXdrBase64();

            var response = PostResult(tx);

            Console.WriteLine(response.ReasonPhrase);
        }