SHARE Protocol
Search
⌃K

Web3 Fundamentals

Blockchains

A blockchain is essentially a distributed database in which consensus is reached by all network participants using a variety of techniques (e.g. proof-of-work or proof-of-stake). There is generally an understanding of the basic idea of having a distributed historical record of global transactions that is not intermediated by a bank or government. However, what many overlook are the capabilities which allow anyone to run code on the network. In the Share protocol, we're much less concerned with the price of digital currencies and much more interested in the idea of an ownerless virtual state machine. This is the Ethereum Virtual Machine (EVM).

Ethereum Virtual Machine (EVM)

In Ethereum, the blockchain is constructed by a large group of network participants all running the same program on their hardware. This program is called GETH. It stands for "Go Ethereum", e.g. the Go implementation of the Ethereum node software. GETH handles the blockchain consensus protocol but also contains a runtime implementation which allows transactions to execute custom code on the Ethereum network. This means that effectively, the Ethereum blockchain is one large distributed Turing machine. You don't need to install GETH to run code on it. There are thousands of network participants already running the software. Instead, you send an RPC to a "node", and the node uses its implementation of GETH to (1) verify the authenticity of your request (2) reach consensus with other nodes (3) execute your contract code (4) return a result and update the machine state.
The reason this is such an interesting feature for content creators comes down to the idea of terms of service (ToS). Traditionally, the relationship between content creators and content consumers is administered by a program which runs on vendor controlled hardware. This means that the vendor controls the ToS. Conversely, a creator may distribute content using her own website, but this does not solve the problem, as it simply means that the creator is a new vendor, and no other creator collectively benefits from any policy implemented on their machine. The EVM is an incredible innovation which solves this problem because ToS can be implemented and executed on public, ownerless infrastructure. Share smart contracts are essentially ToS, executed on a publicly owned global machine. The fact that this machine has financial capabilities in the form of coins is a very convenient feature, but not the fundamental reason that Share is using blockchain technology.

Addresses and Wallets

A blockchain address is like a phone number or an e-mail address––it can be used to uniquely identify users, but it is natively linked to a financial transaction mechanism in the form of a wallet. Blockchain addresses are 160-bit hexadecimal strings that look like this:
0xD433e00E15aB2B2CBFb451a8E73946f14fD80B2C
Users are also able to (optionally) register these addresses such that they can be resolved using a name much like DNS. For example, on the Ethereum blockchain, the name un7c0rn.eth resolves to the address above.
A wallet, often referred to as a "crypto wallet" or "Web3 wallet", is a standalone application, which a user typically controls, that stores a user's blockchain address information and cryptographic keys for authorizing financial transactions or agreements in any other application. The key innovation here which is unique to Web3 is that a single private key and wallet can be used to identify a user and authenticate transactions in any application.

Nodes

There are typically two ways to interact with a blockchain:
  1. 1.
    Running a node. This means you have a machine which is validating transactions and directly contributing to the construction of the blockchain. To achieve this, your machine would run the validation software, such as GETH (mentioned above). By running a node, you can send signed transaction data to your own machine and directly propose its addition to the blockchain on the network.
  2. 2.
    Interacting with a 3rd party node. To offset the requirements of running your own node, many developers choose to send transactions to existing nodes. There are many public nodes available that interact with the blockchain and enable users to query them using RPC. In Share, we use the Alchemy node to interface with the Ethereum and Polygon blockchain networks.

Web3 APIs

Throughout this documentation you will see references to the Web3 Javascript (JS) library. Web3 JS is a library which infers smart contract functionality using Application Binary Interface (ABI) data generated at contract compilation time. Fundamentally, the library itself is nearly always used to construct a signed blob of binary that gets sent to a node as a transaction via RPC. Due to this RPC interface, virtually any language can be used to construct these transaction messages. Javascript is the most popular API since it can execute client-side within a browser. You can read more about web3.js here.