dType is a Decentralized Type System for a Global OS, for Ethereum. A global type system enables independently built system parts to interoperate. Developers should agree on standardizing common types and a type registry, continuously working on improving them, to become part of the Global OS. Ethereum could become the origin for defining types for other programming languages.
dType supports any Solidity type, including functions, along with custom user types. dType assigns a unique global identifier for each type and stores data needed to recompose the type's ABI. Various storage mechanism extensions can be optionally integrated with dType, enabling efficient blockchain data analysis, especially by blockchain explorers, without relying on off-chain centralized services to provide ABI data.
- EIP-1900: dType - Decentralized Type System for EVM, discussions here
- EIP-2157: dType Storage Extension - Decentralized Type System for EVM
- EIP-2193: dType Alias Extension - Decentralized Type System
- EIP-xxxx: dType - Extending the Decentralized Type System for Functions
- dType Language Extension, Data Bridging
In research: dType on Ethereum 2.0.
Playlist: https://www.youtube.com/playlist?list=PL323JufuD9JC46yClCf5fdaEX17kocem7
For an overview, see dType 101 - A Developer Guide - 1. The Anatomy of a dType
- System Registry for The World Computer
- dType — Decentralized Type System & Functional Programming on Ethereum
- Ethereum, Libra and a Unified Type System
Types are registered in the dType
contract. See dType.sol.
struct dType {
address contractAddress;
bytes32 source;
string name;
string[] types;
string[] labels;
}
A type must implement a library and a contract that stores the Ethereum address of that library, along with other contract addresses related to that type (e.g. smart contract for storing the data entries for that type).
contract TypeRootContract {
address public libraryAddress;
address public storageAddress;
constructor(address _library, address _storage) public {
require(_library != address(0x0));
libraryAddress = _library;
storageAddress = _storage;
}
}
A type library contains the definition of the type, along with helper functions. Example typeALib.sol.
A type storage contract contains data entries for the type. Example typeAContract.sol.
Example for functional programming with dType.run()
.
Prerequisites:
npm install -g truffle
Compile:
cd contracts
truffle compile
Test:
truffle test
truffle test test/dtype.js
Deployment prerequisites:
mkdir private
cd private
touch infuraKey.txt
touch privateKey.json
Deployment commands:
Ganache is set on port 8545.
truffle migrate --network ganache
Contains core packages for dType and example packages for each type.
Future plans:
- type packages will be published on Swarm/IPFS and loaded on demand in the client app
cd dType
npm install
lerna bootstrap
lerna run build
cd client
# Remove dType/client/package-lock.json if npm install fails, and try again
npm install
npm run start
For the client app to run correctly, you need to first deploy the contracts with truffle migrate
and connect with Metamask to the testnet/private network.