create account

your first application for ethereum (Dapp) by flash56

View this thread on: hive.blogpeakd.comecency.com
· @flash56 · (edited)
your first application for ethereum (Dapp)
<p><br />
A while ago i was looking to make a dapp and found a lot of information , unfortunately all the information I found was split , after much research I was finally able to create a simple Dapp , I gave up like 5 times but eventually achieved what I wanted.</p>
<h1><strong>Introduction</strong></h1>
<p>First of all just show you how to create a super- simple dapp and how to connect to a node .This is the first part of the application and will only be essentially,  later I teach you how to create the gui of dapp to interact with it, well let us begin.</p>
<h2>1.- Install node.js</h2>
<h3>windows : </h3>
<p>go to the page <a href="https://nodejs.org/en/download/" rel="noopener">https://nodejs.org/en/download/</a> , click in windows installer, then install, and that's all.  :/</p>
<h3>mac :</h3>
<p>The same as windows .</p>
<h3>Linux (ubuntu/debian):</h3>
<p>Good we got to the interesting part, ubuntu comes with node installed by default, but has a very old version and no more upgrade in its main repository, If you found the old Node package installed, run this command to completely remove it:</p>
<p><code>sudo apt-get remove --purge node</code></p>
<p>then</p>
<p><code>apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280</code><br />
<code>apt-add-repository 'deb https://deb.nodesource.com/node_4.x precise main'</code><br />
<code>apt-get update</code><br />
<code>apt-get install nodejs</code></p>
<h2>2 .- install geth (ethereum node)</h2>
<p>This step is important , you must install the node ethereum to work our Dapp ,You can find the installation steps on the official website of ethereum but anyway I'll tell you how to install it .</p>
<h3>Windows (64 bits):</h3>
<p>Just follow the link and install the program.</p>
<p><a href="https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.zip" rel="noopener">https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.zip </a></p>
<h3>Linux : </h3>
<p>There are several ways to install on Linux , can be direct  downloading or by repository.</p>
<p>Direct :<a href="https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-trusty/latest/" rel="noopener"> https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-trusty/latest/</a></p>
<p>Tutorial for PPA: <a href="https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-Ubuntu" rel="noopener">https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-Ubuntu</a></p>
<h2>MAC:</h2>
<p>Direct Link : <a href="http://build.ethdev.com/builds/OSX%20Go%20develop%20branch/Mist-OSX-latest.dmg" rel="noopener">http://build.ethdev.com/builds/OSX%20Go%20develop%20branch/Mist-OSX-latest.dmg</a></p>
<h2>3 .- Install web3.js (client Java Script)</h2>
<p>web3.js is the client with which we will make our Dapp , this library will allow us to communicate with the node ethereum.Creates a directory in your file folder where you want to go your Dapp.<br />
<br />
Put on your console this code to install the library</p>
<p><code>npm install web3</code></p>
<p><br /></p>
<h2>4.- initiating Dapp</h2>
<p>in our project folder we create a file called main.js which contain the code of our Dapp. First thing to do is call the web3.js.</p>
<p><code>var Web3 = require('web3');</code></p>
<p><br />
then the object must define and connect the node , we do as follows.</p>
<pre><code>if (typeof web3 !== 'undefined') {</code></pre>
<pre><code>  web3 = new Web3(web3.currentProvider);</code></pre>
<pre><code>} else {</code></pre>
<pre><code>  // set the provider you want from Web3.providers</code></pre>
<pre><code>  web3 = new Web3(new Web3.providers.HttpProvider(&quot;http://localhost:8545&quot;));</code></pre>
<pre><code>}</code></pre>
<p>then check if he connected correctly.</p>
<pre><code>if(!web3.isConnected()) {</code></pre>
<pre><code>console.log(&quot;connected&quot;); </code></pre>
<pre><code>} else {</code></pre>
<pre><code>console.log(&quot;not connected&quot;)</code></pre>
<pre><code>}</code></pre>
<p><br />
now we run from the console with the following command.</p>
<pre><code>node main.js</code></pre>
<p><br />
I appear not connected to us because we have not started the node ethereum.</p>
<h2>5.- starting the ethereum node</h2>
<p>Once installed geth put this code in the console.</p>
<pre><code>geth --rpc</code></pre>
<p>The node of ethereum was started and synchronized , maybe take a while synced.We run our main.js and see that tells us connected, and that's it , we have the beginning of our Dapp , you can check your balance , make transactions and more.</p>
<p><br />
To assign a address to our Dapp is with the following code.</p>
<pre><code>web3.eth.defaultAccount = &quot;YOUR_WALLET_ADDRESS&quot;;</code></pre>
<pre><code>var defaultAccount = web3.eth.defaultAccount;</code></pre>
<pre><code>console.log(defaultAccount); </code></pre>
<p><br />
I hope you liked it , excuse my bad English , and if in doubt do not hesitate to ask , leave web3.js full documentation and installation of geth . Thanks for reading me :).</p>
<p>web3.js : <a href="https://github.com/ethereum/wiki/wiki/JavaScript-API" rel="noopener">https://github.com/ethereum/wiki/wiki/JavaScript-API</a></p>
<p>geth : <a href="https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum" rel="noopener">https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum</a></p>
<p><br /></p>
<p>Dapp<br /></p>
<img src="http://media.coindesk.com/uploads/2016/02/Screen-Shot-2016-02-24-at-10.42.13-AM-e1456328600212.png">
👍  , , , , , , , , , , , , ,
properties (23)
authorflash56
permlinkyour-first-application-for-ethereum-dapp
categoryethereum
json_metadata{"tags":["ethereum","blockchain","steemit"],"links":["https://nodejs.org/en/download/","https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.zip","https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-trusty/latest/","https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-Ubuntu","http://build.ethdev.com/builds/OSX%20Go%20develop%20branch/Mist-OSX-latest.dmg","https://github.com/ethereum/wiki/wiki/JavaScript-API","https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum"],"image":["http://media.coindesk.com/uploads/2016/02/Screen-Shot-2016-02-24-at-10.42.13-AM-e1456328600212.png"]}
created2016-08-08 04:05:21
last_update2016-08-08 10:48:57
depth0
children5
last_payout2016-09-07 21:14:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,549
author_reputation1,209,657,539
root_title"your first application for ethereum (Dapp)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id676,411
net_rshares257,805,249
author_curate_reward""
vote details (14)
@herronryan ·
Great article. I am not technical and dont know anything about dapp creation. I did, however, spend a few days and went through every coin on coin market cap and compiled a list of Dapps that are in production.  https://steemit.com/cyrptocurrency/@herronryan/the-dapp-list-100-decentralized-products-available-now
properties (22)
authorherronryan
permlinkre-flash56-your-first-application-for-ethereum-dapp-20180209t193931746z
categoryethereum
json_metadata{"tags":["ethereum"],"links":["https://steemit.com/cyrptocurrency/@herronryan/the-dapp-list-100-decentralized-products-available-now"],"app":"steemit/0.1"}
created2018-02-09 19:39:30
last_update2018-02-09 19:39:30
depth1
children0
last_payout2018-02-16 19:39:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length313
author_reputation7,137,006,856
root_title"your first application for ethereum (Dapp)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id36,240,888
net_rshares0
@mikerowave ·
Wow, this is an amazingly informative article! It's inspired me to try and create my first DAPP!

Check out my latest blog post on a DAPP known as Birdchain. It's users will be able to earn a monthly passive income!

https://steemit.com/cryptocurrency/@mikerowave/birdchain-a-decentralized-app-with-a-difference
properties (22)
authormikerowave
permlinkre-flash56-your-first-application-for-ethereum-dapp-20180214t081833548z
categoryethereum
json_metadata{"tags":["ethereum"],"links":["https://steemit.com/cryptocurrency/@mikerowave/birdchain-a-decentralized-app-with-a-difference"],"app":"steemit/0.1"}
created2018-02-14 08:18:36
last_update2018-02-14 08:18:36
depth1
children1
last_payout2018-02-21 08:18:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length311
author_reputation15,412,904,944
root_title"your first application for ethereum (Dapp)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id37,422,384
net_rshares0
@dapp.com ·
Hi Mike - You're more than welcome to submit your dapp to Dapp.com!
properties (22)
authordapp.com
permlinkre-mikerowave-re-flash56-your-first-application-for-ethereum-dapp-20180708t140026851z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-07-08 14:00:27
last_update2018-07-08 14:00:27
depth2
children0
last_payout2018-07-15 14:00:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length67
author_reputation16,570,092,032,103
root_title"your first application for ethereum (Dapp)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id63,901,313
net_rshares0
@oalover ·
Thx
properties (22)
authoroalover
permlinkre-flash56-your-first-application-for-ethereum-dapp-20170706t012919470z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-07-06 01:29:18
last_update2017-07-06 01:29:18
depth1
children0
last_payout2017-07-13 01:29:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3
author_reputation190,621,406,228
root_title"your first application for ethereum (Dapp)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id7,462,713
net_rshares0
@rekursia ·
check my dapp here:
https://steemit.com/@rekursia
properties (22)
authorrekursia
permlinkre-flash56-your-first-application-for-ethereum-dapp-20171129t083525239z
categoryethereum
json_metadata{"tags":["ethereum"],"links":["https://steemit.com/@rekursia"],"app":"steemit/0.1"}
created2017-11-29 08:35:21
last_update2017-11-29 08:35:21
depth1
children0
last_payout2017-12-06 08:35:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length49
author_reputation140,191,788
root_title"your first application for ethereum (Dapp)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id21,864,203
net_rshares0