TsengCoin Core

Core client for the TsengCoin blockchain. Build with cargo build --release. Run the built binary in target/release for maximum speed, or do cargo run to run with debugger. Example commands in this README will use cargo run but they work on the compiled binary too.

Creating a Wallet

Before you get started with TsengCoin you need to create a wallet. A wallet is an ECDSA keypair consisting of a public key and a private key. The private key is encrypted with AES-SCM using a key generated from a password (PBKDF2), and it lives in a file. The file must be in the same directory as the TsengCoin client. You can create a wallet with

cargo run create-wallet <password>

The password can have spaces. This will create a public key file and a private key file. The public key is your wallet id, which will be used to identify you in transactions. The private key file should be protected, because this will be used by you to send TsengCoin. Whenever you start the client, you will need to provide the password to your wallet, and the private key file must be in the client's directory.

Running as a seed

There are two ways to run TsengCoin Core, and the first of these is as a seed. If there is no TsengCoin network, or if you don't know of any nodes in the network, you can run the client as a seed node. On startup, a seed node knows only about the genesis block and itself. Other nodes can connect to the seed node, and the seed node will remember them. When a normal node connects to the seed node it will request a list of more nodes that the seed knows about. If a blockchain always has a genesis block, then a seed node is effectively a "genesis node" for a TsengCoin network.

You probably don't want to run a node like this unless you're testing a local TsengCoin network, but you can do so with

cargo run start-seed <port> <wallet-password>

Once running, the client will listen for incoming connections on port.

Running Normally

The second and more common way to run TsengCoin core is as a normal node. You can do this with

cargo run start <seed-ip> <seed-port> <local-port> <wallet-password>

The seed-ip and seed-port point to a running node that the client will use to bootstrap. Bootstrapping has three steps:

  1. Ask the first node for more nodes to connect to
  2. Ask one of the newly obtained nodes for an updated copy of the blockchain
  3. Ask the first node for a list of pending transactions

The local-port is the port on which the local node will listen. Every running client must participate in the network as a node, so every client must be able to accept incoming connections from other nodes trying to bootstrap or make a request.

The wallet-password is the password for the local wallet. Each running client can run commands on behalf of a wallet, which is loaded when the client starts.

Session Commands

Once a TsengCoin client is running, commands can be entered into the session. The first of these gets the balance of a wallet in the blockchain, or the local wallet if the argument is omitted:

balance [wallet]

You can also send coins to other wallets with the send-coins command:

send-coins <receiver> <amount>

receiver is the receiving wallet ID, and amount is the amount of coins to send from your own wallet. Running this command will create a signed Transaction object. The signature is generated by your private key, and can only be verified by your public wallet ID. The transaction object is broadcast to all known nodes, who forward it on to their neighboring nodes, etc. Each node puts the new transaction in a list of pending transactions.