Alt Text

What is a blockchain? Here’s the answer for developers:

A public blockchain is an open and autonomous distributed computer system built on incentives.

Blockchain Account

Anyone can access a blockchain through creating an account on the blockchain. An account on a blockchain consists of an address , a.k.a. a wallet address , and each address has a unique associated private key .

The private key enables you absolute control of your blockchain account, and you cannot change the private key, ever. The account owner should keep their private key secure at all times as once the private key is compromised, there is no way to lock down the account.

Distributed System and RPC

A public blockchain is a distributed computer system connected by the internet. There are multiple nodes – each node is a computer system that runs an identical program and syncs the blockchain data at all times. Usually nodes are accessible programmatically through RPC (remote procedure calls).

Consensus Protocol and Immutability

When nodes contain different data, it is settled via a consensus protocol so all data will be the same across all nodes. Individual nodes may be out-of-sync at times but eventually update themselves with the consensus. Once written with the consensus, the data is immutable.

Incentives

A blockchain is designed to be self sustainable through incentives. Why would you spend money and run a node of a blockchain? Each node operator, a.k.a. a miner, is rewarded for contributing the computing power to power the blockchain network.

Native Currency and Gas Fee

To complete the incentive system, each write transaction to the blockchain requires a gas fee, that’s partly paid to the miners–the node operators that contribute the computing power on the blockchain. This is a pay-per-use ecosystem. You pay for the computer power you used with a gas fee . In most cases, read transactions are free. The gas fee and the miner reward usually uses the native currency on the blockchain. For example, the native currency on Ethereum is Ether (Ticker: ETH), and the native currency for Bitcoin is BTC.

Network and Faucet

Most blockchains have a production version usually referred to as the Main Net , while there are test networks where you can use as blockchain playgrounds. E.g. rinkeby is an Ethereum testnet, and regtest is a testnet for Bitcoin. On testnets, you can get FREE native currencies–“test money”–through a faucet. Here is the URL for the rinkeby faucet: https://faucet.rinkeby.io/


The best way to learn anything is through a hands-on exercise.

To get access to the Ethereum rinkeby testnet, instead of spinning or connecting to a node and use web3 or RPC to create an account (a.k.a. create a wallet address), you can simply call the APIS via a curl call :

curl 'https://api.dev.theapis.io/api/v1/wallets' \
-H 'content-type: application/json;charset=UTF-8' \
--data-binary '{"chain":"ethereum","network":"rinkeby"}'

You can see the wallet address on an explorer, just search for the wallet address returned by the APIS

Try this curl call to create a Bitcoin regtest testnet wallet address:

curl 'https://api.dev.theapis.io/api/v1/wallets' \
-H 'content-type: application/json;charset=UTF-8' \
--data-binary '{"chain":"bitcoin","network":"testnet"}'

You can search the newly created wallet address on the explorer here.

You can also try to run these calls on the APIS developer site by checking out the Create wallet end point. Check out the full documentation here

See the banner image for a screenshot.

To learn more about how you can build on top of any blockchain using the APIS project, please check out the developer site, or PM me on Twitter

This post is also available on DEV.