체크포인트
Create a virtual machine using the Google Cloud Console
/ 10
Install the EOSIO platform
/ 15
Run a local single node blockchain
/ 15
Create wallet
/ 15
Add the eosio system account private key to the new wallet
/ 15
Install the EOSIO Contract Development Toolkit (CDT)
/ 15
Create a blockchain account
/ 15
Block.one: Getting Started with The EOSIO Blockchain
- GSP873
- Overview
- Setup and requirements
- Background
- Task 1. Create a virtual machine using the Google Cloud Console
- Task 2. Install the EOSIO platform
- Task 3. Run a local single node blockchain
- Task 4. Create wallet
- Task 5. Add the EOSIO system account private key to the new wallet
- Task 6. Install the EOSIO Contract Development Toolkit (CDT)
- Task 7. Create a blockchain account
- Congratulations!
This lab was developed with our partner, Block.one. Your personal information may be shared with Block.one, the lab sponsor, if you have opted-in to receive product updates, announcements, and offers in your Account Profile.
GSP873
Overview
In this lab, you will create a virtual machine (VM) to host an EOSIO blockchain single node. You will load and start a local single node blockchain, create a wallet, and load the eosio private key. This is an EOSIO Fundamentals lab.
Objectives
In this lab, you will learn how to perform the following tasks:
- Create a Compute Engine virtual machine
- Install the EOSIO platform
- Run a single node blockchain
- Create a wallet
- Load the EOSIO private key
- Install the EOSIO Contract Development Toolkit (CDT)
- Create a blockchain account
Prerequisites
Before you start this lab, make sure you get familiar with the following:
Setup and requirements
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
- Access to a standard internet browser (Chrome browser recommended).
- Time to complete the lab---remember, once you start, you cannot pause a lab.
How to start your lab and sign in to the Google Cloud console
-
Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:
- The Open Google Cloud console button
- Time remaining
- The temporary credentials that you must use for this lab
- Other information, if needed, to step through this lab
-
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
Note: If you see the Choose an account dialog, click Use Another Account. -
If necessary, copy the Username below and paste it into the Sign in dialog.
{{{user_0.username | "Username"}}} You can also find the Username in the Lab Details panel.
-
Click Next.
-
Copy the Password below and paste it into the Welcome dialog.
{{{user_0.password | "Password"}}} You can also find the Password in the Lab Details panel.
-
Click Next.
Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges. -
Click through the subsequent pages:
- Accept the terms and conditions.
- Do not add recovery options or two-factor authentication (because this is a temporary account).
- Do not sign up for free trials.
After a few moments, the Google Cloud console opens in this tab.
Background
This section provides an overview of the EOSIO concepts covered in this lab.
EOSIO Blockchain
An EOSIO blockchain is a highly efficient, deterministic, distributed state machine that can operate in a decentralized fashion. The blockchain keeps track of transactions within a sequence of interchanged blocks.
Each block cryptographically commits to the previous blocks along the same chain. It is therefore intractable to modify a transaction recorded on a given block without breaking the cryptographic checks of successive blocks. This simple fact makes blockchain transactions immutable and secure. Block production and block validation are performed by special nodes called Block Producers.
EOSIO Consensus
Block validation presents a challenge among any group of distributed nodes. A consensus model must be in place to validate such blocks in a fault tolerant way within the decentralized system. Consensus is the way for such distributed nodes and users to agree upon the current state of the blockchain. Two of the most common consensus models used in blockchains are Proof of Work (PoW) and Proof of Stake (PoS). In Proof of Stake, nodes that own the largest stake or percentage of some asset have equivalent decision power.
One interesting variant is Delegated Proof-of-Stake (DPoS) in which a large number of participants or stakeholders elect a smaller number of delegates, which in turn make decisions for them. EOSIO uses Delegated Proof of Stake (DPoS) to elect the active producers who will then be authorized to produce blocks, validate them, and sign them to eventually be added to the blockchain.
EOSIO Accounts, Keys, and Permissions
An account identifies a participant in an EOSIO blockchain. A participant can be an individual or a group depending on the assigned permissions within the account. Accounts also represent the smart contract actors that push and receive actions to and from other accounts in the blockchain. Keys in EOSIO are binary strings represented in Base58 used for signing and verification of transactions, blocks, and other messages. Keys are created within a digital wallet associated with an account.
Since account ownership is defined solely by the account name, the keys associated with an account can be updated without compromising security. A novel permission scheme involving accounts, permissions, and authority tables determine what accounts can do and how the actions that make a transaction are authorized. To that end, each account is assigned a hierarchical permission structure and each permission is assigned a pair of public and private keys used for signing and verification.
Task 1. Create a virtual machine using the Google Cloud Console
-
In the Navigation Menu (), click Compute Engine > VM instances.
-
To create a new instance, click Create Instance.
-
In the Machine configuration.
Select the following values:
-
Name:
my-vm-1
-
Region:
-
Zone:
-
Machine Family:
General Purpose
-
Series:
E2
-
Machine Type:
e2-standard-2
-
Name:
-
Click OS and storage.
For Boot disk, if the Image shown is not Ubuntu 20.04 LTS, Click Change to begin configuring your boot disk and select the following values:
-
Operating system:
Ubuntu
-
Version:
Ubuntu 20.04 LTS
Leave the size as default and Click on Select.
-
Operating system:
-
Click Security.
Leave the defaults for Identity and API access and all other fields unmodified.
-
Click Create.
Click Check my progress to verify the objective.
Task 2. Install the EOSIO platform
-
In the Navigation Menu , click Compute Engine > VM instances. You will see the VM instance you created.
-
Click the SSH button next to the
my-vm-1
instance. -
Update the libraries on your OS by running:
- At the command prompt on
my-vm-1
, run the following to get the eosio binaries:
- Next, run the following to install the EOSIO platform:
- Confirm
nodeos
is installed:
The response will be the nodeos
version:
- Confirm
cleos
is installed:
The response will be the cleos
version:
- Confirm
keosd
is installed:
The response will be the keosd
version:
Click Check my progress to verify the objective.
Task 3. Run a local single node blockchain
- At the command prompt on
my-vm-1
, start thenodeos
service daemon as a background task and launch a single node blockchain, directing the console output to a nodeos.log file:
The response will be the PID for nodeos.
- Verify that nodeos is running and producing blocks:
The output will look like this:
You will see the current block, and last irreversible block (lib) incrementing.
- Press Ctrl+C to exit tail.
Click Check my progress to verify the objective.
Task 4. Create wallet
- At the command prompt on
my-vm-1
, create a wallet, named my_wallet, and output the wallet password to a file named my_wallet_password:
The response will show:
- View the wallet password:
- To view the local wallets execute this command:
The response will be:
Click Check my progress to verify the objective.
Task 5. Add the EOSIO system account private key to the new wallet
Every new EOSIO blockchain has a default system user called eosio. This account is used initially to set up the blockchain. It defaults to the private key, 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
. Import this private key to your wallet to sign transactions on behalf of the eosio user.
- At the command prompt on
my-vm-1
, use thecleos wallet open
command to open the my_wallet wallet:
The response will be:
-
Copy the wallet password from the my_wallet_password file.
-
Use the
cleos wallet unlock
command to unlock the my_wallet wallet, add the wallet password in toYOUR_PASSWORD
:
The response will be:
- Use the
cleos wallet import
command to import the EOSIO private key,5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
, to the my_wallet wallet:
The response will be:
Click Check my progress to verify the objective.
Task 6. Install the EOSIO Contract Development Toolkit (CDT)
- At the command prompt on
my-vm-1
, run the following to get the eosio binaries:
- At the command prompt on
my-vm-1
, install the CDT:
- Confirm the CDT is installed:
The response will be the CDT version:
Click Check my progress to verify the objective.
Task 7. Create a blockchain account
- At the command prompt on
my-vm-1
, use thecleos wallet open
command to open the my_wallet wallet:
The response will be:
- Copy the wallet password from the
my_wallet_password
file:
- Use the
cleos wallet unlock
command to unlock the my_wallet wallet, using the$wallet_password
environment variable you just created:
The response will be:
- Use the
cleos create key
command to create a public/private key pair to use with the blockchain account:
The response will be:
- Check the file
my_keypair1
:
The response will be the generated public and private keys and will look like:
This shows YOUR_PRIVATE_KEY and YOUR_PUBLIC_KEY.
- Use the
cleos wallet import
command to import the eosio private key created in the previous step YOUR_PRIVATE_KEY, to the my_wallet wallet:
The response will be:
- Use the
cleos create account
command to create a blockchain account using YOUR_PUBLIC_KEY:
The response will be:
Click Check my progress to verify the objective.
Congratulations!
In this lab, you created a virtual machine (VM) instance, loaded and started a single node blockchain. You then created a wallet and loaded the default eosio private key used for development.
Next steps / learn more
Be sure to check out the following resources for more practice with Block.one:
- Block.one on the Google Cloud Marketplace!
- Learn more about the EOSIO platform at the developer portal.
- Get certified with Block.one training and certification.
- Training and Certification for EOSIO
Google Cloud training and certification
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Last Tested Date: October 21, 2024
Last Updated Date: December 11, 2024
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.