This repositry contains implementation cNFT TEP-? draft standart
- Install PostgreSQL and Go.
- Build sources
go mod download
to dowload dependenciesCGO_ENABLED=0 go build -o server cmd/server/main.go
CGO_ENABLED=0 go build -o ctl cmd/ctl/main.go
- Copy the following files to a directory:
server
binaryctl
binary- and copy environment file
cp .env.example .env
- Configure the
.env
file:- Set
POSTGRES_URI
to your database URI. - Set
PORT
to the desired port. - Generate and set
ADMIN_*
credentials. - Set
DEPTH
as needed (maximum items =2^DEPTH
, maxDEPTH
= 30). - Set
DATA_DIR
to the directory where small.json
files will be stored. - Set
TONCENTER_URI
, removingtestnet.
for mainnet deployment.
- Set
- Prepare an
owners.txt
file:- List item owner addresses, one per line.
- The first address gets item index 0, and so on.
- Initialize the database:
- Run
./ctl migrate
to create the necessary tables. - Run
./ctl add owners.txt
to add the addresses.
- Run
- Host your collection and item metadata:
- Follow the Token Data Standard.
- Use a consistent URI pattern for item metadata (e.g.,
base-uri/item-index.json
).
- Run
./server
:- Use a utility like screen to keep it running.
- Ensure the server port is publicly accessible.
- Rediscover items:
- Navigate to
/admin/rediscover
using yourADMIN_*
credentials. - Verify the appearance of
[DATA_DIR]/upd/1.json
.
- Navigate to
- Generate an update:
- Run
./ctl genupd [path-to-update-file] [collection-owner] [collection-meta] [item-meta-prefix] [royalty-base] [royalty-factor] [royalty-recipient] [api-uri-including-v1]
. - Replace placeholders with appropriate values, for example:
./ctl genupd
pwd/apidata/upd/1.json UQDSqdhnwMllRlp0EqB4asBQiGhNWNa-9S4hPSVONLfr0WF3 https://cubeworlds.club/api/nft/collection.json https://cubeworlds.club/api/nft/ 10 100 UQDSqdhnwMllRlp0EqB4asBQiGhNWNa-9S4hPSVONLfr0WF3 https://cubeworlds.club/cnfts/v1
- Run
- Invoke the
ton://
deeplink that appears. - Set the collection address:
- Navigate to
/admin/setaddr/[collection-address]
, using thecollection-address
from result of previous step.
- Navigate to
- Wait for a
committed state
message in theserver
logs. - Done.
- Prepare a
new-owners.txt
file:- List new owner addresses, starting from the next available index.
- Add new owners:
- Run
./ctl add new-owners.txt
.
- Run
- Rediscover items:
- Navigate to
[api-uri]/admin/rediscover
.
- Navigate to
- Locate the new update file:
- Find it under
[DATA_DIR]/upd
(e.g.,2.json
if the last update was1.json
).
- Find it under
- Generate an update:
- Run
./ctl genupd [path-to-update-file] [collection-address]
, where collection-address isEQAaSqEwAh00YOCc9ZwtqfNcXeehbl97yKQKCZPRGwCov51V
from creating steps.
- Run
- Invoke the
ton://
deeplink that appears. - Wait for a
committed state
message in theserver
logs. - Done.
Note: Avoid updating during high traffic periods to prevent invalid proofs. This may occur briefly when the on-chain transaction is processed but not yet detected by the API. Perform updates in large batches during low traffic times.