Ethereum Mist | Table O Contents
Mist is the official Ethereum crypto currency operating wallet …
Note. The Flammarion Logo Badge
in the page header above is an .svg
image file set to the dimensions of 5%
width, auto
height, and zoom
. Go ahead and test the zoom-out
feature by hovering over the badge to engage the expansion of the image.
Aleth Zero
Hint. Aleth Zero is an implementation of Ethereum for developers that has been written in C++.
More to come …
Solidity
Solidity is a backend ( contract ) language eligible for conversion into the low level language of the Etherium Virtual Machine, or EVM.
The EVM compiler takes the Solidity code and converts it to a machine language format eligible to be read and executed by the EVM.
A basic contract is formed, as follows:
contract metaCoin {
// The contract logic goes here
}
; Where the term ‘metaCoin’ in camel case is simultaneously both the name of the contract and the name of the primary constructor method.
Primary Constructor Method
The Primary Constructor Method of a contract ( back end ) defines the initial state of the data storage of the contract.
Next, the progression of the contract steps leads to the secondary constructor method(s).
There is no “hoisting” in a Solidity contract.
Just follow along with the code.
Map This
The first step in expressing the Primary Constructor Method is to set a “mapping” to storage where data can be written.
For example, a key-value pair can be set up to store coin balances in number of units.
The “key” shall be the unique address of the store, and the “value” shall be the number of coins of type integer.
In Solidity code, it look-a like this …
contract metaCoin {
mapping(address => uint) balances;
}
Note. Similar to the Typescript language, Solidity requires static type checking at compile time.
No wild and wholly self-interpretation a-la pure Javascript.
The type must be expressed in the code at the point of variable initialization.
There are two benefits to a strongly typed block of Solidity code …
-
the size of the data array passed is reduced, and
-
the compiler can create even more optimized machine code for the EVM to chew on.
Functions
Functions may be placed within the Primary Constructor Method, as well.
Here, in addition to the mapping code, a function is set to look up the address of the entity responsible for sending the transaction.
The transaction is to be sent to a mining node within the Ethereum network.
Secondly, the function taps the storage of the now mapped balances, as follows:
contract metaCoin {
mapping(address => uint) balances;
function metaCoin() {
balances[msg.sender] = 10000;
}
}
; where the Primary Constructor Method ( initialization function ) is run once, and only once.
Secondary Constructor Method(s)
The Secondary Constructor Method(s) get written to the block chain under separate immutable addresses.
In this case, we are constructing a ‘sendCoin’ function as a Secondary Constructor Method.
Each and every time the back end ( contract ) is called in the future, only the Secondary Constructor Method(s) will execute as we have already initialized the contract one time previously.
And, yes … Even though we have used the name ‘metaCoin’ for both the Primary Constructor Method and the name of the back end ( contract ), we may also use the name ‘metaCoin’ a 3rd time inside the Secondary Constructor Method.
The Solidity code for the ‘sendCoin’ function look-a like this … Notice the first function is named ‘metaCoin’.
Send Coin Now
Contract for sending coin from a Sender’s account to a Receiver’s account …
contract metaCoin {
mapping(address => uint) balances;
function metaCoin() {
balances[msg.sender] = 10000;
}
function sendCoin(address receiver, uint amount) returns(bool sufficient) {
if (balances[msg.sender] < amount) return false;
balances[msg.sender] -= amount;
balances[receiver] += amount;
return true;
}
}
Fill ‘Er Up
“Fill ‘er up with Ether, please!” ~ Modern 21st Century Miner
Your friendly neighborhood Ethereum miner sits at his or her node all day waiting for an opportunity to mix a block or two.
They’ve invested computing power and they must pay for the electricity to run their own personal “coin farm”.
How do they get paid?
Are they performing a service that justifies a payment?
Answer. The parties to the contract negotiate which party, or both in like percentage, or at some other sharing arrangement …
Who gets to pay the Miner for reconciling the transaction and for writing the result of the transaction to the immutable block chain.
Any takers?
Last Subtitle
More to come …
Note. The above synopsis was derived from an article written by Charles Jensen [2].
- The Block Chain: Understanding Financial Technology by Charles Jensen. Self-published by © 2017 Charles Jensen.
Support
Please support the co-workers who aggregate the Source Links for our projects.
Patreon
Like what you see in this project? If so, then support the authors and machine-elves
who aggregate the source links and pages for our projects via Patreon.