Get Started
Introduction
MetaID SDK provides a set of standard specifications and tools for generating and processing underlying blockchain data that conforms to the MetaID protocol (specifically for UTXO-standard chains, currently supporting the BTC chain).
The design goal of MetaID SDK is to offer a relatively unified and efficient method, greatly simplifying the integration of web3 services. It eliminates the need for developers to handle multiple protocols and construct complex UTXO transactions for on-chain data, saving time and reducing the risk of compatibility issues.
With the simplicity, compatibility, extensibility, and efficiency of MetaID SDK, traditional application developers can quickly develop and deploy a Dapp application running on a UTXO chain.
Core Concepts
MetaID SDK has two core concepts: Connector and Entity.
Connector: Used for authentication and management of identity information, serving as the foundation for users to publish data on the blockchain.
Entity: A term used in the application layer for managing resources of a specific data type. From a programming perspective, when you create a new entity instance, you can access its properties and utilize a series of methods it provides for executing on-chain data storage and modifications. Each type of Entity corresponds to the PATH part of the MetaID Specification.
Installation
Method 1: Use Yarn or NPM
// Use Yarn
yarn add @metaid/metaid
// Use NPM
npm install --save @metaid/metaid
Method 2: Include as src in Your Native JS Project
This method converts the npm package into a browser-compatible package without requiring a bundling tool like webpack.
Initialize a local project:
mkdir generate-metaid-bundle && cd generate-metaid-bundle/
yarn init
// or
npm init
Install the SDK:
npm install --save @metaid/metaid
// or
yarn add @metaid/metaid
Create a
main.js
file with just two lines of code:
var metaidSDK = require('@metaid/metaid')
window.metaidSDK = metaidSDK
Globally install browserify:
npm install -g browserify
// or
yarn global add browserify
After installation, run the command:
browserify main.js -o bundle.js
Once the command is executed, a
bundle.js
file will be generated. Now you can include this file along with your HTML code using the<script>
tag:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="bundle.js"></script>
</head>
<body>
<div class="app">
<!-- HTML tag of your page -->
</div>
<script>
// JS code
</script>
</body>
</html>
Last updated