Skip to main content

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 UPCX Blockchain, the core components used in this tutorial are:

  • Nodupcx: The core daemon which runs in a network of daemons to create a blockchain
  • Clupcx: The command line tool to send commands and requests to nodupcx
  • Kupcxd: 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 upcx 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 nodupcx 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 upcx default system account

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

[[warning]] | The private key is widely known and so any blockchain where the upcx account has not been resigned is not secure.

[[info]] | The upcx private key is 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

Add the upcx account private key to a local wallet

Use Clupcx to import the default upcx account private keys into a local wallet.

clupcx wallet import --name local 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

What's next?