<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cryptocurrency Archives : vedmant.com : coding blog</title>
	<atom:link href="https://vedmant.com/tag/cryptocurrency/feed/" rel="self" type="application/rss+xml" />
	<link>https://vedmant.com/tag/cryptocurrency/</link>
	<description>Sharing my personal experience in web development</description>
	<lastBuildDate>Mon, 11 Apr 2022 07:04:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>
	<item>
		<title>My Little Bitcoin &#8211; simple cryptocurrency implementation on JavaScript with GUI</title>
		<link>https://vedmant.com/little-bitcoin-simple-cryptocurrency-implementation-javascript-gui/</link>
					<comments>https://vedmant.com/little-bitcoin-simple-cryptocurrency-implementation-javascript-gui/#comments</comments>
		
		<dc:creator><![CDATA[vedmant]]></dc:creator>
		<pubDate>Sun, 01 Oct 2017 20:14:25 +0000</pubDate>
				<category><![CDATA[Cryptocurrency]]></category>
		<category><![CDATA[My Projects]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[Vue.js]]></category>
		<category><![CDATA[vue-router]]></category>
		<category><![CDATA[Vuex]]></category>
		<category><![CDATA[Web Sockets]]></category>
		<guid isPermaLink="false">https://vedmant.com/?p=209</guid>

					<description><![CDATA[<p>I was interested in Bitcoin and Blockchain technologies for a while and in theory things look pretty simple yet so powerful. I really admire genius of Satoshi Nakamoto or whoever invented Blockchain based Crypto Currency and eventually I decided to implement my own simple cryptocurrency to study it better, as for me the best way &#8230; <a href="https://vedmant.com/little-bitcoin-simple-cryptocurrency-implementation-javascript-gui/" class="more-link">Continue reading <span class="screen-reader-text">My Little Bitcoin &#8211; simple cryptocurrency implementation on JavaScript with GUI</span></a></p>
<p>The post <a href="https://vedmant.com/little-bitcoin-simple-cryptocurrency-implementation-javascript-gui/">My Little Bitcoin &#8211; simple cryptocurrency implementation on JavaScript with GUI</a> appeared first on <a href="https://vedmant.com">vedmant.com :: coding blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I was interested in Bitcoin and Blockchain technologies for a while and in theory things look pretty simple yet so powerful. I really admire genius of Satoshi Nakamoto or whoever invented Blockchain based Crypto Currency and eventually I decided to implement my own simple cryptocurrency to study it better, as for me the best way to learn is to do it myself.</p>



<p>And the result is <strong>My Little Bitcoin</strong> &#8211; a simple cryptocurrency implementation on JavaScript in just about 650 lines of code (without comments and client). It also includes WEB GUI written on Vue.js where you can send coins and explore blockchain.</p>



<h3 class="wp-block-heading">The structure</h3>



<p>The project is based on Node.js and has following basic structure:</p>



<ol class="wp-block-list"><li>Library &#8211; consist of functions to help handle crypto currency in a simplest way</li><li>Store &#8211; this in-memory storage for blockchain, wallets, mempool and few other things</li><li>Miner &#8211; this a worker that adds new blocks to the chain</li><li>Peers &#8211; simple peer-to-peer blockchain synchronization implementation</li><li>Server &#8211; web server that serves data for our front end GUI, includes API and web sockets</li></ol>



<h3 class="wp-block-heading">The chain</h3>



<p>The structure of the chain is the simplest possible.</p>



<p>Block structure is following:</p>


<pre class="brush: jscript; title: ; notranslate">
{
  index, // Block index
  prevHash, // Hash of the previous block
  time, // Current block timestamp
  transactions, // List of transactions, included into the block
  nonce, // Nonce, required for proof of work protocol
  hash, // Current block hash
}
</pre>



<p>Transaction structure is following:</p>


<pre class="brush: jscript; title: ; notranslate">
{
  id, // Transaction unique id
  time, // Transaction timestamp
  hash, // Transaction hash
  reward, // Boolean to mark mining reward transaction
  inputs, // List of inputs in the transaction
  outputs, // List of outputs in transaction
  address, // Transaction is limited to only one input address for simplicity
  hash, // Transaction hash
  signature, // Transaction hash signature
}
</pre>



<p>And following inputs and outputs structure:</p>


<pre class="brush: jscript; title: ; notranslate">
// Input
{
  tx, // Points to transaction of referenced output
  index, // Index of the output in the referenced transaction
  amount, // Amount of the referenced output
  address, // Address of the referenced output and also public key
  signature, // Signature, signed by private key and can be verified by included public key
}
// Output
{
  index, // Output index in current transaction
  amount, // Amount of the output
  address, // Address of the wallet (public key)
}
</pre>



<p>For demo purpose I created special mode that disables peer-to-peer module, reduces proof of work difficulty and adds one minute block timeout.</p>


<div class="carousel-slider-outer carousel-slider-outer-image-carousel carousel-slider-outer-217" style="--carousel-slider-nav-color:#f1f1f1;--carousel-slider-active-nav-color:#4caf50;--carousel-slider-arrow-size:48px;--carousel-slider-bullet-size:10px">
<div id="&#039;id-217" class="carousel-slider carousel-slider-217 arrows-visibility-always dots-visibility-never arrows-outside dots-center dots-circle owl-carousel" data-slide-type="image-carousel" data-owl-settings='{"nav":true,"dots":false,"slideBy":1,"stagePadding":0,"margin":10,"loop":true,"lazyLoad":true,"autoplay":true,"autoplayTimeout":5000,"autoplaySpeed":500,"autoplayHoverPause":false,"autoWidth":false,"responsive":{"300":{"items":1},"576":{"items":1},"768":{"items":1},"1024":{"items":1},"1280":{"items":1},"1536":{"items":1}}}'>
<div class="carousel-slider__item">
	<img class="owl-lazy" data-src="https://vedmant.com/wp-content/uploads/2017/10/1.jpg" alt=""></a></div>

<div class="carousel-slider__item">
	<img class="owl-lazy" data-src="https://vedmant.com/wp-content/uploads/2017/10/2.jpg" alt=""></a></div>

<div class="carousel-slider__item">
	<img class="owl-lazy" data-src="https://vedmant.com/wp-content/uploads/2017/10/3.jpg" alt=""></a></div>

</div><!-- .carousel-slider-217 -->
</div><!-- .carousel-slider-outer-217 -->




<p><a href="https://my-little-bitcoin.vedmant.com/" target="_blank" rel="noopener">Demo</a></p>



<p>Check sources here: <a href="https://github.com/vedmant/my-little-bitcoin" target="_blank" rel="noopener">GitHub Link</a></p>



<p>This implementation is pretty naive and suitable only for studying purpose.</p>



<p>This project is fully free to use for any purpose and licensed under MIT License.</p>
<p>The post <a href="https://vedmant.com/little-bitcoin-simple-cryptocurrency-implementation-javascript-gui/">My Little Bitcoin &#8211; simple cryptocurrency implementation on JavaScript with GUI</a> appeared first on <a href="https://vedmant.com">vedmant.com :: coding blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://vedmant.com/little-bitcoin-simple-cryptocurrency-implementation-javascript-gui/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
