❮ BACK TO VIDEOS
Alejandro Banzas (IOV Labs),
[00:00:00] Alejandro Banzas: Hi, I'm Alenjandro Banzas, developer relations at IOV labs and we, the team, we create different initiative for developers to easily use of their technology with content tools and others. If you want to reach me and the team, shoot us an email to
email@example.com. Today, I'm going
to present an intro and quick start to RSK.
So let's start. This is our full technology stack, everything build it's on top of bitcoin, from RSK smart contract, which I will cover in detail later. And the RSK infrastructure framework to complete the stack needed to create a more fair and inclusive financial system. So let's jump into RSK.
RSK is RSK because of Bitcoin. Bitcoin is a store and offer of value. The blockchain is secure because miners with high infrastructure and energy cost create the new blocks to be added to the chain every 10 [00:01:00] minutes, the more hashing power they provide more secure than [unintelligible].
RSK is the first open source smart contract platform powered by the Bitcoin network. RSK goal is to add value and functionality to a Bitcoin ecosystem by enabling smart contracts, near instant payment and higher scalability. So how RSK is connected to Bitcoin? Well, first the Bitcoin ASIC minors.
Do what is also known as merge mining, securing both networks with the same infrastructure and energy consumption, but they create blocks for Bitcoin every 10 minutes, including transfer of Bitcoin from different addresses. And in the process they create new Bitcoins, six point 25 from now on with the halving. While forRSK, every 30 seconds.
They secure the execution of smart contracts without minting a new coin in the [00:02:00] process. So if you want to learn more about mining in, in details, check mining.rsk.co. The second point of contact is a bridge or two way peg. This component connect both networks to allow the transfer of a Bitcoin to RSK and allows developers to interact with smart contracts, paying gas with the same Bitcoin that's smart bitcoin to do so you send BTC or Bitcoin to a special address.
These Bitcoins send to this address are locked in the Bitcoin network then in the same address, but in RSK, the same Bitcoin is released to the users to use the RSK network. This is called pegging. So now you have this BTC called RBTC or smart Bitcoin in the RSK network to execute the smart contracts.
You can do the reverse operation called peg out, sending [00:03:00] your smart Bitcoins or RBTC to the bridge and receive your BTCs or Bitcoin back in the Bitcoin network. To learn more about the bridge, follow the link on screen. RSK has a node implemented in Java and allows with Linux, Mac, iOS, and windows users to install it.
The node implements the RSK virtual machine fully compatible with Ethereum virtual machine. In other words, your solidity smart contracts deployed in Ethereum can run seamlessly. In RSK. To communicate your applications with the RSK network, they node the implements, the same Ethereum standard, JSONRPC calls.
So as your contracts, your Ethereum decentralized applications can run. In RSK with minor changes to learn more about the node, install it, follow the link shown on screen. RSK has two networks, the main net [00:04:00] connected to Bitcoin where the production applications are connected. Paying with real bitcoin with real smart Bitcoin's execution.
At same time that testnet serves as a sandbox or testbed for your applications without the need to pay with real Bitcoin or real smart bitcoin execution of your test with the same environment that you will have in mainnet. By the time you go live. The last aspect I want to mention are tools or libraries.
we have an Explorer, both for Testnet and mainnet for testnet. We have a faucet to get our BTC for testing purposes. We have a gas station as well to show information regarding the gas. Price and how to operate within the network. and if, if you check these as late, you will see that some of the libraries and some of the tools are familiar.
If you're an Ethereum developer, such as truffle, such as Web 3, [unintelligible], [00:05:00] because RSK is compatible with Ethereum, JSON RPC calls and op codes in their RSK virtual machine. That's why you can use and leverage on all these tools, for Ethereum. So, Regarding wallets as well. We are integrated with nifty wallet, meta mask, my crypto, my ether wallet, and some others.
And we are working on different defi tools, to build your own applications, your own decentralized finance applications. And during the demo, I'm going to show some of the tools that are here on the screen. so let's talk about the demo. this is the agenda for what's next. We are going to understand what's this setup for the environment.
We are going to create our first wallet and fund it. we are going to deploy a smart contract using our, our RSK public nodes. we are going to create very fast and decentralized [00:06:00] applications, and then we're going to put all together, connecting the decentralized hub through the public node, to interact with the smart contract.
So now we are ready for the council that started.
Okay. As we saw before RSK needs gas to run or execute anything we want to execute. So to pay for gas, we'll need a wallet. So the wallet will be our interface with the blockchain. In this case, I'm using nifty wallet. Nifty wallet is very easy to use because it's pre-configure with different networks, including RSK mainnet.
And RSK Testnet. So let's talk about this wallet. I'm going to copy in the top side of the wallet, my address. as I mentioned before, I want to fund my wallet. So to fund the wallet, what I need is to go to the faucet. The [00:07:00] fosters is going to provide me best our BDCs. For testing it. So I'm going to base my address here, complete this challenge.
Because this is a transaction that happens in the blockchain. I need to wait. More or less 30 seconds that the block needs to be mine.Meanwhile,. I'm going to talk about nifty wallet, nifty it's it's a wallet that will hold your crypto, both in testnet and in maintnet, in different networks. and.
This extension adds functionality to your browser to communicate the website that we are going to be in a couple of minutes with the blockchain through their wallet. So these, this wallet is already connected with something that we call our public node. The public nodes are. nodes that RSK provides a [00:08:00] already synchronized, both for testnet and mainnet in order to start building your solutions without any need to, you know, wait for a node to, to be synchronized.
So the faucet now provides some, test RBTCs. So let's go and check what happened here. I receive a transaction from the faucet to my address and I receive 0.05. test RBTCs, and they can check it in the BestNet Explorer. So this is the Explorer. If you will go to home, you can check everything regarding the blocks, the transaction, the different addresses, the transaction pool, all the info that you may need, tokens.
And we have as well in statistics about the network. So if we want to check, these are great tools to consider while you're [00:09:00] testing and developing your applications. What is, what is this website? This website is the developer portal. All the information of our technology stack is here. So you can click and take a deep look at every element in our technology stack.
Okay. So now we have test RBTCS. we've seen how the network is working. This is for example, the Explorer for mainnet. I'm going to close this. This is a RSK gas station. You can check and compare, gas, the gas price, and some other operations regarding the gas comparing with Ethereum. So now we can open their, our wallet.
And check in our account that we now have 0.05 RBTCs. This is quite a lot if we compare these with the price of Bitcoin. so it's good [00:10:00] enough to, to develop and deploy a lot of contracts and do a lot of transactions.
So now that we have a test RBTCs in our wallet, it is time for us to start developing a, we have all the tools. We have a studio I'm going to cover that later. so we can use remix. They, this is an Ethereum tool. If your an Ethereum developer, you will be very familiar with this. We have to click in solidity.
and then the first operation that we'll do is create a new contract. Let's call it. register.saw. Dot Saw is the extension for solidity contracts. So let's base it here. Now the magic happen. We have a new smart contract. Let me talk a little bit about this. We have one variable called info and two functions, two methods, [00:11:00] two ways to interact with the contract.
Two ways because they are both public. The first one is set information, so we are going to put info in our variable. And the other one is just to rate. So now that we have a pretty cool smart contract, very simple one, let's compile it. We're going to compile it with the same solidity version, or if you want, you can use your own version.
Okay. Now we have compiled our smart contract. Let's deploy to a network. These remix, it's a browser tool that will connect our wallet with the block chain that we have selected, you know, in our wallet. So make sure that you selected the RSK Testnet for our operation with RSK. Now we have the solidity contract, let's deploy it.
Let's click on this icon in the left [00:12:00] navigation bar and select in the environment, injected web 3. Injected web three is the way for remix these tool to connect to the network through this wallet? So we have everything. Okay. So let's just deploy it. This will pop up our wallet. We can check the amount of gas that we are going to consume in this operation.
The gas price is already preset in 0.06. That is the RSK gas price. So let's just submit. That transaction this again, will take a few seconds. We can take a look at the Explorer and see what is happening here. We have a transaction. This is a contract deployment that is happening in their RSK Testnet blockchain right now.
if we go and make these presentation faster, just with it, click. [00:13:00] So, okay. Now the magic happens. We have a new smart contract deployed into RSK testnet remember the same tools, same solidity contract. so now we are ready to interact with this contract. Okay. To create the website that we mentioned before, we need to visual studio, visual studio is very well known.
IDE from Microsoft is allowed to develop different kinds of applications in our case, a website to start doing so, create an empty folder. I have one here called demo. Okay. Open the interface and open a new terminal. Oh. Using the menu on top with the new terminal let's first check our environment. By running some comments.
No that's dash version. This will pop up the version. If the version doesn't pop up, just go [00:14:00] to no JS, website and download all the tools that you need in your own laptop. Then MPN version check. If we have MPN again, if you don't have it go for MPN and installMPN in your machine. Okay. So now that we have MPN, let's go for MPN in it
and let's see initialize this folder. With our package, JSON file. These have some information regarding the LGS website that we are going to create. This is not part of the other demo. We are not teaching the LGS. so now we need to install some dependencies. That's face the common here let's install, express express is their web engine that we are going to use, with, with no.
And then let's [00:15:00] clear here let's install instead of express using the same common web three. And let's wait for a web three to two, be installed. Then added in our, in our project. The dependencies are now ready. So we are ready to start calling. That's create a few files.
The contract address is the one that we need to get from remix by the time that we, [00:16:00] create a new contract, something happened that I didn't mention is that the contract address habit happened to be here. So let's copy the value and let's go back to studio paste it here. This is the contract address that this code is going to interact with.
So we need the address in there in the RSK blockchain. And the other aspect is the ABI is giving the information, how to interact with this contract that is hashed inside the block, inside the blockchain. So we need these two pieces of information where to communicate and how let's create a server dot JS.
So let's type, no server dot JS. That's a file where they being forced specified. And so, okay. Let's get information. They should be empty because we need them set [00:17:00] any, any data yet. So let's say Bitcoin halving when we send information into the contract, this. A transaction is needed because we are changing the state of the contract.
That's why nifty is popping up our wallet to send the new information to the contract. So let's submit this. Let's wait for the network to. Do the operation. If we wait for 30 seconds, then the transaction will be included in the, in the blockchain. Okay. So these have change the variable that we have in our smart contracts.
So if we get the information we'll receive bitcoin halving and was suspected. So great. Now we have a website connected through the public node and nifty to our brand new smart contract. So [00:18:00] hope this easy.and easy demonstration of how the RSK networks, give you inspiration to work on your own applications.
So what's next? Go to the developer portal. Check the technology check all the tutorials and guides up. We have to help you building your apps. Sign up to our newsletter, check our webinar series and engage with the community. Go to gitter dot IM slash RSK smart and engaged with the great developer community that we have.
So thank you very much for watching call. We have a great bitcoin having and enjoy the rest of the sessions.