Running a blockchain

Smart contracts are deployed to a blockchain and smart contract transactions are executed on a blockchain. Testing a smart contract requires a blockchain. You can run a local blockchain for testing smart contracts or use the official Block.one testnet. See the testnet quick start guide for more information on how to use the official Block.one testnet. This tutorial shows how to run a blockchain on your local machine. This is commonly known as a local single node testnet.

This tutorial introduces the EOSIO Blockchain, the core components used in this tutorial are:

  • Nodeos: The core daemon which runs in a network of daemons to create a blockchain
  • Cleos: The command line tool to send commands and requests to nodeos
  • Keosd: A local secure store for private keys

This tutorial shows how to:

  • Create a single node blockchain running on your local machine
  • Import the private key to the default eosio system account

Once the tutorial is completed you should be able to run a local single node testnet.

Run a Local Single-Node Blockchain

Run a local nodeos instance which produces blocks, creating a local single-node testnet, using these instructions.

You can use this local single-node testnet to follow the smart contract guides and for testing your own smart contracts. You can create more advanced local single node testnet with consensus protocols and multi node blockchain configurations here and then look at the Bios Boot Sequence Tutorial to see how real blockchains are bootstrapped.

The eosio default system account

To use a blockchain requires blockchain accounts, when you launch a new EOSIO blockchain it creates a default system account called eosio. The eosio account is a special account that is used to bootstrap a blockchain. To use the eosio account on a local single node blockchain you must add the private key of the eosio account to a wallet. You can then authorize transactions for the eosio account. Here we use keosd. If you have not already created a wallet then follow this guide to create a development wallet.

The private key is widely known and so any blockchain where the eosio account has not been resigned is not secure.

The eosio private key is 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

Add the eosio account private key to a local wallet

Use Cleos to import the default eosio account private keys into a local wallet.

cleos wallet import --name local 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

What's next?