January 21, 2026

Capitalizations Index – B ∞/21M

When Bob Met Alice –

When Bob Met Alice –

Within a blockchain infrastructure, we must create a genesis record, and which defines the starting point of the blockchain. This will contain the initial accounts that own cryptocurrency. Initially we can create an Ethereum blockchain using Geth with [Linux version]:

C:Program FilesGeth> geth --datadir=d:eth6 init customg.json
INFO [06-26|21:42:43] Allocated cache and file handles database=d:eth6
gethchaindata cache=16 handles=16
INFO [06-26|21:42:43] Writing custom genesis block
INFO [06-26|21:42:43] Successfully wrote genesis state database=chaindat
a hash=10367b.67437b
INFO [06-26|21:42:43] Allocated cache and file handles database=d:eth6
gethlightchaindata cache=16 handles=16
Fatal: Failed to write genesis block: database already contains an incompatible
genesis block (have 0c5f429f24f7078a, new 10367b56f68be716)

The genesis block is created with:

,
"difficulty": "200000000",
"gasLimit": "0x3d0900",
"alloc": ,
"cdfc92d1b5dd1c9ee1c9e2368abc86a193ae35a5": ,
"c9c425ae15a0e66500ecf5b7a1c10c6ed35600b9":
    }
}

In this case we have given the account “0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9” a balance of 0x400000000000000. Next we will start Geth:

C:Program FilesGeth>geth --datadir=d:eth6
INFO [06-26|21:42:53] Starting peer-to-peer node instance=Geth/v1.
6.6-stable-10a45cb5/windows-amd64/go1.8.3
INFO [06-26|21:42:53] Allocated cache and file handles database=d:eth6
gethchaindata cache=128 handles=1024
WARN [06-26|21:42:53] Upgrading chain database to use sequential keys
INFO [06-26|21:42:53] Database conversion successful
INFO [06-26|21:42:53] Initialised chain configuration config=""
INFO [06-26|21:42:53] Disk storage enabled for ethash caches dir=d:eth6get
hethash count=3
INFO [06-26|21:42:53] Disk storage enabled for ethash DAGs dir=C:UsersAd
ministratorAppDataEthash count=2
WARN [06-26|21:42:53] Upgrading db log bloom bins
INFO [06-26|21:42:53] Bloom-bin upgrade completed elapsed=10.000ms
INFO [06-26|21:42:53] Initialising Ethereum protocol versions="[63 62]
" network=1
INFO [06-26|21:42:53] Loaded most recent local header number=0 hash=103
67b.67437b td=200000000
INFO [06-26|21:42:53] Loaded most recent local full block number=0 hash=103
67b.67437b td=200000000
INFO [06-26|21:42:53] Loaded most recent local fast block number=0 hash=103
67b.67437b td=200000000
INFO [06-26|21:42:53] Starting P2P networking

Next we will connect to the Geth from another terminal and create a new account (and which has a public and a private key):

C:Program FilesGeth>geth attach
Welcome to the Geth JavaScript console!
instance: Geth/v1.6.6-stable-10a45cb5/windows-amd64/go1.8.3
coinbase: 0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9
at block: 0 (Thu, 01 Jan 1970 00:00:00 GMT)
datadir: d:eth6
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txp
ool:1.0 web3:1.0
> personal.newAccount("Qwerty")
"0xce1373ddfa2232dc9ca82d98420be7a2e11962b5"
> web3.eth.accounts
["0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9", "0xbb4fcfac2efd3dbc35117dc979ce5c
43ca5c615b", "0xce1373ddfa2232dc9ca82d98420be7a2e11962b5"]

We can then look at the initial balances in the accounts:

> eth.getBalance("0xce1373ddfa2232dc9ca82d98420be7a2e11962b5")
0
> eth.getBalance("0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9")
288230376151711744
> personal.unlockAccount('0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9','Qwerty')
true

Next we can transfer some currency from one account to another:

> eth.sendTransaction()
"0x4029e82ac13fd2a56078c2747f2ff55b42db12c8fa40dbde8c6350b128476243"

>
> eth.getTransaction('0x4029e82ac13fd2a56078c2747f2ff55b42db12c8fa40dbde8c6350b128476243')

If we look at the balances there has not been any transfers:

> eth.getBalance("0xce1373ddfa2232dc9ca82d98420be7a2e11962b5")
0
> eth.getBalance("0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9")
288230376151711744

We can now start the miner:

> miner.start()
null
> eth.getBalance("0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9")
288230376151711744
> eth.getBalance("0xce1373ddfa2232dc9ca82d98420be7a2e11962b5")
0

We can transfer again:

> eth.sendTransaction()
"0x2e25093e25cbf511c2892cb38b45a5c9f6f9b2785774cd5830cf5bd978839165"
> eth.getBalance("0xce1373ddfa2232dc9ca82d98420be7a2e11962b5")
0
> eth.getBalance("0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9")
288230376151711744

The mining process adds some credits to the inital account:

> eth.getBalance("0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9")
5288230376151711744
> eth.getBalance("0xce1373ddfa2232dc9ca82d98420be7a2e11962b5")
0

After 30 minutes we see:

> eth.getBalance("0xce1373ddfa2232dc9ca82d98420be7a2e11962b5")
200000

If we look at the blockchain we see there are two records:

> eth.blockNumber
2

Within Geth we see:

INFO [06-26|22:26:08] Commit new mining work                   number=2 txs=2 un
cles=0 elapsed=2.000ms
INFO [06-26|22:26:55] Successfully sealed new block number=2 hash=783
ace.91c41f
INFO [06-26|22:26:55] ?? mined potential block number=2 hash=78
3ace.91c41f
INFO [06-26|22:26:55] Commit new mining work number=3 txs=0 un
cles=0 elapsed=0s

Creating a contract

Now let’s create a contract. We do this by using the Solidity compiler (in order to create the trusted code that will run on the blockchain):

pragma solidity ^0.4.0;
contract test2
function val() returns(uint)
}
contract test3 is test2
}

We now open up [here] and paste our code.

Now we copy from Web Deploy and place in a JavaScript file, and then load it:

>loadScript(‘sayhello2.js’)

and next define the account to run the script:

> web3.eth.defaultAccount = '0x821eacc2a570c1aeb9b5aa64b5b915d4c1e1f3ee'

We can now start our miners:

> miner.start()
null
> null [object Object]
Contract mined! address: 0x8d487f4a719b5a1cf47c61cc83e757b8d269f877 transactionH
ash: 0xf4bb0fa6ddc1d9e1921a55d576d68acf5b715d00cd89cc7268ece3653c50de50
null [object Object]
Contract mined! address: 0xf3872dc9ced78283ad3a511e970891807dd38590 transactionH
ash: 0xab90aa5169f4ebfcbc139874208cabb29416feb3f12c296c93466d7d8090f805
null [object Object]
Contract mined! address: 0x7a74b5da4168f0a06a752301a3711c8991acaf88 transactionH
ash: 0x6ce2a63c59d124d5ecd4681a368243ba7de8aeacc735d41583f834789cba0b16

Finally we can view:

> test_sol_test2
],
payable: false,
type: "function"
}, ],
address: "0x7a74b5da4168f0a06a752301a3711c8991acaf88",
transactionHash: "0x6ce2a63c59d124d5ecd4681a368243ba7de8aeacc735d41583f834789c
ba0b16",
allEvents: function(),
val: function()
}
> test_sol_test3
],
payable: false,
type: "function"
}, ],
payable: false,
type: "function"
}],
address: "0xbd570c2f87b8af945146177377276901fd82b12d",
transactionHash: "0xc028384b4d8ea0e283c9cd3a6a747ab3efff859bb591d55f710ca20b09
665808",
allEvents: function(),
show: function(),
val: function()
}

And then test:

> test_sol_test2.val()
"0xd69b536cd4055a45e209f3274d9b9370f33c88b474c0dca294b665efa2ac5d2d"
> test_sol_test3.val()
"0x4a5fa248e8f6c2223082518106c3e784d54e4ff70793c9d4f65c9ef931cd667c"

A bit of maths

Now we will create a contract to do a bit of maths. Let’s say we want to calculate the square root of a value:

pragma solidity ^0.4.0;
contract mymath 
}
}

When we create the JavaScript for the compiled version, and we load and run we get:

> personal.unlockAccount('0xc7552f45deb093cafb47286a0bc9415845ca3735','Qwerty')
true
> loadScript('mycontract.js')
null [object Object]
true
Contract mined! address: 0xc706a04b759a32dbec85702dd3864584e737aa77 transactionH
ash: 0xece670dcb578a78dec4d2338755ecade084a517310daacf37fd46fe336341563
null [object Object]
Contract mined! address: 0xfafb5f4d0db2c545592ac9134292162b03088295 transactionH
ash: 0x46204af57db69df078e1ae637b50fa76d8415ee1c1e3bd7e1c2990f328dc85ce
null [object Object]
Contract mined! address: 0x83e0bbb8abe2f0976fde9cf5db05333de067b0df transactionH
ash: 0xabea9606989bcc1bf93513213d298c84d47c7e8e1b397eaf536ebffb793d9304
> test_sol_mymath.sqrt(9)
3
> test_sol_mymath.sqrt(12)
3
> test_sol_mymath.sqrt(81)
9

Commands used

The following outlines the commands:

personal.newAccount("Qwerty")
eth.getBalance("0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9")
eth.getBalance("0xce1373ddfa2232dc9ca82d98420be7a2e11962b5")
personal.unlockAccount('0xc9c425ae15a0e66500ecf5b7a1c10c6ed35600b9','Qwerty')
eth.sendTransaction()
eth.getTransaction('0x4029e82ac13fd2a56078c2747f2ff55b42db12c8fa40dbde8c6350b128476243')
web3.eth.accounts
miner.start()
miner.stop()
loadScript(‘sayhello2.js’)
web3.eth.defaultAccount = '0x821eacc2a570c1aeb9b5aa64b5b915d4c1e1f3ee'

Demo

Here is a tutorial using the Linux version of Geth [here].

Published at Tue, 07 May 2019 07:27:11 +0000

Previous Article

The IKU & MakerDAO collab —  WALKTHROUGH – IKU Network –

Next Article

Fidelity to Launch Institutional Bitcoin Trading Service in a Few Weeks

You might be interested in …

#Bitcoin Black Friday?

Fellow Crypto Kings and Queens, So far today the majority of the global crypto market, except of course for Ripple (hint hint), has dropped an average of 20%. This is due to many factors, including […]

How to earn bitcoins fast and easy

How to earn bitcoins fast and easy

How to earn bitcoins fast and easy Learn how to get $10 a day by mining bitcoin using Android Earn Unlimited Bitcoins APPLICATION DOWNLOAD LINK:-http://destyy.com/whLyIm