Giter Club home page Giter Club logo

nftmart's Introduction

DEPRECATED

⛔️ DEPRECATED The new substitute repository is https://github.com/NFTT-studio/NFTMart-Node

Architecture overview

architecture overview

Installation

Prerequisite

Please follow this link to prepare an development environment.

Build and run a testing environment locally

git clone https://github.com/NFTT-studio/nftmart
cd nftmart
cargo build --release --bin substrate
target/release/substrate -d target/dev -lruntime=debug \
  --max-runtime-instances=30 \
  --execution=NativeElseWasm \
  --rpc-cors=all \
  --rpc-methods=Unsafe \
  --unsafe-ws-external \
  --dev \
  --port 30333 \
  --ws-port 9944 \
  --rpc-port 9933 \
  --ws-max-connections=10000

Build and run a testing docker environment locally

# To build a docker image.
git clone https://github.com/NFTT-studio/nftmart
cd nftmart
NFTMARTROOT=`pwd`
cargo build --release --bin substrate
cd $NFTMARTROOT/target/release
tee Dockerfile <<-'EOF'
FROM ubuntu:20.04
WORKDIR /data
ADD substrate /usr/bin/substrate
EXPOSE 9944/tcp
EXPOSE 30333/tcp
EOF
docker build -t nftmart -f Dockerfile ./
cd $NFTMARTROOT

# Run nftmart with two validators
mkdir -p $NFTMARTROOT/target/release/dev-node0
mkdir -p $NFTMARTROOT/target/release/dev-node1
docker network create --subnet=172.28.0.0/16 --driver bridge chain-dev-net

docker run -d --restart unless-stopped --name dev-node0 \
 --mount type=bind,source=$NFTMARTROOT/target/release/dev-node0,destination=/data \
 --publish 9944:9944 \
 --network chain-dev-net \
 --hostname dev-node0 \
 --ip 172.28.0.2 \
 --entrypoint substrate \
 nftmart \
 -d /data \
 -lruntime=debug \
 --node-key 0000000000000000000000000000000000000000000000000000000000000001 \
 --execution=NativeElseWasm \
 --rpc-cors=all \
 --rpc-methods=Unsafe \
 --unsafe-ws-external \
 --chain local \
 --alice \
 --validator \
 --wasm-execution Interpreted \
 --ws-max-connections=10000

docker run -d --restart unless-stopped --name dev-node1 \
 --mount type=bind,source=$NFTMARTROOT/target/release/dev-node1,destination=/data \
 --network chain-dev-net \
 --hostname dev-node1 \
 --ip 172.28.0.3 \
 --entrypoint substrate \
 nftmart \
 -d /data \
 -lruntime=debug \
 --node-key 0000000000000000000000000000000000000000000000000000000000000002 \
 --execution=NativeElseWasm \
 --rpc-cors=all \
 --rpc-methods=Unsafe \
 --unsafe-ws-external \
 --chain local \
 --bob \
 --validator \
 --wasm-execution Interpreted \
 --bootnodes /dns/dev-node0/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp \
 --ws-max-connections=10000

nftmart-fontend

docker run -d --restart unless-stopped \
	--publish 18001:5000 \
	--name nftmart-fontend \
	-e REACT_APP_WS_URL=ws://127.0.0.1:9944 \
	maomaotp/nftmart-fontend:040201 sh /start.sh

polkadot-js-apps

docker run -d  \
	--name polkadot-ui  \
	-e WS_URL=ws://127.0.0.1:9944  \
	-p 18002:80  \
	jacogr/polkadot-js-apps

Use Nodejs to access nftmart blockchain

git clone https://github.com/NFTT-studio/nftmart
cd nftmart/nodejs-demo
yarn install

# Create a class(ID: 0) by Alice with local testing node.
node nft-apis.mjs --ws ws://127.0.0.1:9944 create-class //Alice

# Add a new class administrator to the class, ID: 0
node nft-apis.mjs --ws ws://127.0.0.1:9944 add-class-admin //Bob

# Create an another class(ID: 1) managed by Alice.
node nft-apis.mjs --ws ws://127.0.0.1:9944 create-class //Alice

# List all classes
node nft-apis.mjs --ws ws://127.0.0.1:9944 show-class-info
[
  '{"metadata":"https://xx.com/aa.jpg","totalIssuance":0,"owner":"62qUEaQwPx7g4vDz88bdp1tmZkSpPtVRL4pS98P7VEbZnM9w","data":{"deposit":2280000000000,"properties":3,"name":"0x616161","description":"0x62626262","createBlock":489},"classID":1,"adminList":[[{"delegate":"65ADzWZUAKXQGZVhQ7ebqRdqEzMEftKytB8a7rknW82EASXB","proxyType":"Any","delay":0}],261000000000000]}',
  '{"metadata":"https://xx.com/aa.jpg","totalIssuance":0,"owner":"62qUEaQwPx7g4vDz88bN4zMBTFmcwLPYbPsvbBhH2QiqWhfB","data":{"deposit":2280000000000,"properties":3,"name":"0x616161","description":"0x62626262","createBlock":8},"classID":0,"adminList":[[{"delegate":"63b4iSPL2bXW7Z1ByBgf65is99LMDLvePLzF4Vd7S96zPYnw","proxyType":"Any","delay":0},{"delegate":"65ADzWZUAKXQGZVhQ7ebqRdqEzMEftKytB8a7rknW82EASXB","proxyType":"Any","delay":0}],459000000000000]}'
]

# Mint three nft tokens to Bob in the class which ID is 0.
node nft-apis.mjs --ws ws://127.0.0.1:9944 mint-nft //Bob 0

# List all nfts in the class, `ID:0`
node nft-apis.mjs --ws ws://127.0.0.1:9944 show-all-nfts 0
{"metadata":"0x6161626263636464","owner":"63b4iSPL2bXW7Z1ByBgf65is99LMDLvePLzF4Vd7S96zPYnw","data":{"deposit":1080000000000,"createBlock":554}}
{"metadata":"0x6161626263636464","owner":"63b4iSPL2bXW7Z1ByBgf65is99LMDLvePLzF4Vd7S96zPYnw","data":{"deposit":1080000000000,"createBlock":554}}
{"metadata":"0x6161626263636464","owner":"63b4iSPL2bXW7Z1ByBgf65is99LMDLvePLzF4Vd7S96zPYnw","data":{"deposit":1080000000000,"createBlock":554}}

nftmart's People

Contributors

andresilva avatar arkpar avatar ascjones avatar athei avatar bkchr avatar cecton avatar cheme avatar demi-marie avatar expenses avatar gabreal avatar gavofyork avatar gnunicorn avatar gui1117 avatar ialicebobi avatar joshorndorff avatar kianenigma avatar ltfschoen avatar marcio-diaz avatar mxinden avatar nikvolf avatar pepyakin avatar rphmeier avatar shawntabrizi avatar sorpaas avatar stanislav-tkach avatar svyatonik avatar tomaka avatar tomusdrw avatar tripleight avatar xlc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nftmart's Issues

Release failure for refs/tags/ci-release-check

Pipeline for release refs/tags/ci-release-check failed. Please investigate.

If the pipeline has failed before pushing to crates.io, delete the release tag
and fix the release as necessary, retagging after complete. If the pipeline has
failed after pushing to crates.io, create a new tag incrementing the version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.