The Unique Pallet is the core of NFT functionality. Like ERC-721 standard in Ethereum ecosystem, this pallet provides the basement for creating collections of unique non-divisible things, also called Non Fungible Tokens (NFTs), minting NFT of a given Collection, and managing their ownership.
The pallet also enables storing NFT properties. Though (according to ERC-721) NFT properties belong to logic of a concrete application that operates a Collection, so purposefully the NFT Tracking Module does not have any knowledge about properties except their byte size leaving application logic out to be controlled by Smart Contracts.
The Unique Chain also provides:
- Smart Contracts Pallet and example smart contract that interacts with Unique Runtime
- ERC-1155 Functionality (currently PoC as Re-Fungible tokens, i.e. items that are still unique, but that can be split between multiple users)
- Variety of economic options for dapp producers to choose from to create freemium games and other ways to attract users. As a step one, we implemented an economic model when a collection sponsor can be set to pay for collection Transfer transactions.
Wider Unique Ecosystem (most of it was developed during Hackusama):
Please see our walk-through instructions to try everything out!
If you are building an application that operates NFT tokens, use this document.
Building Unique chain requires special versions of Rust and toolchain. We don't use the most recent versions of everything so that we can keep the builds stable.
Windows note: We do not provide support for Windows systems and don't test the Unique chain on them. Nonetheless, the Unique chain node might work on Windows. To build it on Windows, you need to enable symlink support in Git:
git config --global core.symlinks true
- Install Rust:
sudo apt-get install git curl libssl-dev llvm pkg-config libclang-dev clang make cmake protobuf-compiler
curl https://sh.rustup.rs -sSf | sh
-
Remove all installed toolchains with
rustup toolchain list
andrustup toolchain uninstall <toolchain>
. -
Install toolchain nightly-2024-04-10 and make it default:
rustup toolchain install nightly-2024-04-10
rustup default nightly-2024-04-10
- Add wasm target for nightly toolchain:
rustup target add wasm32-unknown-unknown --toolchain nightly-2024-04-10
- Build:
Opal
cargo build --release
Quartz
cargo build --features=quartz-runtime --release
Unique
cargo build --features=unique-runtime --release
Note: checkout this project and all related projects (see below) in the sibling folders (both under the same folder)
git clone https://github.com/paritytech/polkadot-sdk.git
cd polkadot
git checkout release-polkadot-v1.9.0
cargo build --release
Run in the root of this project:
cargo build --release
git clone https://github.com/AcalaNetwork/Acala
cd Acala
git checkout 54db3acd409a0b787f116f20e163a3b24101ce38
make build-release
You can launch the node in the dev mode where blocks are sealed automatically each 500 ms or on each new transaction.
- Opal Runtime:
cargo run --release -- --dev
- Quartz Runtime:
cargo run --release --features quartz-runtime -- --dev
- Unique Runtime:
cargo run --release --features unique-runtime -- --dev
You can tweak the dev mode with the following CLI options:
- --idle-autoseal-interval <IDLE_AUTOSEAL_INTERVAL>
When running the node in the
--dev
mode, an empty block will be sealed automatically after the<IDLE_AUTOSEAL_INTERVAL>
milliseconds. - --disable-autoseal-on-tx
Disable auto-sealing blocks on new transactions in the
--dev
mode - --autoseal-finalization-delay <AUTOSEAL_FINALIZATION_DELAY>
Finalization delay (in seconds) of auto-sealed blocks in the
--dev
mode. Disabled by default.
- Install all needed dependencies
cd tests
yarn install
- Run tests
yarn test
cargo clippy
cargo fmt
pushd tests && yarn fix ; popd
cd tests && yarn eslint --ext .ts,.js src/
make git-hooks
To get started, you need to open inbound and outbound hrmp channels.
assetRegistry -> registerForeignAsset(location, metadata)
location:
V0(X2(Parent, Parachain(PARA_ID)))
metadata:
name QTZ
symbol QTZ
decimals 18
minimalBalance 1
polkadotXcm -> reserveTransferAssets
dest:
V0(X2(Parent, Parachain(<KARURA_PARA_ID>)))
beneficiary:
X1(AccountId(Any, <ACCOUNT>))
assets:
V1(Concrete(0,Here), Fungible(<AMOUNT>))
feeAssetItem:
0
weightLimit:
<LIMIT>
The result will be displayed in ChainState tokens -> accounts
xtokens -> transfer
currencyId:
ForeignAsset
<TOKEN_ID>
amount:
<AMOUNT>
dest:
V1
(
Parents:1,
X2(Parachain(<KARURA_PARA_ID>), AccountId(Any, <ACCOUNT>)
)
destWeight:
<WEIGHT>