How to use and write code running blockchains (Etherium ECS cluster based on AWS Blockchain Templates)
- DAOs (Decentralized Autonomous Organizations)
- First there was GitHub & Bitcoin
- Blockchain and peer-to-peer Web3
- Blockchain Platforms
- Asset Ownership transactions
- Smart contracts
- NFT projects
- DApp platforms
- MainNet and TestNet
- Etherium Solidity programming
- CI/CD TestNet
- DWeb DNSLink
- Ethereum blockchain dev
- AWS Blockchain Templates for Ethereum
- FoxyProxy standard browser extension
- Hyperledger Fabric
- Internet Computer via DFINITY’s dfx to ic0.app
NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.
DAOs (Decentralized Autonomous Organizations)
[channel] VIDEO: “The way the world is going to work in the future” “A DAO is like a Faceboook group, but has a budget and people can propose and vote” – Adam Levi, former CEO DAOStack.
DeFi (Decentralized Finance) DApps from protocols such as:
“Working together to make a difference” is the tagline. That can be the same as any other collaboration app. But this open source project aims to provide a platform to eventually create businesses that work autonomously – one with no employees, no bosses, and nonstop production: preprogrammed rules determines how the company operates, and computers do the rest. It’s not yet a fleet of autonomous taxis running itself 24-7, including driving to the repair shop for maintenance, without any human involvement.
“Common is a platform for distributed, democratic, and transparent social action”
Alchemy’s DXdao MultiCall plugin allows the DAO to interact with any ethereum contract. This creates governance proposal opportunities: liquidity provision, trading on AMMs, voting in other DAOs, etc.
Each DApp makes use of several architectural components of DAOstack peer-to-peer decision-making modules:
The DApp is “powered” by blockchain-backed smart contracts layer, based on reliable crypto-economic incentives and decentralized governance protocols.
From the bottom, the Etherum blockchain is used to build Infra, a smart contract library (written in Solidity language) to provide Voting Machines which follows predefined rules for decision-making. In addition to a simple absolute majority vote, DAOstack has a sophisticated Genesis protocol to reach “holographic concensus” without requiring a high participation rate by the whole group. This works by adding a market for GEN Predictive Network (a crypto-economic game using ERC-20 tokens) to each DAO so that any individual who confidently believes a particular proposal will pass can “boost” consideration of a proposal by purchasing a large prediction stake to pass by a “relative” majority. This influences the DAO’s collective attention. DAO members and outsiders can obtain a GEN reward for offering a DAO their expert attention, to help the DAO can focus on the highest-leverage proposals and make smarter collective decisions.
Solidity (using Remix IDE)
NOTE: The current price of GEN tokens in USD by the top exchanges for trading in DAOstack: CoinTiger, AEX, Uniswap (V2), Hotbit, and CoinEx.
“In the same way that ether is gas for the collective attention of computers, the GEN token is gas for the collective attention of human beings.” - Matan Field, DAOstack Architect
Also included is a voting rights management system to distribute voting rights – “balances” that represent the voting power each participant holds. Currently, DAOs on DAOstack use “reputation”-based voting rights. Reputation is a number tracked for each user that can be increased / decreased via proposals or other mechanisms.
DAOstack’s subgraph: querying DAO data.
Examples of successful DApps with millions of dollars in market capitalization and active users:
- Augur (REP) prediction market platform
- Golem (GNT) market for idle computer power
- Basic Attention Token (BAT) blockchain-based digital advertising platform
First there was GitHub & Bitcoin
In 2005, Linux Torval, who also created Linux, applied “Directed Ascyclic Graphs” to Git, which enabled modern software source version management. For each commit, Git uses the SHA1 cryptographic function to create a hash of the contents and previous hash. This makes it very difficult to insert (corrupt or censor) the chain of events after the fact.
In 2009 Bitcoin ($BTC) appeared as the first decentralized currency.
The concepts behind Bitcoin were described a year earlier in a whitepaper written anonymously under the name “Satoshi Nakamoto”. A ledger holds a sequential history (chain) of transactions. A cryptographic hash is made of each transaction and the transaction before it. Any change would be detected.
These features enabled transactions of assets (currency) to occur without the need for a traditional banking system using government-managed money.
BTW “orange pilled” is a term used to describe the process of convincing a fiat-minded person that they are missing out by not investing in bitcoin.
Unfortunately, criminals use the anonymous aspect of Bitcoin to receive ransoms from victims.
Many crypto currencies have appeared, but Bitcoin remains the most well-known and has the largest market capitalization.
The number of cryptocurrencies fostered a need for marketplaces and trading platforms than handles several currencies, such as liquid.com
OpenSea (to allow a DAO to manage a NFT storefront)
Etherium ($ETH) is the next largest crypto currency.
Blockchain and peer-to-peer Web3
Blockchain is a paradigm shift that allows the creation of systems which run “on their own”, by the protocol agreed before their launch.
Unlike “Web 2.0”, which enabled “third parties” such as Google, Facebook, LinkedIn to become the richest in the world by controlling and selling their user’s data in their centralized databases, Web3 (aka “Web 3.0”) are decentralized systems where users don’t have to give up on control (monitization) of their own data.
The “Sign Sign On” (SSO) of the future are “Decentralized Identifiers”(DDI) used by a “Self Soverign Identities” (SSI) approach, such as the EW Switchboard.
For example, instead of users going to a central system offered by Facebook, Google Docs, Box, Microsoft, etc., decentralized users would use Filecoin, a peer-to-peer network that stores files, with built-in economic incentives to ensure files are stored reliably over time:
Governments are naturally resistant to decentralized mechanisms because governments are in the business of centralized control, with the ability to shutdown Facebook, Instagram, Twitter, etc. Wikipedia has not been accessible in Turkey for a few years. Decentralized systems are difficult to shut down.
Cornerstones of Web 3.0 are semantic web and artificial intelligence (AI). Applying semantics in the Web would enable machines to decode meaning and emotions by analyzing data.
Web3j (at web3j.io) is a modular, reactive, type-safe Java and Android library for working with Smart Contracts and integrating with clients (nodes) on the Ethereum network.
Several technical platforms have appeared to make use of the Blockchain architecture.
|Sponsor||Ethereum Developer Community||Linux Foundation|
|Usage/Purpose||B2C (Business to Consumer)||B2B (Business to Business)|
|Early Adopters||IBM, SAP, HPE||Amazon, Facebook, Ebay|
|Mode of peer participation network||Public/Private and Permissionless network||Private and Permissioned network|
|Smart contracts||Smart contracts||Chaincode|
|Programming language||Solidity (Python)||Golang, NodeJs, Java|
|Throughput||~20 tps||~ 2,000 (parallel) tps|
|IDE (Editor)||Remix IDE||-|
|API (App Programming Interface)||web3j||?|
|Concensus mechanism||PoW (Proof of Work) reached by mining||Modular Pluggable Concensus algorithm such as PBFT (no mining required)|
|Cyptocurrency token||Ether (ETH) Gas built-in||No built-in cryptocurrency|
Closed and open chains can supplement each other, and move forward together. The Vostok platform, https://vostokplatform.io. is based the open “Waves” technology, from registries to voting, from payments to supply chains.
Asset Ownership transactions
Each transaction changes the ownership of an asset, which might be:
- Physical property — houses, unique artwork
- Virtual collectables — unique pictures of kittens, collectable cards
- “Negative value” assets — loans, burdens and other responsibilities
“Chaincode” defines an asset along with instructions (business logic) for modifying them.
“Smart contracts” are a mechanism that allows common contractual clauses to be specified, verified (enforced) in the absence of trust between contracting parties and in the absence of a third party.
There are several use cases for decentralized apps processing “smart contracts”:
- voting (registrar signs blinded token to issue each ballot without tying a voter to his/her vote)
- legal agreements
- supply chains
- digital ownership (CryptoArt)
NFT Implementations and other projects
In Aug 2021, Alibaba (the internet giant in China, which cracked down on all things crypto) created a NFT marketplace called “Blockchain Digital Copyright and Asset Trade” for content creators to copyright material and sell the rights (tokens) as well.
- CryptoKitties. https://www.cryptokitties.co
- 0xcert ERC-721 Token. https://github.com/0xcert/ethereum-erc721
- Su Squares. https://tenthousandsu.com
- Decentraland. https://decentraland.org
- CryptoPunks. https://www.larvalabs.com/cryptopunks issues 10,000 collectible characters were created on the Ethereum blockchain. This boot-strapped a community.
- DMarket. https://www.dmarket.io
- Enjin Coin. https://enjincoin.io
- Ubitquity. https://www.ubitquity.io
- Propy. https://tokensale.propy.com
- CryptoKitties Deployed Contract. https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code
- Su Squares Bug Bounty Program. https://github.com/fulldecent/su-squares-bounty
- XXXXERC721. https://github.com/fulldecent/erc721-example
- ERC721ExampleDeed. https://github.com/nastassiasachs/ERC721ExampleDeed
- Curio Cards. https://mycuriocards.com
- Rare Pepe. https://rarepepewallet.com
- Auctionhouse Asset Interface. https://github.com/dob/auctionhouse/blob/master/contracts/Asset.sol
- OpenZeppelin SafeERC20.sol Implementation. https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/SafeERC20.sol
- opensea.io Bored Ape Yacht Club
Third party brokers/wallets/auctioneers (“operators”).
The coinbase app has good tutorials in it and you get free crypto by going through them.
Ethereum is the clear leader, doubling its total value locked (TVL) to $54 billion in the first three months of 2021. So it can become overwhelmed.
Binance Smart Chain (BSC) surpassed Ethereum in the number of unique active wallets in Q1 2021, with 105,000 to Ethereum’s 75,000, according to DappRadar.
- Neo (NEO)
- NEM (XEM)
Etherium is an open-source public blockchain-based platform that supports smart contracts. It is maintained by the Ethereum Foundation by developers.
Nodes run in the EVM (Ethereum Virtual Machine) execution environment, which
- executes contract code
- calculates transaction complexity (gas consumption)
- verify transactions
EVM is Turing complete, meaning it can execute any operation a regular computer can.
Value is transferred by a transaction message sent between EOAs.
Eth doubling its total value locked (TVL) to $54 billion in the first three months of 2021.
Transactions are initiated from accounts of two types having an Ether balance, so can fire transactions
- Externally Owned Accounts (EOAs) are held by humans identified by a public/private key pair. EOAs have no associated code.
- Contract accounts are associated with contracts, and associated with code which process transactions on the blockchain.
Each transaction contains the recipient, the sender’s signature, the value of assets to send to the recipient, and the “gas price” set by the initiatior as incentive for transactions to be processed (in units of Ether). The “gas limit” is the hard cap on that incentive.
Initiated transaction requests are broadcast to all nodes in the entire blockchain network.
Transactions are added to the block of a Miner.
The process of verifying transactions is called “mining” by miners. Verification is nodes need to converge (agree) on consistency of transactions and order of transactions.
There are two trustless consensus algorithms:
- Hyperledger uses PBFT (Practical Byzantine Fault Tolerance) Proof-of-stake where the first one shouts out the decision
- Etherium v1 uses Proof-of-work
- Ethereum 2.0 uses a proof-of-stake
Miners determine the next block added to the chain.
Each transaction is stored as a “block”.
“blocks” in “blockchain” refers to how transactions are stored - in a chain of encypted blocks. Linked together cryptographically using hashes. Encryption is used so that the blockchain cannot be modified (corrupted or censored)
Distributed Ledger in a Blockchain Network
Etherium’ API is called “web3j”.
To compensate nodes on Ethereum for their participation, “Etherium” uses its “Ether” cryptocurrency.
MainNet and TestNet
Other Etherium standards at https://github.com/ethereum/eips/issues/721
- Standard Interface Detection standard ERC165 is used to expose interfaces.
- ERC-20 Token Standard.
- ERC-173 Owned Standard.
- ERC-223 Token Standard.
- ERC-677 transferAndCall Token Standard.
- ERC-827 Token Standard.
Etherium blockchain made distinct (non-fungible)
The ERC-721 standard defined in 2018 an API to track and transfer non-fungible tokens, also known as deeds” aka “smart contracts” powers most digital art and collectibles.
ERC-721 is a mechanism to associate NFTs with URIs.
ERC-721 is inspired by the ERC-20 token standard where each of a quantity of tokens is identical (fungible), which is insufficient for tracking NFTs when each asset is distinct (non-fungible).
Etherium Solidity programming
“pragma solidity” refers to the Solidity object-oriented programming language. https://docs.soliditylang.org/en/v0.5.3/layout-of-source-files.html
Solidity is the (“high-level object-oriented”) programming language that compiles to Bytecode which runs on Ethereum Virtual Machines.
Solidity is used to build Decentralized applications (DApps)
https://www.linkedin.com/learning/blockchain-learning-solidity/get-started-with-solidity Blockchain: Learning Solidity by Emmanuel Henri
0xcert ERC-721 Token includes test cases written using Truffle.
Truffle (github.com/trufflesuite/truffle) is a npm development environment, testing framework, and asset pipeline for Ethereum smart contract compilation, linking, deployment and binary management. Its automated contract testing uses Mocha and Chai testing frameworks.
Migrating contracts to mainnet costs eth. So…
Ganache CLI is a test blockchain used to run tests. Many prefer to use its Docker image by migrating contracts to the container where tests are run.
Other test networks: ropsten, rinkeby, kovan
Gorli testnet is suppose to be a universal testnet
Blockchains are not designed to store files. And legacy file storage mechanisms such as NFS, Google Drive, Dropbox, etc. are central Web 2.0 technologies.
Blust.tv aims to use IPFS to distribute movies when requested by its users. By adding their proprietary secret-sauce, they will facilitate the legal streaming of videos over P2P networks.
Audius is a music streaming platform built on IPFS. Artists are in control, no fees are taken by the platform, and listeners can enjoy their music while offline.
A file such as https://en.wikipedia.org/wiki/Aardvark, on a website owned by Wikipedia, who can grant or deny access on its own. In IPFS that file would be retrieved using this CID (Content Identifier), a unique fingerprint: https://ipfs.io/ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki/Aardvark.html
Instead of locations, that jumble of characters after “/ipfs/” is the content identifier created as a cryptographic hash of the entire contents of the file. Any change to the content would yield a whole other hash value. So you are able to verify content received by comparing hashes them to the CIDs that you requested. These CIDs also blocks to be deduplicated (removing duplicates), to reduce disk usage.
At the end of 2021, 3,500 storage providers around the world collectively offer more than 13EiB of storage capacity, according to the Filecoin Foundation, who says their Filecoin network storage is more cost effective than traditional storage providers.
Filecoin (cryptocurrency FIL) provides financial incentives for both ends of “deals” during communication between clients and the network. Storage miners store the data, and retrieval miners who supply the network bandwidth.
In a storage deal, the client chooses a miner to store their data and locks up the funds necessary to pay for storage. Once the agreement is accepted, the file is transferred and stored by the miner. The miner provides continuous proof of storage to the chain in order to receive rewards from the funds locked up by a client. If they fail to provide a proof (or if proof is delayed) the miner gets penalized.
In a retrieval deal, the client makes a payment to a retrieval miner to extract the data from the network. (Retrieval miners can also be storage miners, but they don’t have to be.) These deals are executed “off-chain” — using micropayment channels to reward miners for data retrieval.
DNSLink maps CIDs to human-readable DNS names, creating and updating mutable links to IPFS content.
IPFS finds the latest version of a file using the IPNS InterPlanetary Name System (IPNS) allows for publishing the latest version of any IPFS content, even though the underlying IPFS hash has changed.
To request blocks, IPFS currently uses the Bitswap module of https://libp2p.io/ to send a wantlist of all the blocks you’re interested in.
The IPFS network is a CDN (Content Distribution Networks) by design because each node caches what they consume and serve that data to its peers. But IPFS does not just copy files on several servers like Akamai and other traditional CDNs.
By using the dedicated client npm-on-ipfs (opens new window), packages are fetched from IPFS and distributed to other clients needing them. For example, a team working in the same building will fetch packages from each other, meaning less network traffic costs for the company.
Content discovery is via distributed hash tables (DHTs) which works similar to DNS. THe DHT is split across all peers in a distributed network.
There are other content replication protocols under discussion, the most developed which is Graphsync.
An individual IPFS address can refer to the metadata of just a single piece of a file, a whole file, a directory, a whole website, or any other kind of content.
IPFS is based on possession and participation, where many people possess each others’ files and participate in making them available.
IPFS mirrors each file in several locations. So if someone attacks one web server, you can still get the same webpages from another mirror. It’s also harder for states, corporations, etc. to block access.
There are services based on IPFS called pinning services (like Dropbox).
By default, your computer shares a file with others for a limited time after you’ve downloaded it using IPFS. You can also make content available more permanently by pinning it, which saves it to your computer and makes it available on the IPFS network until you decide to unpin it.
VIDEO: How IPFS Deals With Files
upload-to-ipfs GitHub Action uploads DApps or content to IPFS in a GitHub pipeline, using the Pinata cloud service. They provide 1GB free storage to get you started. Get your API key from the account section for use later.
Clients listen for DNSLink entries on the Dweb.
IPFS Desktop GUI clients
Orion enables sharing of content on the public peer to peer network without any command line or technical knowledge. The app includes everything needed to start your own personal IPFS node.
IPFS Desktop is the official desktop client for IPFS. It comes with a built-in IPFS node that lets you pin files and gives you a link to share them. This is generally seen as the easiest point-of-entry into the IPFS ecosystem.
Arbore is a free and open-source file-sharing application that enables you to send your pictures, documents, files to your contacts privately and without limits.
David Burela who wrote Combining Azure static web apps with the decentralised web by using Cloudflare which supports ipfs-deploy
Fleek.co enables websites & apps to be built using IPFS. The workflow is similar to that of Netlify: developers can link their website or a web app hosted on GitHub to Fleek and have it automatically built and deployed on IPFS whenever a change is made to a specific branch.
Fleek also comes with Ethereum Name Service (ENS) and domain name integration.
Ethereum blockchain dev
Frameworks to build decentralized apps on IPFS:
5 hour video course - Learn to develop applications for the Ethereum platform. Start with the basics of blockchain and Ethereum, then learn the core skills for writing smart contracts using Solidity programming language.
Embark is an all-in-one developer platform for building and deploying decentralized applications. It currently integrates with Ethereum blockchains, decentralized storage like IPFS, and decentralized communication platforms like Whisper and Orbit.
It uses static-site generators like VuePress or Gatsby.
AWS Blockchain Templates for Ethereum
Build your own private network using a AWS Blockchain Template. “Templates” refers to AWS Cloud Formation templates that use Docker containers within ECS (Elastic Container Service).
The architecture is from video course “Deploying Ethereum with AWS Blockchain Templates” by Janani Ravi:
FoxyProxy standard browser extension
Install FoxyProxy Standard add-in to Google Chrome browser:
Click “Add to Chrome”, “Add extension”.
Configure FoxyProxy to look for a pattern going through a SOCKS proxy server on port 9001:
connects to a SOCKS proxy server within AWS.
External access is through a Bastion host on a public subnet/availability zone.
It communicates though the publc subet of another availability zone.
public subnet has a container managed by the AWS ECS (Elastic Container Service):
Additional nodes by others can be created to participate.
Etherium was designed for this.
Decentralized nodes means that there is no single point of failure.
Hyperledger has two types of nodes:
- Peer nodes that execute and verify transactions (transactions)
- Ordering nodes (consenters) order and propagate transactions
Peer nodes can be endorser and committer.
The immutable sequenced records in blocks within the blockchain log stores.
The blockchain’s current state is stored in the State Database.
This tracks each transaction’s provenance (chain of custody).
So how can CryptoArt be stolen?
Ethereum Name Service (ENS) ?
Internet Computer via DFINITY’s dfx to ic0.app
The “Internet Computer” (public cyberspace) extends the internet with compute to host humanity’s logic and data. It is the third major blockchain innovation:
- Bitcoin cryptocurrency (“digital gold”)
- Etherium smart contracts, which made programmable to power “DiFi” (Distributed Finance)
- Infinite blockchain with seamless capacity of special nodes run by independent data centers
DFINITY progressed from Copper 2019 to Bronze 2020 to Tungsten to Sodium to VIDEO: “Mercury Genesis” launched May 10, 2021.
sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
info: Executing dfx install script, commit: 866752d66cfe26c92fe075028fff6c7c52a2aeb1 warn: Not forcing TLS v1.2, this is potentially less secure info: Version found: 0.8.1 info: Creating uninstall script in ~/.cache/dfinity info: uninstall path=/Users/wilsonmar/.cache/dfinity/uninstall.sh info: Checking for latest release... warn: Not forcing TLS v1.2, this is potentially less secure Will install in: /usr/local/bin info: Installed /usr/local/bin/dfx
At time of writing, it was:
The sample def.json file at the root Gatsby static site sample
https://github.com/wilsonmar/dapp-samples/tree/main cd dapp-samples
It contains a minimal index.html
Deploy to the Internet Computer ledger (instead of to web servers) to generate a canister id (the equivalent of an IP address on TCP/IP):
dfx deploy --network=ic
This adds a “dfx” folder in the current project folder and a
canister_ids.json folder and displays a canister id (GUID), such as “w2tya-5qaaa-aaaab-abasa-cai”.
Visit your site by constructing its URL from your canister id:
Canisters serve internet content (HTML pages, videos, etc.) directly to end-users (internet browsers) instead of CDN, firewalls, VPNs, load balancers, databases, etc. now used by central “Big Tech” systems such as Google, Facebook, Instagram, Twitter, etc..
Canisters run inside hypervisors (4K memory pages).
Motoko supports IC canisters as “actors” (objects that encapsulate their state and communicate through atomic async messages) – no waiting for reply.
Instead of TCP/IP ports, there are functions such as getProfile(userId: String) which calls other computers directly.
A variable declared as “stable” is persisted across software upgrades.
It’s a peer-to-peer (P2P) network.
Each canister runs as part of a subnet, which replicates nodes who use a concensus protocol to process messages in the order agreed.
The subnet types:
- Data (BigMap)
- NNS (Network Nervous System) the ICP has an in-protocol open governance system
Standardized Node hardware run within independent Data Centers.
VIDEO: “Token economics” ICPT
VIDEO: The Internet Computer is created by the ICP (Internet Computer Protocol) on top of the Internet Protocol widely used today.
- Block Making: Propose blocks to extend the block chain
- Notarization: Ensure valid blocks are published (because some block proposals may be invalid)
- Random Beacon: Agree on randomness
- Finalization: Know when a block is agreed upon
dfx ledger –network ic0 balance
dfx wallet –network ic1 balance
LinkedUp social network identity
VIDEO: https://www.reddit.com/r/dfinity/comments/etdx8j/introducing_linkedup/ as a “self-soverign” identity. https://www.youtube.com/watch?v=m4xiRlJdhh8
Internet Identity on Safari
To securely access dapps on the Internet Computer and use Internet Identity for authentication, create an Identity Anchor, then add devices to it.
A different pseudonym is created for each dapp that you access by creating new Identity Anchors.
Windows Hello authentication is supported in Chrome, Edge, and Firefox.
On iOS, authentication works across Safari browsers with registered WebAuthn keys.
However, on OS X, All currently supported authentication methods follow the WebAuthn standard. The following restrictions apply, however: On OS X, authentication using Safari is coupled to your browser profile. If you want to authenticate to a dapp in a different browser, or if you use multiple Safari browser profiles, you have to add the combination of your authentication method and the new browser as a new device.
VIDEO: Devices use Ubikey No passwords.
- Blockchain, Bitcoin, Crypto, NFTs and the Metaverse” by George Levy, author of course: “Getting Started with Blockchain and Cryptocurrency” November 2019
- Blockchain, NFTs, and Smart Contracts for Practical Use</a> by Aamir Lakhani, author of Practical Blockchain and Cryptocurrency by Aamir Lakhani - Addison-Wesley Professional December 2022
https://www.youtube.com/watch?v=cmLJHlNlH1s on the “Bankless” youtube channel
Find NFT projects early and participate in mint launches.
risks involved when trading/investing in NFTs.
A new NFT ecosystem for Culture & Creativity, built efficiently with Ethereum.