Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

spacelephantlabs/ark-core_non-fungible-token

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ark Core - with Non fungible tokens

Introduction

This repository is forked from ArkEcosystem/core. It adds non fungible token management to Ark framework.

⚠️ this project is experimental, do not use it in production ⚠️

Documentation

For information about Ark framework features look into the Readme

For information about the non fungible token feature of Ark framework look at discussion

How to test

In order to test the NFT feature, you must run a test network.

Setup environment

yarn
yarn setup

Run

Database
yarn docker ark
cd docker/development/testnet
docker-compose up -d postgres
Launch

Go to packages/core and launch testnet

cd ../../../packages/core
yarn full:testnet

Your testnet ark is launched!

Once your test network is up, you can use the core-tester-cli package to create NFT transactions.

Note: in order to be able to broadcast transactions, wallets receive funds from the passphrase in config.ts.

0: Generate a wallet

> yarn tester make:wallets --quantity 1 --write

It will create a new empty wallet and store its information into $(pwd)/wallets.json (passphrase, address, keys).

Mint a token:

> yarn tester send:nfttransfer --id $TOKEN_ID --owner $PASSPHRASE

Note 1: $TOKEN_ID is the token identifier you want to mint Note 2: $PASSPHRASE is the one in $(pwd)/wallets.json, the token owner Note 3: instead of --id, you can use option --unikname $UNIKNAME to use unikname as token identifier

This command will create a transaction minting the token identified by given number. Then, it'll broadcast the transaction to your local node, which should forge a new block. The command ends successfully after checking if token has been really minted (calling node API).

You can run curl 127.0.0.1:4003/api/v2/nfts to manually check your new token through node API. You can run curl 127.0.0.1:4003/api/v2/wallets/${owner_address} to manually check if the wallet is the owner of the new token.

Note: you can omit the --id or --unikname flag, command will generate an id for you.

Transfer a token (change ownership):

⚠️ work in progress

> yarn tester send:nfttransfer --id $TOKEN_ID --recipient $RECIPIENT --owner $PASSPHRASE

Note: $RECIPIENT is the new token owner address

This command will create a transaction to transfer ownership of given token to given address. The command ends successfully after checking if the new token owner is the given recipient (calling node API).

You can run curl 127.0.0.1:4003/api/v2/wallets/${owner_address} to manually check if the wallet is not the owner of the given token. You can run curl 127.0.0.1:4003/api/v2/wallets/${recipient_address} to manually check if the wallet is the new owner of the given token.

Update properties of a token:

Coming soon

Clean for safe restart

Clean dependencies in each package: Lerna/clean

yarn clean

Remove docker containers and volumes:

docker stop ark-testnet-postgres && docker system prune -a && docker volume remove testnet_core testnet_postgres

Remove ark testnet caches:

rm -rf ~/.local/state/ark-core/testnet && rm -rf ~/.local/share/ark-core/testnet && rm -rf ~/.cache/ark-core/testnet

TODOs

  • Implement properties.
  • Implement a way to revert update transactions.
  • Estimate and set default fees amounts.
  • fix double transaction execution (in the pool and in the block processor). The branch debug/nft trace execution to visualize the bug.
  • Persist in database. Currently, when you restart node, all tokens are erased.
  • update token id to Buffer to fit with specifications abandoned, the AIP70 must be updated, Buffer type is irrelevant to be used as token identifier
  • Rename /nft API to /nfts
  • Fix old tests.

About

Ark framework with non fungible token feature

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.2%
  • JavaScript 1.5%
  • Shell 1.1%
  • TSQL 0.1%
  • Ruby 0.1%
  • Dockerfile 0.0%