To see the explanation video (along with some gameplay to see how games run), watch this youtube video. IntroductionWhen it comes to playing video games, the best option is to play games on a desktop computer. When away from home, the next best options are usually using a laptop, playing on some handheld console, or to just use apps on mobile phones and tablets. However, with the Steam Link App and a little bit of creativity, we can play our PC (Steam) games from our phones, anywhere in the world. What Is The Steam Link App?
How Does The Steam Link [App] Work?We're going to go through a simple visualization to see how the Steam Link (or the Steam Link App) works. The concept is simple. You have a computer running your Steam game, the video/audio gets sent to your router, which is then sends the video/audio to your Android device with the Steam Link App. Once you see what's on the screen, then you can decide what to do (for example, run to the left), and so using your controller you can provide some input, which gets sent to the Android Device, then to the router, then back to your computer. All of this happens over wifi, on the same network. (Well, technically the controller input could be sent over Bluetooth.) The weakness of the Steam Link [App] is that you need to be on the same network as your computer to get the games to stream to your device. What if we want to play our games away from home? We can do that...using a VPN. Using A VPN To Pretend We're HomeBasically, what we need to do is trick the Steam Link App into thinking we're "home" (or wherever our computer with the Steam Games installed is). We'll do this using a VPN. (If you don't know what a VPN is, then read this blog post quickly. If you don't know how the internet works, then you can read this post. ) Hardware SetupThere are four hardware components that we need to make this work: 1. Computer with Steam + Games - We obviously need a desktop or laptop, hopefully with a nice graphics card and some good Steam games, to run our games on. 2. VPN - Some form of "computer" that we can route traffic through. This could be a simple raspberry pi, some software on your gaming desktop. In my case, I use an old laptop. (Note: you must be able to forward a port from your router to the VPN server.) 3. Android Device - An Android phone or tablet that has the Steam Link App installed on it. 4. [Bluetooth] Input Device - You need to move your character in the game, right? You'll need a Steam Controller, XBox/Playstation wireless controller, or a keyboard and mouse. Here's my personal setup: Of course, it's possible to buy some cheap versions of these items. VPN Flow DiagramAcquiring and setting the hardware up is actually pretty easy. (Well...setting up your own VPN server takes a bit of effort.) The magic behind why all of this works is what we're interested in, though. Let's look at a flow diagram for what's going on. So there are three "networks" this time:
The Video/Audio goes from: Our computer (which is running the game) -> To our home Router -> Somewhere in the Internet -> Back home to our Router -> To the VPN server -> Back to the Router -> Back to the Internet -> to the Public (library's) Router -> Finally to our Android device running the Steam Link App. The Input goes from: Our controller (through Bluetooth) -> Our Android Device (now everything is through wifi) -> To the Public (Library's) Router -> To the Internet -> To our Router at home -> To the VPN Server -> Back to our Router -> Back to the Internet -> Back to the Router -> Finally to our Computer running the game, where the input is executed. Does that all sound like a lot of steps? It is. This method adds a ton of latency to your gameplay, so it's probably a bad idea to play competitive games on your phone...but for single player games it's great. ConclusionWith a little bit of setup, we can play our Steam games anywhere in the world, right from our phone. The Steam Link App, with a few extra resources, is a useful tool. Make sure to follow on social media and like/subscribe/comment on the youtube video, and let me know if I should make a tutorial on setting up the VPN server. Like this content and want more? Feel free to look around and find another blog post that interests you. You can also contact me through one of the various social media channels.
Twitter: @srcmake Discord: srcmake#3644 Youtube: srcmake Twitch: www.twitch.tv/srcmake Github: srcmake
To watch the youtube video on this topic, click here.
Introduction - Hyperledger
Hyperledger projects are blockchain related tools built by the open source community and the Hyperledger organization. We've already done a blog post on Hyperledger Iroha, and now we're going to look at Hyperledger Fabric. If you're completely new to blockchain, then take a look at this blogpost on Blockchain Explained With 10 Simple Questions.
This blog post is going to introduce us to Hyperledger Fabric, and then we're going to install the Fabric prerequisite and template networks on our own computer. This will set us up to do more complex things with Fabric in the future, and even learn about Hyperledger Composer. What Is Hyperledger Fabric?
Here are some key points about Fabric:
This all sounds pretty good, so how do we actually use Fabric? In the next section, we'll go through the Getting Started tutorial for building our own Fabric network.
Hyperledger Fabric - Building Our First Network
We're going to build our first Fabric Network by following the official tutorial. However, we'll go over only the most important commands and we'll do the bare minimum to get Fabric working. You can read the official tutorial to see how everything works later.
I've tested these commands on Ubuntu 16.04. If you're using Windows or Mac, then you'll need to install Curl, Docker, Docker-compose, Go, Node and NPM, Python, and maybe a few environment variables on your own.
In your Ubuntu terminal, enter the following commands:
sudo apt-get install curl sudo apt-get install golang-go export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin sudo apt-get install nodejs sudo apt-get install npm sudo apt-get install python sudo apt-get install docker curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update apt-cache policy docker-ce sudo apt-get install -y docker-ce sudo apt-get install docker-compose sudo apt-get upgrade
With that, our environment is set up.
Next, we're going to download the samples of Fabric that have already been prepared to test it out. Enter the following two commands in your terminal. sudo curl -sSL https://goo.gl/6wtTN5 | sudo bash -s 1.1.0 sudo chmod 777 -R fabric-samples
So now we have the samples.
We're going to make sure that everything runs by running our first network. Change into the first-network directory and run the generate script that will create the certificates and keys for the entities that are going to exist on our blockchain. This will also create the genesis block (the first block on the blockchain), among other things. cd fabric-samples/first-network sudo ./byfn.sh generate Now bring the blockchain network up with the following command.
sudo ./byfn.sh up
If everything worked, then you successfully created your first Fabric network! Congratulations. Let's bring it down for now.
sudo ./byfn.sh down
Okay, so we know our computer can successfully use and deploy Hyperledger Fabric blockchain networks, but what now? Conclusion - Going Deeper
In this blog post, we talked about what Hyperledger Fabric is, we set up our computer to be able to deploy Fabric networks by installing the requirements and deploying the test fabric network. Now what? Now....there's a lot of reading that you have to do. First of all, read through the official tutorial to see what was actually going on in those scripts. Then, you can try to go through some of the other official tutorials.
But with this foundation set, we can learn more about Fabric by creating more blockchain networks that suit our needs, we can test deploying smart contracts to our Fabric blockchain, and we can even start learning about Hyperledger Composer now.
Like this content and want more? Feel free to look around and find another blog post that interests you. You can also contact me through one of the various social media channels.
Twitter: @srcmake Discord: srcmake#3644 Youtube: srcmake Twitch: www.twitch.tv/srcmake Github: srcmake
To watch the video where I go through this tutorial with you (recommended), click here.
Introduction - Ethereum Smart Contracts
In this tutorial, we'll look at the basics of creating ethereum smart contracts. We'll begin by installing the Ethereum Wallet (to interact with the Ethereum blockchain), then we'll look at a basic smart contract by having a small Hello World example. We'll finish with some references to the Solidity programming language.
Installing Ethereum Mist (Wallet)
So what is Ethereum Mist and how do we install it? Ethereum Mist is basically a tool we use to manage our ethereum wallets, our ether (money), and what we use to deploy our smart contracts and view transactions. It's basically a middleman for interacting with the Ethereum blockchain.
To install the Ethereum Wallet, click the Download button on Ethereum's homepage. Download the Ethereum Wallet installer appropriate for your machine. (I'll personally use the linux64.zip one for my Ubuntu 16.04 Virtual Machine.) Unzip the files, and inside there will be an executable file named "ethereumwallet". Run it, and you should see this:
Let's get started by testing it out.
Setting Up Our Ethereum Wallet (Switching Networks)
So we have our Ethereum Wallet installed, but how do we use it to develop smart contracts and send ether and mine and stuff?
The first thing we need to do is switch network's to a test network. (We're going to play around and develop here.) In the top-bar menu, click Develop -> Network -> Solo network.
Give Ethereum Wallet a second to switch over to the test network.
This will set us up on a solo network with an account that has infinite Ether. Great for testing.
If you want to use a real test network, then you can change the network to Rinkeby.
Setting Up Our Ethereum Wallet (Creating A Wallet)
If you do use a real testing network then you need to create an account/wallet. In the menu, go to File -> New account, and enter a password and press OK.
You should see a new account created. In a bit, you'll also see some blocks being downloaded onto your computer. That's the Rinkeby Network's ledger (literally the blockchain - chain of "blocks") being downloaded onto your computer.
Now the bad thing about using the test networks is that (I think) you need to wait for all of the blocks to download before being about to Mine (you can mine by Menu Bar -> Develop -> Start Mining), which takes a lot of time...and you need Ether to pay for gas money to deploy contracts...
So a solo network is better to start with. You can set up a test network overnight or something. You can play around with the buttons for now, but let's look at how to deploy a smart contract. Creating An Ethereum Smart Contract
Smart Contracts are literally just tiny programs (sets of rules) that get pushed onto the Ethereum Blockchain and get executed. Smart contracts are written using the Solidity Programming language.
Here's a very basic smart contract example written in solidity, which handles the creation and transferring of a custom token named "srcmakeToken".
You can read the comments in the code. The contract is basically:
Deploying Our Smart Contract To The Blockchain Using Mist
So how do we deploy this contract to the Ethereum Blockchain? We'll do it by using Ethereum Mist. Go to the Contracts tab and click Deploy Contract. Enter the solidity code from above. Press "Select Contract" on the right and choose srcmakeToken from the drop down menu.
Notice the Initial supply. Enter 200, meaning we'll start with 200 srcmakeTokens when our contract is deployed.
Scroll down and press Deploy. (The fee is 0 Ether if we're on the test network.) Hit the "Send Transaction "button on the pop-up window.
And it's that simple to send a transaction/smart contract to the Ethereum blockchain.
Our Contract is Deployed. How Do We Use It?
You should see, on the wallet tab, that our contract is deployed.
Now I'm gonna be super honest with you: it's a bit vague on how to get this to work, because it can easily get stuck at 0/12 confirmations. The tricks I use are to:
If it works then under the contracts tab you should see the contract deployed. You can select the contract and perform any of the functions the contract allows. (In our case, we only have a transfer function.)
And that's it. If you make more detailed contracts, then you can do more stuff. If you want to transfer tokens to someone, you see right in the picture that the UI makes it possible.
Solidity Tutorial
As we've seen, smart contracts are made using the Solidity programming language. Of course, to write smart contracts requires knowing the language syntax and keywords.
This page from learnxinyminutes for Solidity will help teach you a bit about how Solidity is used. Use it as a good introduction, but make sure to pay attention to the official Solidity documentation here. Conclusion
So this was an introduction to using Ethereum Mist's Wallets to manage our wallet and deploy Ethereum smart contracts. Of course, this was like a Hello World exercise. We can go much deeper with more sophisticated smart contracts and using Ethereum Mist Wallet to do other things, such as making full dApps.
Keep an eye out on my social media/youtube channels to see more advanced tutorials. (It's especially important to learn how to use security tools to keep your code and the user's involved safe.)
Like this content and want more? Feel free to look around and find another blog post that interests you. You can also contact me through one of the various social media channels.
Twitter: @srcmake Discord: srcmake#3644 Youtube: srcmake Twitch: www.twitch.tv/srcmake Github: srcmake
References:
1. Ethereum's home page. 2. Official Ethereum Token tutorial. 3. Learnxinyminutes Solidity tutorial. |
AuthorHi, I'm srcmake. I play video games and develop software. Pro-tip: Click the "DIRECTORY" button in the menu to find a list of blog posts.
License: All code and instructions are provided under the MIT License.
|