Becoming a Blockchain Developer

Sagar Duwal
Coinmonks
6 min readMar 27, 2018

--

Blockchain and Smart Contract Development

Blockchain is a digitized, decentralized, public ledger of all cryptocurrency transactions. Each nodes in the blockchain has a exact copy of the whole blockchain.

What a Blockchain developer should know?

  1. You have to have little knowledge on economics and have general idea about transactions.
  2. You should also have basics of cryptography and how it works .
  3. Know about Bitcoin, Ethereum
  4. Know how cryptography is used in cryptocurrency
  5. Understand what Smart Contracts are
  6. Get to know tools for blockchain development
  7. Smart contract development with Ethereum

Links:

Terms:

  • Address — Address are alpha numeric hashes that are used to send or receive transactions on the network.
  • Block — they are the batches of the valid transactions that happend in the network
  • Blockchain — It is a shared ledger where transactions are permanently recorded as a sequence of blocks. It contains every transactions that the network performed to validate in a long chain of blocks, so called Blockchain.
  • Block Height — The length of the blockchain or the number of blocks in the blockchain
  • Mining — act of validating blockchain transactions
  • Block Reward — The reward given to the miner who participated in the network to validate the transactions.
  • Consensus — A general agreement between the nodes or particpants in the network for the validity of the transactions, ensuring the ledgers in all the nodes are exact copy of each other.
  • Dapp — An application running on a decentralized peer-to-peer network, that operates autonomously,stores the data in the blockchain and operates on a protocol that shows proof of value.
  • DAO — Decentralized Autonomous Organizations is a form of digital organization that runs without human intervention and controlled on the business rules .
  • Distributed Network — A network where each participating nodes work together to perform tasks.
  • Difficulty — It refers to how easily a data block of transaction can be mined
  • Double Spending — a potential flaw in digital cash scheme, where a single/same digital token can be spend more than once.
  • Genesis Block — The first block in the blockchain
  • Proof of Work — the proof of how much work you have done for validating transactions in the network
  • Smart Contracts — these are the business rules encoded into the blockchain that are executed by the participants in the network
  • Wallet — A file including private keys that allows access to the blockchain that the wallet is designed

Links:

Cryptocurrency

Cryptocurrency is a medium of exchange, created and stored electronically in the blockchain, using encryption techniques to control the creation of monetary units and to verify the transfer of funds.

Links:

What is a Blockchain Developers?

Software developers that figure out how to secure an immutable distributed database.

Smart Contracts?

Smart Contracts are decentralized application or programs that run on ethereum network. They are self executing contracts with the terms of the agreement between buyer and seller being directly written into lines of code.

Tools used for Blockchain / Smart contract Development

Create a basic smart contract in Ethereum

You will start by installing required tools required for development.

You need nodejs in your system to begin with,

Now we will install truffle framework that interacts with ethereum blockchain

This will generate following files in the directory.

Edit truffle.js file that contains the configuration of the blockchain network.

Create file Counter.sol in contracts directory

Create another file 2_deploy_contracts.js in migrations directory

Now, in the parent directory

If the codes are all fine we will see no any issue.

What this does is upload the contract/s to the ethereum network through the rpc 127.0.0.1:7545

Migrations is the default contract truffle init creates. The contract Counter we created will be deployed in network as we can see above at 0x345ca3e014aaf5dca488057592ee47305d9b3e10.

Once the contracts are uploaded to the ethereum network, we will see a contract address which is what used in the future for calling the methods in the contract.

From the above example we have successfully created a simple Counter contract. This contract we have methods to get counter (getCount), increment(incrementCounter)/decrement (decrementCounter) the counter in the contract.

Now we can directly access the method in the contract directly through the truffle console being inside the project directory.

To get the accounts that are present in the network.

To get first and seconds account in the network:

To get the address of the contract that was deployed in the network

Alternatively:

../counter-contract$ truffle networks

Network: UNKNOWN (id: 5777)
Counter: 0x345ca3e014aaf5dca488057592ee47305d9b3e10
Migrations: 0x8cdaf0cd259887258bc13a92c0a6da92698644c0

or

truffle(development)> counter = Counter.address

Call the method in the contract:

Alternatively:
truffle(development)> Counter.deployed().then(function(instance){app = instance})

truffle(development)> app. <tab>
app.abi app.address app.allEvents
app.contract app.decrementCounter app.getCount
app.incrementCounter app.send app.sendTransaction
app.transactionHash

truffle(development)> app.getCount()
{ [String: ‘0’] s: 1, e: 0, c: [ 0 ] }

The get methods in the contract all have no fees however, if the method/call changes the state of the values in the contract then is requires gas ie. money.

Get Best Software Deals Directly In Your Inbox

There is another way to interact the methods in the contract through GUI with MyEtherWallet. We will continue with interacting with Blockchain network in local through MyEtherWallet in later tutorial.

--

--