__________     __ __     __  _______    ________
  / ____/ __ \   / // /    / / / /  _/ |  / / ____/
 / / __/ / / /  / // /_   / /_/ // / | | / / __/
/ /_/ / /_/ /  /__  __/  / __  // /  | |/ / /___
\____/\____/     /_/    /_/ /_/___/  |___/_____/

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Steem Api Help???

BY: @nosajj | CREATED: July 31, 2017, 10:52 p.m. | VOTES: 5 | PAYOUT: $0.91 | [ VOTE ]

Hey guys,

I've been working with Ditch the C# wrapper for accessing the steem Api. All of the get functions seem to be working fine, but when I try to upvote a post the API returns an error message of "Unknown Key". I have tried the private versions of both my Posting and Active Keys to no success. Google and Steemit searches haven't surfaced any answers either. Does anyone know how to solve this problem?

TAGS: [ #steemdev ] [ #steem-help ] [ #tutorial ] [ #csharp ] [ #faq ]

Replies

@minnowbooster | July 31, 2017, 10:58 p.m. | Votes: 0 | [ VOTE ]

[IMAGE: http://minnowshares.net/upgoat/?user=nosajj&receiver=nosajj&value=0.75&hash=188]
@nosajj got you a $0.75 @minnowbooster upgoat, nice! (Image: pixabay.com)

Want a boost? Click here to read more!

@jesta | July 31, 2017, 11:50 p.m. | Votes: 2 | [ VOTE ]

It sounds like the account/key combo you're using just isn't correct, or you're using an RPC API that isn't loading that account.

Got any code samples? (without the key of course)

@nosajj | Aug. 1, 2017, 10:09 a.m. | Votes: 0 | [ VOTE ]

Any help you can give is much appreciated. Here is the code, I haven't changed any of the internals of the library, and I have used Ditch you can find the link here

            userPrivateKeys = new List
            {
                Base58.GetBytes(WIF)
            };

Convert the keys into a byte array

private static byte[] Base58CheckDecode(string data)
        {
            var s = Decode(data);
            var dec = CutLastBytes(s, 4);

            //var checksum = SHA256.Instance.DoubleHash(dec);
            //for (int i = 0; i < 4; i++)
            //    Assert.IsTrue(checksum[i] == s[s.Length - 4 + i]);

            return CutFirstBytes(dec, 1);
        }

        private static byte[] Decode(string base58)
        {
            // Decode Base58 string to BigInteger 
            BigInteger intData = 0;
            for (var i = 0; i < base58.Length; i++)
            {
                var digit = Digits.IndexOf(base58[i]); //Slow
                if (digit < 0)
                    throw new FormatException($"Invalid Base58 character `{base58[i]}` at position {i}");
                intData = intData * 58 + digit;
            }

            // Encode BigInteger to byte[]
            // Leading zero bytes get encoded as leading `1` characters
            var leadingZeroCount = base58.TakeWhile(c => c == '1').Count();
            var leadingZeros = Enumerable.Repeat((byte)0, leadingZeroCount);
            var bytesWithoutLeadingZeros =
                intData.ToByteArray()
                .Reverse()// to big endian
                .SkipWhile(b => b == 0);//strip sign byte
            var result = leadingZeros.Concat(bytesWithoutLeadingZeros).ToArray();
            return result;
        }

        private static byte[] CutFirstBytes(byte[] source, int cutCount)
        {
            var rez = new byte[source.Length - cutCount];
            Array.Copy(source, cutCount, rez, 0, rez.Length);
            return rez;
        }

Using the Cryptography.ECDSA library to sign the payload

var sig = Secp256k1Manager.SignCompressedCompact(data, userPrivateKey);

RPC Call Message

{"method":"call","params":[3,"broadcast_transaction",[{"ref_block_num":34752,"ref_block_prefix":2723778811,"expiration":"2017-08-01T09:50:54","operations":[["vote",{"voter":"nosajj","author":"jerrybanfield","permlink":"90 -paths-to-profit-online","weight":10000}]],"extensions":[],"signatures":["SIGNATURE"]}]],"jsonrpc":"2.0","id":1}

The returned error message

13 N5boost16exception_detail10clone_implINS0_19error_info_injectorISt12out_of_rangeEEEE: unknown key
unknown key
@tonybot | Nov. 22, 2017, 7:40 a.m. | Votes: 0 | [ VOTE ]

Hi, I have the same error. What key do I use? Private key for posting? If so this doesn't seem to work.

@nosajj | Aug. 1, 2017, 5:28 p.m. | Votes: 0 | [ VOTE ]

Im a complete idiot, the perma link that I had used to test the operation had a space in it. Therefore when the message was signed it wouldn't match the signature expected by the blockchain. Thanks all the same, you encouraged me to take a fresh look at my code.

@chidiebereegbo | Aug. 5, 2017, 4:45 p.m. | Votes: 0 | [ VOTE ]

u can chat up @ogochukwu he's a friend of mine i bet he can also help

@nosajj | Aug. 5, 2017, 8:13 p.m. | Votes: 0 | [ VOTE ]

thanks but i sorted it

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>