RE: Steemit API Question

You are viewing a single comment's thread from:

Steemit API Question

in steemdev •  6 years ago 

I created a repo for u to test this out https://github.com/superoo7/steem-stream-example

import { Client } from "dsteem";
const client = new Client("https://api.steemit.com");

const stream = client.blockchain.getBlockStream();

stream.on("data", operation => {
  console.log(operation);
});

It's streaming straight from the blockchain

source: https://developers.steem.io/tutorials-javascript/stream_blockchain_transactions

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Nice, but I'm trying to do it in javascript. And I don't want Immutable blocks. I want Latest blocks.

<script src="https://unpkg.com/dsteem@^0.10.0/dist/dsteem.js"></script>

let client = new dsteem.Client('https://api.steemit.com')

var stream = client.blockchain.getOperationsStream()

stream.on('data', (operation) => filter(operation))

The blocks that this script retrieves are 20 blocks late. (immutable)

Actually could you tell me how to run this?
I'm a super noob when it comes to GitHub.