Polkadot - Layer 0
Relay chain - nominated proof of stake chain
limited functionality
no support for smart contract
collect states from parachains
Parachains - layer 1
offers dapp, smart contract, ... and connect to relay chain
parachains block was sent to relay chain for validity
layer 2 can be built upon layer 1 parachain
can also act as bridges to connect with other blockchain ecosystem (Bitcoin, Ethereum)
Parathreads
function the same as parachains but was charged based on each block instead of signing a two year lease with Polkadot
Kusama - standalone independent blockchain
“test protocol”
Substrate - sdk to build blockchain
RPC (Remote procedure calls)
a way for an external program—for example, a browser or front-end application—to communicate with a Substrate node. They are used for checking storage values, submitting transactions, and querying the current consensus authorities. Substrate comes with several . In many cases, it is useful to add custom RPCs to your node.
API Design Paradigms
is created to solve the above problem where the client needs to send multiple requests before the web API returns a complete status Client - register with interested events and callback URL API Provider sends event data whenever updated to the callback URL Failures - ensure delivery through retries Firewalls - apps running behind firewalls can send but receiving can be tricky Noise - typically, each webhook represents a single even. Many events in a short time can be noisy Best for trigger the server to send events to predefined client endpoints Client sends Handshake (HTTP) & Server upgrade to WebSocket which is a bidirectional communication channel bidirectional low latency communication reduced overhead of http requests Clients are responsible for connections Best for Bi-directional communication between clients and servers client sent a request and server response with a new event that runs indefinitly can stream over simple http bidirectional communication is challenging buffering in client side can be limiting Best for One-way communication over HTTP representational state transfer (REST) collection (https://foobar.com/api/v1/users) entity (https://foobar.com/api/v1/users/user-1) standard method names, arguments, and status codes multiple http roundtrips (getting an entity and it sub resources took two api calls) best for Create Read Update Delete (CRUD) Operations remote procedural call (RPC) endpoint for each action (https://slack.com/api/chat.postMessage) limited standardization (heavy reference to documentation) leads to function explosion best for exposing several actions get, post for most programs user defined a structure that the response should be and the api returns the payload in that structure saves multiple round trips added complexity for server optimizing performance is difficult too complicated for a simple API best when need querying flexibility Polkadot.js
install by
API Interface was dynamically generated base on the connected node
Metadata
api.<type>.<module>.<section>
const - runtime constants
query - chain state
tx - all extrinsics
API Provider & API Instance