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 nodeos instance which produces blocks using these instructions.
Once you complete the instructions you will have a local single-node testnet running on your machine.
You can use this local single-node testnet to follow the smart contract guides and for testing your own smart contracts. You can also look at 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.
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.
Use Cleos to import the default eosio account private keys into a local wallet.
cleos wallet import --name local 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3