Angular 4 + Truffle -- Write, compile & deploy smart contracts on Ethereum based blockchains

If you’ve been keeping up with the cryptocurrency game, odds are you’ve heard about Ethereum. Ethereum is, in short, a platform that allows you to write smart contracts to be executed on their blockchain(s).

Firstly, what is a smart contract? Vitalik explains it best, so I’ll let him do the explaining - check this out.

In short, a smart contract is a self-executing contract. You give it some terms, like Bob must transfer Alice 5 ether by December 30th, 2024. And you define rules, like Alice must use the correct password, as provided by Bob, before the deadline. Then, if you want an easier life, you program these terms and rules with a smart contract language called Solidity.

What I just described is super high level. To really achieve all this, your contract needs to be compiled into bytecode understood by the EVM (Ethereum Virtual Machine), provide an ABI (Ethereum Virtual Machine), and migrated to the proper chain network. All of this is quite tedious and time-consuming.

That’s where Truffle comes in. Truffle is an Ethereum development framework that does all the headache of compiling and migrating your contract for you.

The cool thing about Truffle is that it’s written entirely in JavaScript and makes use of Web3. Web3 is an Ethereum JavaScript API that allows you to execute ethereum based commands. For example, while connected to an Ethereum client, if you want to get the balance of a your home account, you just do:

const coinbase = web3.eth.coinbase;

Back to Truffle. Truffle also allows you to seamlessly integrate a front end for your smart contract based application, with the help of webpack.

Great, you can now user Truffle, Web3 and a front end to write your smart contract application.

But wait, this is 2017, you also want to use a modern front-end framework if you want to build a robust and scalable application.

That’s where angular4-truffle-starter-dapp comes in. It basically combines Angular 4 and Truffle.

So there you have it. Write, compile and deploy smart contracts on Ethereum-based blockchains using Angular 4 and Truffle.