Blockchain Basics

Blockchain Dec 1, 2021

This post will describe you how you get a local blockchain up and running for your personal use.

The Requirement

In my last devnight, I've got my focus on programming with blockchain. But for this, you must understand this technology. Sure I can use the Etherum Network but there I mus buy space for it and now developer has enought money for this šŸ˜‰. I figured out that we can create som local test networks. For my local environment I use neo (opens new window). It's Quick and simple created.

The target of this post is, to define how to create a local development env and I will show you how to transfer some Neo-Coins from one wallet to another.

What is Neo?

"Neo is an open-source community driven blockchain platform"

Neo is also a good choice for developers. It enables them to digitalize, automate the management of assets. It will also support smart contracts.

It also provides powerful native infrastructures such as decentralized storage, oracles, and domain name service, creating a solid foundation for the Next-Gen Internet.

I choose neo also, because you can create and debug a smart contracs in .net. That is a nice to have, for a developer itself. This (smartcontract) will be part of another article.

The Setup

At first, you must create a private Network four your local development. You can to this with the following command:

neoxp.exe create

This will create a ONE-Node blockchain. Of course, you can create more notes with the --count Option, but for now we can work with one node.

If you want to start a block generation you can do whit with the following command

neoxp.exe run --seconds-per-block 1

This will generate one block per second.

Create a wallet

Now while the blockchain continues running, we will create a own wallet.

neoxp.exe wallet create devwallet

After the execution you will get an ID for the wallet that you had created

Transfer Money (neo) to your wallet

Now we transfer some Amount to your wallet

neoxp.exe transfer 100000000 neo genesis devwallet

This will transfert 100.000.000 neo from the genesis account to you devwallet.

Never trust a bank šŸ˜‰, so we check the balance again with

neoxp.exe show balances devwallet

What is with the gas?

For example, you will transfer some all of your amount to another wallet (for our example to your own wallet). To do this you must execute the following command:

neoxp.exe transfer 100000000 neo devwallet devwallet

After that you will get the Error

Insufficient GAS

This is because, that every trasnaction has a fee. This fee will be payed with GAS. So beside your amount in your wallet, you must add some GAS to execute transactions or later execute smart contracts.

So add some gas for now with:

neoxp.exe transfer 100 gas genesis devwallet   

After checking this, you will get now this information

You will notice the separate entry GAS beside your NEO Entry. Now you have some GAS that allows you to proceed the transaction.

If you want to transfer it now:

It will suceeded. After this, you will notice the change of your GAS value. Because you have paid your fee to allow the execution of this transaction. The amount of GAS value will be set by the network itself. So there are no general rule of thumb to tell, how many GAS a transaciton will cost.

Conclusion

So you see that the setup and the use is very simple. I will go further for now, especially into the smart contracts. Leave me a comment if you have any suggestions or when you see some errors.

Tags