steem-js icon indicating copy to clipboard operation
steem-js copied to clipboard

Error "AssertionError: Expected version 128, instead got 149" - What does it mean? Cannot make any posts...

Open osirisr opened this issue 7 years ago • 7 comments

Expected behavior

A successful API call - in this case, posting an article to STEEM.

Actual behavior

Get the following error code. No idea what it means since its not documented anywhere -_-

AssertionError: Expected version 128, instead got 149

How to reproduce

Run the following JS code:

<html>
<head><title>steem-js posting example</title>
<script src="//cdn.steemjs.com/lib/latest/steem.min.js"></script>
</head>
<body>

<script language="JavaScript">
var params = {};
params.postingKey = '...';
params.username   = '...';
params.title      = 'test';
params.article    = 'just a test';
params.permalink  = 'test435fdfs';

steem.api.setOptions({ url: 'https://api.steemit.com'});

function postArticle() {

  steem.broadcast.comment(
    params.postingKey, // posting wif
    '', // author, leave blank for new post
    '', // first tag
    params.username, // username
    params.permalink, // permlink
    params.title, // Title
    params.article , // Body of post
    // json metadata (additional tags, app name, etc)
    { tags: ['test'], app: 'steemit/1' }, // Json Metadata
    function (err, result) {
      if (err)
        alert('Failure! ' + err);
      else
        alert('Success!');
    }
  );
}

postArticle();
</script>

</body>


</html>

It looks like the steem.min.js file is too new or old for the "https://api.steemit.com" endpoint?

osirisr avatar Jan 16 '18 02:01 osirisr

Facing same issue any solutions

sriharsha1235 avatar Jan 20 '18 15:01 sriharsha1235

Sounds like an invalid private key, make sure you're not passing your public key

jnordberg avatar Jan 24 '18 00:01 jnordberg

Solution - I was using the wrong key. You should use the posting key for this kind of method. Posting keys typically start with STM. - Too bad this API has poor documentation and vague error messages.

osirisr avatar Feb 02 '18 02:02 osirisr

@osirisr what is posting key? how do you get it?

sudguru avatar Feb 04 '18 18:02 sudguru

I have same issue. What is public key? Is it different to the key is given when I sign up Steem?

soorichu avatar Mar 21 '18 13:03 soorichu

Hi @soorichu. When you sign up on steem, as password you pass in Seed for random number generator. With this seed you can always generate all your private keys. (The first 4 random number generator results are your private keys). With your private keys you generate all public keys and during registration process you pass to the STEEM blockchain this 4 public keys, which are some kind of your fingerprints.

If you want you may generate all your private keys without this seeding method, however in this case you will have to remember all 4 private keys instead of 1 password. In that case you won't have anything like "steem password".

bartosz546 avatar Mar 21 '18 13:03 bartosz546

Quite annoying that this is not documented. Solution is to use private posting key.

nickberns avatar Dec 15 '18 04:12 nickberns