コード例 #1
0
        public void TestDataTransaction()
        {
            var node = new Node();

            var data = new DictionaryObject
            {
                { "test long", -1001L },
                { "test true", true },
                { "test false", false },
                { "test bytes", new byte[] { 1, 2, 3, 4, 5 } },
                { "test string", "Hello, Waves!" },
                { "test russian", "Привет" }
            };

            var tx = new DataTransaction(Accounts.Alice.PublicKey, data).Sign(Accounts.Alice);

            Console.WriteLine("Tx size: " + tx.GetBody().Length);
            Console.WriteLine("Response tx id: " + node.Broadcast(tx.GetJsonWithSignature()));

            var addressData = node.GetAddressData(Accounts.Alice.Address);

            Assert.AreEqual(-1001L, addressData["test long"]);
            Assert.AreEqual(true, addressData["test true"]);
            Assert.AreEqual(false, addressData["test false"]);
            Assert.AreEqual("Hello, Waves!", addressData["test string"]);
            Assert.AreEqual("Привет", addressData["test russian"]);
            CollectionAssert.AreEquivalent(new byte[] { 1, 2, 3, 4, 5 }, (byte[])addressData["test bytes"]);
        }
コード例 #2
0
        public void SendData()
        {
            var data = new DictionaryObject
            {
                { "Laba", 1L },
                { "Check", true },
                { "Work", new byte[] { 1, 2, 3, 4, 5 } },
                { "Name", "Roman" }
            };

            var tx = new DataTransaction(node.ChainId, Account.PublicKey, data).Sign(Account);

            node.BroadcastAndWait(tx.GetJsonWithSignature());
            var addressData = node.GetAddressData(Account.Address);

            MessageBox.Show($"Laba: {addressData["Laba"]} \nCheck: {addressData["Check"]}\nWork: {addressData["Work"]}\nName: {addressData["Name"]}");
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var node = new Node();

            var data = new DictionaryObject
            {
                { "test string", "Hello, 0bsNetwork!" }
            };

            PrivateKeyAccount Alice = PrivateKeyAccount.CreateFromSeed("test", AddressEncoding.TestNet);

            var tx = new DataTransaction(node.ChainId, Alice.PublicKey, data).Sign(Alice);

            Console.WriteLine("Tx size: " + tx.GetBody().Length);
            Console.WriteLine("Response tx id: " + node.BroadcastAndWait(tx.GetJsonWithSignature()));

            Console.ReadLine();
        }
コード例 #4
0
        public void TestWavesSpendingUserAccountScript()
        {
            var node = new Node();



            var tokenomicaSeed    = "aim property attract warfare stamp sample holiday input invest rather potato novel produce car arctic"; //3N6GrCERRyWw9k9siP9iPbqNV9q86jnbrYY
            var tokenomicaAccount = PrivateKeyAccount.CreateFromSeed(tokenomicaSeed, AddressEncoding.TestNet);

            var data = new DictionaryObject
            {
                { "limit", 200000001L }
            };

            var dataTx = new DataTransaction(userAccount.PublicKey, data, 0.005m).Sign(tokenomicaAccount);

            node.Broadcast(dataTx.GetJsonWithSignature());

            var wavesTransferTx = new TransferTransaction(userAccount.PublicKey, Alice.Address, Assets.WAVES, 0.01m, 0.005m).Sign(userAccount);

            wavesTransferTx.Version = 2;
            node.Broadcast(wavesTransferTx.GetJsonWithSignature());
        }