<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nirdesh Kumar Choudhary on Medium]]></title>
        <description><![CDATA[Stories by Nirdesh Kumar Choudhary on Medium]]></description>
        <link>https://medium.com/@nirdesh.kumar?source=rss-3124950e81bf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*S8l4INKUobb0_WokOnlLew.jpeg</url>
            <title>Stories by Nirdesh Kumar Choudhary on Medium</title>
            <link>https://medium.com/@nirdesh.kumar?source=rss-3124950e81bf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 00:36:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nirdesh.kumar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Computer’s role in Improving humans]]></title>
            <link>https://medium.com/@nirdesh.kumar/computers-role-in-improving-humans-2e346e92fea6?source=rss-3124950e81bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e346e92fea6</guid>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Nirdesh Kumar Choudhary]]></dc:creator>
            <pubDate>Mon, 18 May 2020 10:15:45 GMT</pubDate>
            <atom:updated>2020-05-18T10:15:45.979Z</atom:updated>
            <content:encoded><![CDATA[<p>My name is Nirdesh Kumar Choudhary and I am a Computer Science Engineer. I want to share some analysis of mine which I did during my graduation in computer science.</p><p>So this blog contains two parts, first one is regarding definition and second one is regarding deep analysis after getting past basic definition.</p><ol><li><strong>Computer programs</strong>: In my opinion computer programs are the human thinking that we verify with computer whether we are correct or not. Every time we run our program, we learn how wrong we were in our previous attempt. Computer is just a validation tool or in other ways we can also say computer program is an edge between theory and practical. The more we run our program the more we are close to correctness.</li></ol><blockquote>As M<em>ark Mention(in: the Subtle art of not giving a fuck)</em> said human opinions are always correct themseleves as we grow older our opinions finds more correct ways, So computer code is also a human mind creation so it also finds itself correcting over the course of time</blockquote><p>Note : I am not saying that a <strong>program</strong> of addition of two number will also correct itself. I am talking about the code which required visualization and then implementation(which I will mention in my second part)</p><p>2. <strong>Practical</strong> : In this part I will take a simple example of graph code as I am a great admirer of C programming language. If some of you are not comfortable in C, please let me know in the comments, I will share the the links of my Git repository in different programming language.</p><p>Now assuming that you have some background in computer science programming, I am going to discuss an example:</p><p>We have a graph with nodes and edges, I am using an adjacency list to define my graph data structure. The function give below constructs a graph ADT and returns a graph pointer.</p><pre>//define a node structure<br>typedef struct node{ <br> int vertexNumber;<br> struct node* next; <br>  }list; </pre><pre>//defined a graph structure<br>typedef struct graph{<br> int v; <br> int e;<br> list* array; <br> }graph;</pre><pre>// return a graph pointer<br>graph* arrayList(){<br>  int i,x,y; <br>  list* temp;<br>  graph* g=(graph*)malloc(sizeof(graph)); <br>  if(!g){ printf(“memory error…”);<br>  return; <br>  }<br>  //to enter node and edges<br>  scanf(“%d %d”,&amp;g-&gt;v,&amp;g-&gt;e); <br> (g-&gt;array)=(list*)malloc(sizeof(list)*g-&gt;v); <br>  for(i=0;i&lt;g-&gt;v;i++){<br>  // g-&gt;array[i]=(list*)malloc(sizeof(list));<br>  g-&gt;array[i].vertexNumber=i; g-&gt;array[i].next=NULL; }<br> <br> for(i=0;i&lt;g-&gt;e;i++){<br> scanf(“%d %d”,&amp;x,&amp;y); <br> temp=(list*)malloc(sizeof(list)); <br> temp-&gt;vertexNumber=y; <br> temp-&gt;next=g-&gt;array[x].next; <br> g-&gt;array[x].next=temp; <br> } <br> return g; <br>}</pre><p>Suggestion: I will keep this as simple as possible so that you guys can play around with it. Now we are going to write our print function for graph and I will also define my main function in this blog. Our print function takes graph pointer as an input because that makes our code more readable and flexible.</p><pre>void printGraph(graph* g){<br>  int i;<br>  for (i = 0; i &lt; g-&gt;v; i++){<br>    list *temp= g-&gt;array[i].next;<br>    printf(&quot;\n nodes of vertex %d\n head :-&gt; &quot;, i);<br>  while (temp){<br>    printf(&quot;-&gt; %d&quot;, temp-&gt;vertexNumber);<br>    temp = temp-&gt;next;<br>  }<br>  printf(&quot;\n&quot;);<br> }<br>}</pre><pre>int main(){<br>  graph* g=arrayList();<br>  printGraph(g);<br>}</pre><p>So now we are going to use a directed graph in which there are only directed edges are allowed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*PAXuncRQ_WVAPNnceMOrug.jpeg" /><figcaption>Directed graph</figcaption></figure><p>We will compile our code and give input as per the code written. So for this particular graph I will give input like this.</p><ol><li>First we will give number of vertices and number of edges</li><li>After this, in new line we would give (x,y) i.e, edges from x to y</li></ol><p>I hope you compiled the code correctly and when cursor waits, give the input like below.</p><pre>6 7   // number of vertex and edges<br>0 1   // there is a edge between 0 and 1(direction is from 0 to 1)<br>1 2<br>1 4<br>2 3<br>3 0<br>3 4<br>4 5<br></pre><p>Now after compiling we would see output like this..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*4gbXolR0PPZcq7nWpBiJrg.png" /><figcaption>Input and Output for the graph</figcaption></figure><p>So now we come to the discussion that we were having in our first part. As you see in the graph image, there is an edge from 0 to 1,1 to 2 and 1 to 4. So generally, people when they start coding, think that there is a edge from 1 to 2 then 1 to 4 and why not an edge from 1 to 4 and then 1 to 2.</p><p>Now here is the point, although the way we write our code is correct and it works fine but somehow we get a feeling that the node 4 should be traverse before node 2. If in our use case we need to traverse right node before the left node, And we get to know about this only after compiling and runnig our code. That’s why most people suggest first write code on a notebook, because you stay close what you want to build(you visualize it). Surely you have to made some changes but those changes you can get from your machine.</p><p>Note: <em>Graph theory is a very interesting topic in computer science, I give the example of graph because I think it’s suited for my analogy. You may choose your own favourite topic to understand this.</em></p><p>So our thinking about the code will change and we will come one step closer to how our system perceives the code. So in this process we are improving our visualization and thinking through the system. Hence all the logic we have written earlier just to understand and clarify that how people are getting smarter day by day using these verification tools, so called Computers.</p><p>You can find the complete code over <a href="https://github.com/nirdesh27/Graph_construction-data-type/blob/master/graph4.c">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e346e92fea6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Push a Transaction with delay on EOS blockchain]]></title>
            <link>https://medium.com/coinmonks/push-a-transaction-with-delay-on-eos-blockchain-11be0d0cffb5?source=rss-3124950e81bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/11be0d0cffb5</guid>
            <category><![CDATA[eos]]></category>
            <category><![CDATA[transactions]]></category>
            <dc:creator><![CDATA[Nirdesh Kumar Choudhary]]></dc:creator>
            <pubDate>Tue, 16 Oct 2018 05:07:31 GMT</pubDate>
            <atom:updated>2020-08-31T14:46:06.514Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*hZNGgHai8726Smi6UTBK2A.jpeg" /><figcaption>source : eosio</figcaption></figure><p>Blockchain technology have a concept of transactions to store the data and make it immutable. EOS also transacts the data on blockchain but there are two types of transactions in EOS, Inline and transaction with delay. Inline transactions are those which get executed when you push them into blockchain and producers verify them whereas transactions with delay can be scheduled to get executed after a particular delay after which producers verify it and add them in the block.</p><p>In this article, we are gonna learn how to create a transaction with delay on EOS blockchain.</p><h4>Smart contract</h4><p>We will write a smart contract which contains a table to store the account holder name and summation of given numbers, our focus here is not to write complex actions so I choose simple addition action so that we can focus more on the transaction.</p><p>I am assuming that you know about the concept of public and private keys, Refer <a href="https://www.blockchain-council.org/blockchain/how-does-blockchain-use-public-key-cryptography/">here</a> and <a href="https://eosio.stackexchange.com/questions/1511/what-is-the-difference-between-wallets-and-accounts-in-eos/1513">here</a> if you don’t know.</p><p>In this contract, we have two actions one is <strong>transfertxn</strong> that calls the main <strong>addition</strong> function after a given delay. Our addition action looks like:</p><pre>//this action add two number a and b, save the sum in a table ttabs<br>//@param user account_name of person who sets the contract<br>//@param memo sender_id of transaction which will not be greater than 14 chars <br>//@param delay number of seconds by which you want to delay you transaction<br>//@param a integer number<br>//@param b integer number</pre><pre>void addition(account_name user,std::string memo,uint64_t a  , uint64_t b)<br>  {<br>    _table ttabs(_self,_self);<br>    uint64_t sum = a+b;<br>    auto iter=ttabs.find(user);<br>    if(iter==ttabs.end()){<br>    print(&quot;now the sum is inserted _________________\t&quot;); <br>    ttabs.emplace(_self,[&amp;](auto&amp; sumtable){<br>          sumtable.account = user;<br>          sumtable.additionsum = sum;<br>            });<br>    }<br>    else<br>    {  ttabs.erase(iter);<br>       print(&quot;\n&quot;);<br>     }<br>  }</pre><p>Now, we need to create a table structure to store the data. Table structure looks like:</p><pre>//this is a table structure that have two fields ,account and additionsum</pre><pre>struct sumtable<br>  {<br>     account_name account;<br>     uint64_t additionsum;<br>     uint64_t primary_key() const {return account;}</pre><pre>     EOSLIB_SERIALIZE(sumtable,(account)(additionsum))<br>   };</pre><p>Above table stores account and the addition of two numbers with primary key `account`. Now our <strong>transfertxn</strong> action looks like:</p><pre>//transfertxn executes the transaction after the given delay<br>//@param from account_name of the person who set the contract //@param a integer number<br>//@param b integer number<br>//@param memo string sender_id what will you in future to cancel the transaction before given delay time<br>//@param delay, number of seconds(integer)</pre><pre>void transfertxn(account_name from, uint64_t a, uint64_t b ,string memo, uint64_t delay)<br>    {   <br>        eosio::transaction txn{};<br>        txn.actions.emplace_back(<br>            eosio::permission_level(from, N(active)),<br>            N(testaccount),<br>            N(addition),<br>            std::make_tuple(from,memo,delay,a,b));<br>        txn.delay_sec = delay;<br>        txn.send(eosio::string_to_name(memo.c_str()), from);<br>        print(&quot;the transfertxn has been executed ___________\n&quot;);<br>    }</pre><p>So let’s understand the transfertxn action.</p><h4>Transaction struct</h4><p>Now, we need to make a <strong>txn</strong> object of <strong>transaction</strong> which is defined in eosiolib/transaction.hpp. In this object, we add the action with appropriate parameters and set the delay as you can see in the above code. Now, let&#39;s understand the action parameter one by one.</p><ol><li>eosio::permission_level(from, N(active)): we set the permission of the account through which you want to push this transaction. Here it is `<em>from`</em></li><li>N(testaccount): the account which was used to deploy the contract</li><li>N(addition): action to be called</li><li>std::make_tuple(from,memo,delay,a,b)): passing arguments to addition action</li></ol><p>Finally, our <strong>tbsample.cpp</strong> file looks like:</p><pre>#include &lt;eosiolib/eosio.hpp&gt;<br>#include &lt;eosiolib/print.hpp&gt;<br>#include &lt;eosiolib/transaction.hpp<br>#include &lt;eosiolib/print.hpp<br>#include &lt;string&gt;</pre><pre>using namespace std;<br>using namespace eosio;</pre><pre>class benjamin: public eosio::contract<br>{<br>public:<br>  using contract::contract;<br> /// @abi table sumtable i64<br>struct sumtable<br>{<br>  account_name account;<br>  uint64_t additionsum;<br>  uint64_t primary_key() const { return account;<br>  }<br>  EOSLIB_SERIALIZE(sumtable, (account)(additionsum))<br>};</pre><pre>typedef multi_index&lt;N(sumtable), sumtable&gt; _table;</pre><pre>/// @abi action<br>void addition(account_name user, std::string memo, uint64_t delay, uint64_t a, uint64_t b)<br>{<br>   _table ttabs(_self, _self);<br>    uint64_t sum = a + b;<br>    auto iter = ttabs.find(user);<br>    if (iter == ttabs.end())<br>     {<br>       print(&quot;now the sum is inserted _________\t&quot;);                                           ttabs.emplace(_self, [&amp;](auto &amp;sumtable) {<br>      sumtable.account = user;<br>      sumtable.additionsum = sum;<br>});<br>}else<br> {<br>    ttabs.erase(iter);<br>    print(&quot;\n&quot;);<br> }<br>}</pre><pre>/// @abi action<br>void transfertxn(account_name from, uint64_t a, uint64_t b, string memo, uint64_t delay)<br>{<br>    eosio::transaction txn{};<br>    txn.actions.emplace_back(<br>      eosio::permission_level(from, N(active)),<br>      N(testaccount),<br>      N(addition),<br>    std::make_tuple(from, memo, delay, a, b));<br>    txn.delay_sec = delay;<br>    txn.send(eosio::string_to_name(memo.c_str()), from);</pre><pre>    print(&quot;the transaction has been executed _________________\n&quot;);</pre><pre>}<br>};<br>EOSIO_ABI(benjamin, (addition)(transfertxn))</pre><p>You can declare your actions in a separate .hpp file (header file) too. Now, let&#39;s deploy and test it.</p><p>First, run the nodeos, below is the command to start nodeos</p><pre># nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin contracts-console</pre><p>Now, compile the wast and abi file for this contract.</p><pre># eosiocpp -o tbsample.wast tbsample.cpp<br># eosiocpp -g tbsample.abi tbsample.cpp</pre><p>Set the contract with account_name testaccount(my account name), before setting our contract our wallet must be unlocked. So let’s set the contract.</p><pre># cleos set contract testaccount  tbsample ./tbsample/tbsample.wast ./tbsample/tbsample.abi</pre><p>After setting the contract now it’s time to push our action to the blockchain nodes. For testing, I am passing a delay of 20 seconds.</p><pre># cleos push action testaccount transfertxn &#39;[&quot;testaccount&quot;,10,20,&quot;himessage&quot;,20]&#39; -p testaccount</pre><p>After execution of this command, you get a message similar to this.</p><pre>executed transaction: 44203ea245cc95ffdb74e96643588b93c4df9b2a3ac08e222e5d38edb85d01df  184 bytes  1553 us<br>#   testaccount &lt;= testaccount::transfertxn     {&quot;from&quot;:&quot;testaccount&quot;,&quot;a&quot;:10,&quot;b&quot;:20,&quot;memo&quot;:&quot;himessage&quot;,&quot;delay&quot;:20}<br>&gt;&gt; the transfer has been executed ____________________________________________________<br>warning: transaction executed locally, but may not be confirmed by the network yet</pre><p>Ignore the warnings if any, Now let’s come back to our contract, So we have pushed our action into the local blockchain, If you go to your nodeos terminal you can see your transaction running like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0BhhQKNPyY4bmAmzp2Lj0g.png" /></figure><p>As we give the delay of 20 seconds in the transfertxn action, So after 20 seconds we added the two numbers and put them into the table. So after 20 seconds, your <strong><em>addition action</em></strong> will trigger and our nodeos window looks like this if works as intended.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pZg7H7yZfFzM45S-S1ML_Q.png" /></figure><p>To get the table data,</p><pre># cleos get table testaccount testaccount sumtable</pre><p>So this is how transactions work. We also have a feature to cancel a transaction with delay, Refer this <a href="https://eosio.stackexchange.com/questions/1800/how-can-i-cancel-the-deferred-transaction-in-eos-after-we-push-the-deferred-tran">URL</a> for details.</p><p>If you run into any issues getting the application working, feel free to leave a comment or raise an issue on this <a href="https://github.com/nirdesh27/Sample_EOS_code">repository</a>. You can get the <strong>complete code</strong> <a href="https://github.com/nirdesh27/Sample_EOS_code">here</a>.</p><p>Resources and references</p><ol><li>EOS <a href="https://developers.eos.io/">developers</a></li><li>EOS <a href="https://eosio.stackexchange.com/questions/">Stack Exchange</a></li></ol><p><strong>The Original article was published </strong><a href="https://www.innoplexus.com/blog/push-a-transaction-with-delay-on-eos-blockchain/"><strong>here</strong></a><strong>. All rights reserved by Innoplexus AG.</strong></p><blockquote><a href="https://coincodecap.com/?utm_source=coinmonks">Get Best Software Deals Directly In Your Inbox</a></blockquote><figure><a href="https://coincodecap.com/?utm_source=coinmonks"><img alt="" src="https://cdn-images-1.medium.com/max/584/0*OJ-qb5G6i863msBB.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11be0d0cffb5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/push-a-transaction-with-delay-on-eos-blockchain-11be0d0cffb5">Push a Transaction with delay on EOS blockchain</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>