当前位置:网站首页>Nft智能合约发行,盲盒,公开发售技术实战--拼图篇
Nft智能合约发行,盲盒,公开发售技术实战--拼图篇
2022-07-06 07:53:00 【NFT践行者】
我们接着合约篇开始讲解拼图篇。
拼图篇需要实现的功能主要是两个:
- 如何快速制作多种拼图以及meta资料
- 如何上传ipfs星际网络系统(测试网络)
开始之前需要准备的物料清单如下
- OpenSea测试网络 https://testnets.opensea.io/
- HashLips 组图专案 GitHub - HashLips/hashlips_art_engine: HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.
- ipfs上传空间 Pinata | Your home for NFT media
实战步骤
1.从git上下载Hashlips项目

2. 在vs中打开项目程序,找到main.js中 将startCreating 方法中的343行改成 i =0;

3.cd到项目本地跟路径下,然后运行yarn install,进行安装相关包
4.相关包安装成功之后,输入yarn run build,进行项目本地构建。成功之后,如下:

这个时候会生成五张图片,打开项目图片生成的目录build,看到生成的对应五张图片

第一个红框是五张图片,第二张图片是五张图片对应的meta信息,打开会看到对应图片的属性和权重,同时在layers文件夹,会将图片分成很多层次的图层,进行随机拼接。



5.接着我们将config.js中如图所示的layerConfigurations数量改成10张,然后继续执行yarn run build 命令,成功执行之后,就会生成10张图片。



6.打开Pinata网站,将刚生成的10张图片上传上去。


成功后如下

7.紧接着打开代码,将绿色框中的文字替换成cid



8.更新成功之后,紧接着输入

成功之后,打开json中任意的文件,看到image中的地址替换成了刚才的CID

9.将Json文件夹继续整包上传上去


10 开始做盲盒图片,我们从layers中取出一个黑色背景图片作为盲盒的封面

11.然后新建一个unpack文件夹,将该图片命名为unpack.png图片,同时新建一个unpack.json文件,其内容如下。


红色框中是你刚刚上传图片的CID.

12.remix中找到红色框中的函数,然后将上图中的unpack.json的CID赋值,赋值到红色输入框中,同时前缀加上**ipfs://,**然后点击按钮。

13.在setBaseUrl中设置meta_jsons的CID,同时也加上前缀ipfs:// ,同时在后面追加/,因为meta_jsons中是一个集合,因此加上/ ,完成之后点击按钮即可。

等以上交易confirm之后,然后打开ipfs的测试网,这个时候,就会出现黑色的图片,其实就是盲盒的形态。

14.在红色框中的函数点击,就会开启盲盒功能,等交易完成,回到ipfs上,就会看到你刚刚抽到的盲盒的形态。


以上就是主流的Nft的盲盒的玩法,介绍给大家。
边栏推荐
- Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
- Helm install Minio
- Circuit breaker: use of hystrix
- CF1036C Classy Numbers 题解
- http缓存,强制缓存,协商缓存
- "Designer universe" APEC design +: the list of winners of the Paris Design Award in France was recently announced. The winners of "Changsha world center Damei mansion" were awarded by the national eco
- Type of data in energy dashboard
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- 二叉树创建 & 遍历
- Webrtc series-h.264 estimated bit rate calculation
猜你喜欢

Epoll and IO multiplexing of redis

Sharing of source code anti disclosure scheme under burning scenario

Linked list interview questions (Graphic explanation)
TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比

2.10transfrom attribute

23. Update data

解决方案:智慧工地智能巡檢方案視頻監控系統

In the era of digital economy, how to ensure security?

File upload of DVWA range

861. Score after flipping the matrix
随机推荐
"Designer universe" Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers | national economic and Informa
21. Delete data
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比
[dictionary tree] [trie] p3879 [tjoi2010] reading comprehension
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
Compliance and efficiency, accelerate the digital transformation of pharmaceutical enterprises, and create a new document resource center for pharmaceutical enterprises
Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data
MEX有关的学习
Notes on software development
C # create database connection object SQLite database
Position() function in XPath uses
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
Flash return file download
File upload of DVWA range
24. Query table data (basic)
649. Dota2 Senate
Yu Xia looks at win system kernel -- message mechanism
Is the super browser a fingerprint browser? How to choose a good super browser?
The difference between TS Gymnastics (cross operation) and interface inheritance
https://www.pinata.cloud/