Onboarding challenge from TON Foundation w/ Mark Okhman
Summary
TLDR在这段视频中,Mark 带领观众通过一个互动教程,体验在TON区块链上挖掘NFT的过程。他首先介绍了TON区块链的基本概念,包括主网和测试网的区别,并解释了测试网是开发者学习和实验的理想环境。接着,Mark详细演示了如何使用TON Keeper钱包在测试网上进行交互,包括安装钱包、启用测试模式、以及如何通过编写和发送智能合约来“挖掘”一个NFT。他还展示了如何构建和签署交易,以及如何通过扫描QR码来完成交易。最后,Mark鼓励观众通过实践来克服对编程的恐惧,并提供了额外的学习资源和社区支持,以帮助他们更深入地了解TON区块链和智能合约的开发。
Takeaways
- 🚀 **启动挑战**:Mark介绍了一个关于构建下一代十亿用户的挑战,鼓励观众开始在TON网络上编程。
- 👕 **口号与目标**:他穿着印有“为下一个十亿用户构建”的T恤,表明了视频和项目的目标。
- 📈 **TON的增长**:提到了TON价格的增长,并强调了为了跟上这种增长,需要快速发展和编程。
- 🛠️ **智能合约入门**:为不熟悉智能合约的观众提供了一个入门挑战,说明即使没有编写自己的智能合约,也有很多可以构建的东西。
- 🎓 **新手友好**:视频旨在帮助新手克服对编程智能合约的恐惧,并通过实际操作与智能合约交互。
- 📚 **教程与资源**:Mark提供了一个链接到他的Telegram频道,以便获取更多教程和文章。
- ⛏️ **NFT挖矿挑战**:介绍了一个关于在TON网络上“挖矿”NFT火箭的挑战,尽管TON实际上没有挖矿。
- 🤖 **测试网交互**:说明了将与TON的测试网进行交互,这是一个用于开发和测试的网络环境。
- 💻 **开发者环境设置**:介绍了如何设置本地开发环境,包括安装Git、Node.js和Visual Studio Code。
- 🔗 **API连接**:解释了如何连接到TON Center API,这是一个与区块链通信并提供数据的服务器。
- 🔑 **钱包和交易**:展示了如何使用TON Keeper钱包,并在测试网上启用测试模式,以及如何发送交易。
- 🔗 **构建消息和交易**:详细介绍了如何构建一个消息,将其转换为一个可以由钱包签名并发送到智能合约的交易。
- 🔍 **数据结构**:讨论了TON中的数据结构,特别是Cell的概念,以及如何使用TypeScript与之交互。
- 📝 **代码和交易**:通过实际代码示例,展示了如何编写与智能合约交互的代码,以及如何发送交易以获取NFT。
- 🔄 **测试网和主网**:阐明了测试网和主网的区别,以及为什么测试网是开发者学习和实验的理想场所。
- 🎉 **成功获取NFT**:Mark成功地通过一系列步骤在测试网上获取了一个NFT,展示了整个过程。
Q & A
马克在视频中提到了哪个平台的智能合约?
-马克在视频中提到了TON区块链的智能合约。
在TON区块链上进行挖矿需要什么条件?
-在TON区块链上进行挖矿需要一个钱包、一个代码库、开发者环境,并且需要通过提供工作证明(Proof of Work)给智能合约来获得TON币和NFT作为奖励。
什么是Testnet,它与Mainnet有何不同?
-Testnet是区块链的测试网络,它允许开发者在不涉及真实货币的情况下测试交易和智能合约。与Mainnet不同,Mainnet是实际的区块链网络,其上的交易和币值是真实的。
马克在视频中提到了哪些工具或应用?
-马克提到了Ton Keeper、Openmask、Node.js、VS Code等工具或应用。
在视频中,马克是如何解释智能合约的getter函数的?
-智能合约的getter函数是一种特殊的函数,它能够从智能合约的存储中返回特定的数据。在视频中,马克通过调用getter函数来获取挖矿数据,如工作证明的复杂度和最后成功的种子值。
如何理解视频中提到的'Proof of Work'?
-在视频中,'Proof of Work'指的是用户需要进行一些计算,找到一个小于特定复杂度值的哈希值。这个计算过程被视为工作证明,是用户获得NFT奖励的前提。
马克在视频中提到了如何获取Testnet上的TON币,这需要哪些步骤?
-马克提到,为了在Testnet上进行交易,用户需要获取Testnet上的TON币。这通常涉及访问特定的Testnet币保地址,按照提供的步骤获取免费的测试币。
在视频中,马克解释了如何构建一个支付链接,这个链接是用于什么目的?
-在视频中,马克解释了如何构建一个支付链接,这个链接用于将用户找到的有效哈希值发送到智能合约,并以此来证明工作量,从而获得NFT。
马克在视频中提到了哪些关于智能合约编程的语言?
-马克提到了TypeScript和Fift(Fancy的简称),这两种语言在智能合约编程中使用。
在视频中,马克是如何描述智能合约和TypeScript之间的关系的?
-马克用火箭将卫星送入轨道的比喻来描述智能合约和TypeScript之间的关系。TypeScript像是将智能合约这个“卫星”送入区块链网络“轨道”的“火箭”,一旦智能合约在区块链上部署,TypeScript就不再需要了。
马克在视频中提到了哪些关于TON区块链的资源或链接?
-马克提到了TON的文档网站、他的Telegram频道以及他的YouTube频道,这些都是学习TON区块链和智能合约编程的资源。
Outlines
🚀 欢迎来到频道并介绍智能合约挑战
Mark欢迎观众来到他的频道,并介绍了他们将要进行的智能合约挑战。他提到了为未来十亿用户构建应用程序的目标,并展示了一个代表TON区块链上周价格的火箭。Mark鼓励初学者开始编程,并介绍了如何在不编写自己的智能合约的情况下与智能合约进行交互。他还提到了一个链接,观众可以通过该链接加入他的Telegram频道以获取更多教程和文章。
📚 设置开发环境并了解智能合约
Mark指导观众如何设置本地开发环境,包括安装Git、Node.js和VS Code。他展示了如何克隆GitHub仓库并安装所需的软件包。Mark解释了如何连接到TON Center API,这是一个与区块链通信并提供数据的服务器。他还介绍了如何使用智能合约的getter函数来获取特定数据,如工作量证明的复杂性和种子值。
🔗 连接到智能合约并准备数据
Mark解释了如何连接到智能合约并获取挖掘所需的信息。他展示了如何使用API读取数据,以及如何编写代码来计算哈希值,这是挖掘过程中的关键步骤。他还讨论了如何构建一个消息并将其发送回智能合约,以及如何使用测试网(testnet)进行开发和学习。
🤖 使用TypeScript和智能合约进行交互
Mark讨论了如何使用TypeScript与智能合约进行交互。他展示了如何创建一个函数来解析和准备挖掘消息,以及如何使用while循环来计算哈希值,直到找到满足条件的哈希。他还提到了如何使用Unix时间戳和数据来构建挖掘消息,并强调了在找到合适的哈希后需要快速发送交易的重要性。
💰 构建支付链接并发送交易
Mark指导观众如何构建支付链接,这是发送消息到智能合约并接收NFT所必需的。他解释了如何在TON中将货币转换为Nano单位,并如何创建一个包含所需信息的交易体。他还讨论了如何生成一个QR码,以便使用TON Keeper钱包扫描并签署交易。
🔗 扫描QR码并签署交易
Mark展示了如何扫描QR码并使用TON Keeper钱包签署交易。他强调了非托管钱包的重要性,因为它们允许用户完全控制自己的私钥和交易。他还提到了如何将已签名的交易发送到测试网的后端,并在验证后将其推送到区块链上。
🚀 成功获取NFT并探索更多
Mark确认了NFT的成功获取,并展示了如何在testnet上查看交易。他提到了如何获取测试网的TON币,这是进行交易所必需的。Mark还提到了他计划录制关于如何在testnet上出售NFT的另一个视频,并鼓励观众阅读智能合约的代码以更好地理解整个过程。
📝 深入理解智能合约和TON编程
Mark深入探讨了智能合约的概念和TON编程的复杂性。他解释了如何使用TypeScript编写代码,这些代码最终会被转换并发送到TON虚拟机(TVM)。他还讨论了如何构建一个单元(cell),这是一个在TON中用于存储数据的数据结构。Mark鼓励观众耐心学习,并提供了更多资源和社区支持,以帮助他们克服学习过程中的挑战。
🎉 总结并鼓励观众继续学习
Mark总结了视频内容,并鼓励观众继续学习和探索TON编程。他提供了对未来教程和办公时间的预告,并鼓励观众加入开发者社区,提出问题并寻求帮助。Mark表达了对观众成功的祝愿,并期待在下一个视频中再次见到他们。
Mindmap
Keywords
💡智能合约
💡测试网
💡工作量证明(Proof of Work)
💡非同质化代币(NFT)
💡TON区块链
💡TON Keeper
💡数据结构(Cell)
💡交易构建器(Transaction Builder)
💡TypeScript
💡QR码
💡TON区块链浏览器
Highlights
马克介绍了如何为下一个十亿用户构建应用程序,以及如何通过编程参与智能合约。
即使对智能合约不熟悉,也有很多无需编写智能合约即可构建的内容。
介绍了如何通过测试网与智能合约交互,以及测试网与主网的区别。
解释了如何在测试网上进行NFT挖掘,尽管在TON中实际上没有挖掘过程。
展示了如何使用TON Keeper钱包,并在测试模式下进行操作。
提供了一个预先构建的代码库,用于开始智能合约的交互。
详细说明了如何通过TON Center API获取挖掘数据。
介绍了如何计算哈希值并找到满足特定条件的哈希以进行NFT挖掘。
展示了如何构建和发送包含必要数据的消息到智能合约以获取NFT。
解释了为什么每个消息在TON中都是一笔交易,并且需要支付一定的费用。
讨论了如何准备和发送交易,包括如何生成QR码以在TON Keeper钱包中签名。
强调了在测试网上进行操作的重要性,以便开发者可以在没有风险的环境中学习和实验。
提供了如何获取测试网TON币的指南,以便用户可以在测试网上进行交易。
展示了如何在测试网上成功挖掘并获取NFT的整个过程。
讨论了智能合约的工作原理,以及如何在TON中构建和部署智能合约。
解释了TON中的单元(Cell)数据结构,以及它是如何在交易中使用的。
强调了学习TON编程的重要性,并鼓励观众通过实践来提高他们的技能。
提供了额外的学习资源和社区支持,以帮助开发者在TON平台上取得成功。
Transcripts
foreign
what's up guys my name is Mark welcome
to my channel if you're wondering what
we are doing here it's we are building
for the next billion users just like my
t-shirt States
so
um you can see right now behind my back
the onboarding challenge and there's a
rocket and this is nothing else but
representation of tons price last week
and because we have to keep up we have
to grow as fast as Tom grows we have to
start if you didn't start yet start
programming on top so today's challenge
is going to be for those who were afraid
a little bit of smart contracts and
everything but there is a plenty of
things you could build without touching
smart contract and uh I mean not to
touching but without building and
programming your own smart contract so
for those who are new this is going to
be perfect to get your first like
Hands-On uh interacting with smart
contracts
but
um for those who want to dig deeper
there's going to be also a small part at
the end maybe if you don't want to go
through the whole like step-by-step
tutorial you could just jump uh to the
part where we are digging a little bit
deeper on the on how commands of uh
smart contracts work
but uh I very much hope that a person
who was a little bit afraid of starting
programming for Tong now is going to get
his answers so you guys gonna see how
I'm doing some stuff step by step and I
hope this is going to encourage you to
start programming so before we start if
you don't mind please like And subscribe
and also there's a description and then
description there's a link to my
telegram channel so if you want to get
more tutorials if you want to learn more
stuff sometimes some articles just
follow there you're gonna stay tuned so
let's get to the actual business
let's
um
see what we got here so this onboarding
challenge is stating that we will mine
an nft rocket
it's first miners on tone you'll go
through proof of work smart contract and
final minus secret reward
disclaimer there's no mining in tone
there was some and if you want you can
actually go and read more about this
it's like story history of mining on
tone so basically long story short
um mining on tone was kind of like a
replacement for an Ico so uh you had to
provide some proof of work to the smart
contract Anton and then you will be
receiving the tons and the very first
mining actually was on testnet and we
are going to interact with testnet what
is testnet I will just quickly
um
overview that so testnet like the
mainnet this is a
antonyms like Main and test so mainnet
is a network of nodes that are actually
syncing with each other sending each
other transactions and they're actually
validating each transaction that comes
into this net Network and uh so mainnet
coins are actually worth of money tall
but there's also test net and on testnet
there's also test coins and there are
test smart contracts so this is a
perfect place for developers to play
around to fail to learn and we are going
to interact with testnet and so as the
creator of this uh
challenge States we are going to get an
nft
on testnet on the address that we will
use to interact with some specific smart
contract so basically let's go step by
step so mining yeah we got it there was
no mining but we are going to do some
computations today provides a proof of
work to some smart contract that is
already deployed on testnet and we are
going to receive an nft as a reward from
this computations that we did so
technically this is kind of mining so
let's go for it so what we will need we
need a wallet we need repository we need
developer environment so
I hope you do have a wallet you got to
install one of the apps that are
suggested so it's either tone keeper to
on HUB or maybe other non-custodial
wallets I use for programming I use
openmask but today I'm going to be using
tone keeper as it suggests in this
article
so we will have to install tone keeper
then we have to enable test mode in tone
keeper so I hope you you are able to
deal with that so please follow this
link
and enable the test mode on your tone
keeper and project setup so we are going
to start with some pre-built code let's
see what it is
alrighty so
mining process it explains us which
comments this smart contract understands
okay so basically this is a source code
of some smart contract that is already
deployed in testnet and we are going to
know the address of that smart contract
I believe
so um we'll just create create a new
repository out of it
we will call it
um
tone on boarding
challenge
why not that simple
and uh yes it is getting cloned
actually I would have to also clone with
my machine
let's see what it states development
environment so there's Cloud versus
local
um I'm gonna go with local if you don't
feel confident you can do it on cloud
but
my dream is that you personally would
start programming on ton and that's why
if you now go step by step with me then
there's a big chance you're gonna get
back to it again so that's why I'm not
gonna go with local with Cloud I'm gonna
go with local environment and
um don't worry if if something doesn't
work you can Outreach to me personally
and I will help you okay so
we're skipping this part with Cloud
space the local environment so we'll
need git node.js JavaScript idea I
already have git installed if you don't
just follow this link I already have
node.js installed if you don't also
follow this link and I I'm using vs code
as a ede so I recommend it you can also
use it so we'll have to go on this
GitHub repository and open it so
um I'm going to
yeah I'm in my repository so I'm going
to git clone
Repository
and then get into it
and do yarn so we basically have to
install all the packages that are
offered to us so fancy compiler working
with big numbers generating QR code the
main tone library to interact with data
that is consumed from the tone
blockchain
contract executor you're kind of
emulating the process of TVM we're not
going to touch that probably in this
lesson but uh yeah in the typescript of
course awesome
so connect to tone so basically
the flow is going to be as followed so
we are going to connect to a Smart
contract so smart contract is has
certain data has a certain state of the
data and we're going to connect with it
get some information for mining like
complexity and some values that we have
to work with in order to mine a hash
that would be less than complexity or
bigger than complexity we'll check it
out
and then once we are once we got
something that is bigger than complexity
we are going to compose a message and
send this message back into the smart
contract so
when we are trying to read data we are
using API so it's not API of the actual
blockchain it is like some server that
is hosting a light node
probably so light node is something like
a node it's also a part of the network
but it's not validating the transactions
that are happening there it's like kind
of syncing with uh with the blockchain
it might be not the light node it
depends on the server actually so it
just syncs with the blockchain and this
server is able to read data and give us
the
um answers to http requests through like
RPC
so uh basically to read that we will
just need API to write it there we would
need to send a transaction directly into
the tone blockchain so that's why first
step we read then we are doing mining
some kind of computations and then we're
using we composing a message and we send
it into the blockchain
so uh I forgot the best part we get an
nft afterwards so
um there is smart contract addresses
that we need okay we need to add to
addresses to to The Miner wallet address
collection address
great copy the address on get gems
get gems
yeah here's a test net of get gems and
someone already got an nft wow
I hope you're going to be the second
ones cool so we need to copy the smart
contract address I think this is the
address of collection
yes
I'm going to copy it
but actually first I would want to copy
that code so the
the guys who created this challenge for
us the already pre-composed some code
for us so what does this code do we
basically import the address class from
tone
address class is going to help us to
interact with data that is tone related
so your wallet address so here you have
to put the address of your tone keeper
wallet on testnet this is mine
you can send some testing coins there if
you want to greet me so
um this is my wallet and then the
collection
The Collection that's exactly this one
address
great so we almost finished the first
step
cheers
why do we need this function so
basically later on we are going to have
some async
functions that are going to be running
that's why we are first announcing this
we're defining this function and then we
run it because it's async we don't care
when it's going to end it's going to end
uh
in certain order finish its steps and we
don't want to to get stuck on that so
why do we need parts addresses yeah so
here you understand that we are going to
get a user friendly form
uh
Yeah we actually parse and address and
then we are going to have different
representations of an address that might
be useful in the process
so we connect to API provider
so we're going to connect to tone Center
API this is one of the providers so as I
explained they are hosting a server that
is talking to blockchain and the server
is answering us with data
and uh
here it's asking us for an API key so
probably now in the corner of the video
you're gonna see a video on my channel
there's gonna be a link to a video on my
channel where I explain how to host own
API that you like you could host own API
that would
um
not require you to use an API key
so
uh but here we are going to probably
just use
um this we're going to probably uh just
use this one also it's like
it allows you to do 10 requests per
second I think it's more than enough for
us now but again as I said if you don't
want this limitation you can just go uh
to this video that I pointed out and you
can spin up your own API instance
and start working with it
so first we need to get mining data from
tone what kind of data are we going to
get so get mining data
and this is the first thing that you
will learn about smart contracts so
smart contracts have a getter function
so basically there's a getter function
that will return some specific data that
is written in storage of of the
available to Smart contract memory so we
are going to get proof of work
complexity we are going to get lost
success seed Target delta mean CPL Max
CPL those three we are not gonna need
and how to run a method to any smart
contract great so we're going to copy
that code
we're going to copy that code
but also here we had to define the
client
foreign
yes
so we had to import the stone client
from tone
and we're going to just do it without
the tone API key mining data so
basically we established a client
of connection to this RPC to this server
and we are
calling them the method called get
method
we set the address
like from which I just want to call this
get method and here we get get mining
data this is the name of the getter
method
and let's consult what it's going to
tell us
test node
index.s
exactly this is what we wanted to get
how much gas was used
and the stack
so here in in this article you can see
some cool data about how to
oh you could actually do just npm start
npm Run start
but let's see what was the function
exactly it is not index TS
so we get the same data great so we
don't get this data at the moment we
don't understand what exactly they mean
but
um if you want to learn about gas
here you can read the few articles but
basically it's not free to move things
around on the blockchain you have to pay
for each transaction even on tone even a
smart contract has to kind of pay a rent
for uh consuming the memory for storing
the data on the blockchain so
um if you want to learn more about it
you can go to those links but we want to
mine an nft today right so we have to
import a library that would help us to
interact with big numbers because those
are big numbers
so we're going to parse
stake now
so we don't need to consol that log
anymore
parse Tech num Okay so
uh mining data
okay so basically here we create a
function into which we pass
some part of the stack
we create a big number instance
and we convert it so let's just do this
copy
so we saved it and let's run our
function again
awesome so now we at least see
what kind of a big number that is this
is complexity and last success this is
timestamp so this is a seed
this phrase is going to be used by US
for mining a hash
okay
as you can see mining data is like hex
numbers exactly
um that's exactly what we saw so we are
doing good so complexity is the most
important number for me minor
um and
seed is another one it's a unique value
generated by smart contracts to
calculate a hash
great
so we need to prepare an nft mentor
we need to prepare a mining message
this message as I told you before you
are going to send once the once you find
the proper uh hash so
uh we need to import Unix now to work
with
data stamps
okay
we are importing that thing
so
basically
the transaction Builder is already built
for us
and uh
let's do it that way so if you really
want to understand how this message was
built I'm going to answer that at the
end so we are going to run here at to do
what we need to do at the end so
uh
first
how does the query
is mine
is composing a message
so um
what are the
au pair
yes
and data 2.
Okay so
we need to do nft minor so message we
can post the message and finally it's
the this article States finally a minor
because actually now now we are going to
start calculating hash so
so we compose the message and we are
going to actually get a hash from
message so we first compose a message
with
um our wallet with data one for now it's
going to be just a zero in BN format and
the seed so the seed we received from
the get mining data so yeah everything
is going on the plan so we get mining
data we get a seed
we compose a message with with help of
this seed
and now we are going to
set a while so while the the hash from
the message the big number
representation is not greater than
complexity Yeah so basically as I said
while it's not greater
we're going to keep the the thing doing
so we are doing
mind params okay so
this one
is our object that we then pass into the
Mind function
and we will need to set the expire
okay we get you we need actually Unix
now to get the timestamp of the current
moment
data one so we have to just this is a
big number way to add one
to increment it by one then we again
compose a message with help of the
queries mine we can pause this message
and once the message is going like this
hash is going to be greater than
complexity then we're actually going to
send this message so
all right so we are offered to put some
beauty in here
all right let's let's do it because we
already understand how how the code
works
let's replace it with this more
beautiful version of code great
uh
did anything change actually no we just
changed so you see the main principles
are working the same so we just changed
the link so the incrementer is a
progress then we clear the uh the
console then we're writing some message
yeah this is just a better user
experience but again
this is
[Music]
um
so it also shows the last hash that we
calculated
so it's kind of it's kind of
more beautiful I would say great we're
gonna see soon how it works okay let's
go for it
you can do yarn starts
okay so what just happened
mining started please wait for 30 60
seconds to mine your nft
we mind
863 hashes and the last one is this one
Mission completed message hash is less
than complexity found okay so we needed
to actually find one that is less than
proof of work complexity great we got
the message hash we got the complexity
it is smaller in the big number
representation of course so we are done
this is great so now we need to send
this to Smart contracts so we need to
prove that so now we have proof of work
so basically we did some computations
and this is our this hash this is our
proof of work we found it and we are
going to send it into the
um smart contract that is supposed to
check it and give us an nft if we are
actually right on that
great let's
let's see how we build a payment link
what is the payment link
payment URL okay I think I will open you
a little secret here so
um
in tone every message it is a payment so
you would have to send messages so
you're sending message with some value
with some coins and then you also attach
some data in a certain order and if you
want to dig deeper into the order that
you attach data to a message in stay
tuned we're going to talk about this at
the end when we're talking about how to
how this message is composed under the
who so
every message is a payment so that's why
it says build a payment link and what
we're going to do we are going to
package a transaction
and then with our wallet why we need the
wallet we are going to sign this
transaction of sending
some some money and our information
we're going to send it to the address of
smart contract which this collection
which holds this collection of nfts that
we we will get from the uh from this
getjams collection
uh no good gems actually it's for
everyone it's just listed on the gems I
want to be very specific on that on uh
pretty much on everything so uh
great so now we are going to uh
we are going to copy that code and see
what exactly
happens there
nice so just so you understand at this
moment we already found the hash so
message we already found the math we
basically composed the message which
hash is good enough to get this nft we
have a proof of work so as soon as you
find the hash you should quickly ma make
a transaction okay if someone else makes
a transaction the C changes and you have
to find a hash again okay so basically
once we make this transaction we send
this newly found hash we send it and we
get the nft the seed is going to change
inside of the smart contract and when
someone else is running the first step
and getting this
get data from the smart contract it will
get a different seeds so if and and also
once we if we got the old one and we
send our transaction with uh with a hash
that was calculated with the old seed
it's not going to get confirmed because
there's also check on the smart contract
side so
this is good for understanding
great to Nano needs to be imported from
tone
this is basically we so One Tone
consists of the
one and and nine zeros amount of Nanos
inside of the tone so basically if we
want to say
0.05 tons this is actually we need to
transform it to Nana because all the
calculations when the programming are
going in Nanos so we need to transform
this into Nano and Nano is a big number
of course because it's like nine zeros
wow I wish my celery had not zeros
in some countries it would it would
so we prepare body cell
okay message to b o c body cell
to string
okay it's getting interesting here
and then we do a link we create a link
for the transfer and
we are transferred to some address with
certain amount
and being been
where do we get bin from
okay Bean is just a part of the URL body
so great
we basically have to create a body cell
and uh
in a certain format
put it on the URL and we get a link
so basically
let me let me run that thing
so basically uh
okay okay two sometime and here we have
this link
okay I yeah here we have the address
this is the address of collection
here we have the amount so we give some
well where we set the amount where do we
pack the message
we pack the message
okay
I want to see where we set the amount
yeah here we set amount to send
we sent just enough money to deliver
that message to the smart contract and
the smart contract is going to
so basically the network is going to eat
part of that payment that we send and
then we're going to get it back so
because like Fair smart contracts they
do it like they require you to put
enough money so the transaction would be
delivered you can actually put as much
money as you want but they will return
you everything that was not used for the
transaction so basically you provide
them money that would be enough for the
Sending message delivering it to a Smart
contract and then getting it back to
getting if getting the nft actually back
if the smart contract would also want to
charge you for getting this nft then
they would also require you to send much
more money and return you everything
that was left after getting the price of
nft
payment one way and then they would just
send it back probably with forcing you
to pay for the last transaction but if
you stay long enough if you subscribe to
my channel you will learn more of these
Concepts soon but today we actually want
to understand
body cell okay let's talk about this at
the end
what
in the world
is a boc co-pilot is is good at hinting
on these things so
let's go for it and uh this is a link to
transaction that we need to actually
sign
convert link to smartphone great so
it is we have to generate some QR code
so I I would I would be able to kind of
scan it with my tone keeper and sign
this transaction with my coins that I
have on my testnet wallet so uh I will
do yarn add
QR code terminal
and uh here I would have to
kind of import it
okay
and I would have to generate a QR code
even better
so this all has have to still be
I'm not gonna console it yeah and this
I'm gonna console
great so I'm going to do yarn
start
sometimes it takes time you see this is
that's why it's called proof of work
alrighty and now I have a QR code that I
could actually scan while it's in test
net mode and I would sign a transaction
so before I scan it and I sign the
transaction on my device because
quick and quick and bad so why it's
non-custodial wallet because your seed
phrase that you use to generate the
disconnect with your private key and
you're using it to sign every
transaction it's only on your device
that's why your phones are secured no
one can write a transaction to a network
on your behalf so basically you are
signing every transaction on your wallet
and then you send the result like the
signed transaction you send it to the
back end of testnet of the tone keeper
and uh this transaction is pushed to
closest validator and it's actually
after it's validated that actually you
signed that transaction
so it gets on the blockchain no one can
sign transaction but you tomkeeper
doesn't know your seed phrase and that's
why we we could compose the whole
transaction here but once we scan a QR
code you could see that in this URL
there is a string representation of this
uh cell that like oh there is a string
representation of a cell that stores a
message that we want to actually send to
the smart contract that is going to give
us nft great
um
so what I'm gonna do is now I'm going to
scan this
I'm going to scan this QR code I'm
actually getting a little bit excited
about that
all right so
let's see
okay
if you want to see exactly what happens
on my screen you should actually go and
try to
follow these actions all right so
I sent let's I will show you another
secret so
there is a test net tonescan.org
and this is a Explorer we can see
everything that happens on the
blockchain with that if you remember I
have put my address here this is my
wallet address
and we can see if there was any
yes I actually got two coins and we kind
of missed that part
we missed that part where you were
actually supposed to go and get the test
net coins because you wouldn't be able
to sign a transaction
unless you have a test net coins
um
prepare
test net coins we didn't get any test
net coins let's fix it quickly so you
need to uh
go to
file set
yes this is a test net coins file set
and here follow the steps how to get
these test coins on it's free it's
completely free as I said this is
testnet it's this money is like Monopoly
money it's you can play around with it
and not tone tone is not Monopoly money
and
once you get these test net coins you
would be able to sign transactions just
like I did so I did a transaction
I did a transaction uh one minute ago
and it actually went well
yeah so I probably cannot see the
in this Explorer I cannot see the data
that was sent
yeah I could see a hash
and I could see operation just a small
phone
okay it's not it's not that thing
so uh
oh wait actually
yeah that's that was the fun that I
wanted to show you like this is
Operation so operation is mine so we
actually send the separation that we
want to mine it and um great
uh let me get back to what got here so
we signed the transaction
we sent it
and we got back nothing empty how do we
check that things worked out
we need to get the address and go to get
gems
oh
we need to go to actual
uh okay I just wanted to see the URL
structure so I want to see to go like to
okay so you can see this is my address
and I just got an nft
I just got an nft this works this works
and this rocket is US flying to the moon
right now
so
guys I'm going to sell that nft on the
test net
but I'm going to record another video
about that how to sell your nfts and
let's play around on testnet but this is
number two and everyone should know that
it's mine I'm going to make an offer so
if someone wants to get it for 100
it's going to be
let's do four in two weeks
oh 100 tone I'm gonna sell this nft okay
it's asking me to connect wallet I'm not
gonna do it right now
so basically it worked it worked we got
an nft on this address
so this nft
actually came
with this transaction so we send
something out
and we actually got
nft back
which is great we got no money in return
actually
I'm not sure why
we could read the the code of the smart
contract
so we only use this index file
we coded repeated step by step
everything and we got an nft
we still didn't write any smart
contracts but as I promised
we are going to go through two very
important things now
as you could remember
we have
yes we have tried
uh
let me find it the body cell the message
body cell
yeah and here we are actually composing
it amount to sand
collection address where is the message
we're composing yeah queries dot Mine
and queries so the only two things we
don't know how they work is mind message
params and this is just a type so just a
type that tells us
what is the data that we're going to
read from the smart contract so and this
is queries so there's like all possible
queries that this smart contract
understands
and uh it actually you see this method
like queries mine it gets params that
are like mind message params and it
returns a cell because cell is a this is
something that you will understand you
will have to understand and I've seen
here a little bit of a description maybe
a link for you to to get more about it
it is uh
yes I've seen this notice here
what is this cell what the cell yeah so
cell is a data structure in tone and uh
so basically cell is a cell of memory so
in the TVM there is a lot of cells that
are storing something and uh once we
send a message and this message is
accepted by TVM its contents are kind of
saved to the cell so we are composing
that cell on our side and then once it
gets to the TVM it actually gets into
the gets into the self
so uh we want to understand how this
cell was constructed how how in the
world we get this data
and
at the end you can see here we get a
cell so let's get into it
so we have a mine function okay so and
here begins interesting part where we
actually work with the
Concepts entities of actual tone before
it was just node.js through API we're
getting getter method we understood what
a smart contract but here we actually
here's the hard part the one that you
will actually have to learn and for that
I'm going to record some more videos and
I already have some on my channel but
here with help of a typescript we are
composing a concept of cell they're
going to then package and send it into
the TVM so we begin sell
and then we write a code operation code
which is my you see like if we go into
what what it is
this is exactly what we got here on the
test net
you see like this is the operation code
so we told so we send some money to a
Smart contract and we said the operation
that you need to to perform now is this
this hexa code
then we write the expire
okay
then we write so we basically in this
cell we are kind of putting like imagine
a box and you are putting the chocolate
bars into it so the first chocolate bar
was milka the second one was also milka
so basically this is a you in so we
Define how much space it's going to take
so we Define what kind of stuff is
written there how much space it's going
to take in bytes then again what kind of
stuff is going to be you int how much
space then we say it's going to be
address and here we pass mint2 let's see
what kind of mint 2 we are providing
here mind params this means to wallet so
we we pass our address that we actually
defined here
and uh
we put this address already into the
cell so in this box with chocolate bars
and then we write more units more units
we say how much it's gonna space gonna
take and uh then we just and sell and we
return it so
basically
queries mine is just composing a cell
with all the necessary data
and
then it helps us and it we send this
cell into the smart contract so
my you might be kind of uh a little bit
confused like we're programming with
tone here's typescript some hexadecimal
numbers and I want to just encourage you
stay very patient about that because
you're going to
encounter at least two programming
languages while working with tone
programming this is typescript
Javascript and fancy at least hopefully
I pray God and I hope that once you're
watching this video
you're already able to write smart
contracts intact that's some language
that is not yet working but fancy this
is something that
you are going to use so I I like the I
like to use the allegory that uh smart
contract itself is like a satellite so
and the satellite is brought to the to
the space where it goes around the globe
it's brought there with rockets so
typescript is kind of a rockets that are
bringing the satellite to the orbit to
go around the globe
and at some point they fall off so we
don't need type script on the TVM at all
because TVM has no idea what is
typescript and uh that's why because the
the the data that we're sending or the
smart contract itself when we deploying
it
uh because uh it is going to be run on
the machines on the network of machines
we have to keep the low context so
that's why you will have to deal with
bytes you will have to deal with Stacks
you will have to plan how you're using
your memory like how you're packing this
cell so the smart contract would
actually understand it and would know
what to do with this data and how to
read it and unpack it stuff so
um I think this was a very useful video
when you first encountered like the
beginning of it like at the beginning
the first concepts of something you
could get at nft so you understand
you're not that scared of tone anymore
and that means that now you're ready to
go to the
document documentation website and just
uh read getting started maybe who knows
maybe soon you'll write your first smart
contract if you're not sure about that
and you want to watch more videos you
you know like there is more on my
channel and uh I'm doing office hours
um I'm trying to do it as often as
possible so
um you will see it on my channel as well
so I would be very happy to maybe Mentor
you or guide you through some issues
that you're going to encounter but in
general I think this was a good start
for you and I wish you a very good luck
I hope you're going to build a very
awesome product Anton I really hope on
that and uh
we all together are going to help you
don't worry there is a chat that is like
uh for a lot of developers you can ask
smart questions and also you can ask
their dumb questions my favorite ones
because 99 of mine are dumb and uh I
encourage you to go there I encourage
you to try it fall if you didn't do any
steps right now while I was
showing that to you please do it will
take you so how much 20 minutes and um
you get your nft on the stand but you
also get your hands on actual coding so
um I hope you succeed man I hope you
succeed and you will so thank you very
much it was amazing time with you and uh
I hope to see you soon ciao
Browse More Related Video
![](https://i.ytimg.com/vi/_BxAQBjsGZk/hq720.jpg)
【工具箱】擼空投白嫖了一套房?!新手必看,快上車!全網最詳細梳理#空投 #arbitrum
![](https://i.ytimg.com/vi/9QciOgymGso/hq720.jpg)
macOS Menu Bar App (Code Along) | SwiftUI, Xcode
![](https://i.ytimg.com/vi/qNOVlo4lKJw/hq720.jpg?v=65983a85)
A1 TOURING 2024 NUEVO CIRCUITO OFICIAL RUTA B [EXPLICADO AL DETALLE]
![](https://i.ytimg.com/vi/O753uuutqH8/hq720.jpg)
Software Engineering: Crash Course Computer Science #16
![](https://i.ytimg.com/vi/guvsH5OFizE/hq720.jpg)
The World Wide Web: Crash Course Computer Science #30
![](https://i.ytimg.com/vi/E9lxz6H-m54/hq720.jpg)
Ultimate SMART MONEY CONCEPTS Trading Course (EXPERT INSTANTLY)
5.0 / 5 (0 votes)