Yansan is a blockchain platform written in JavaScript, designed to provide hands-on experience with blockchain technology, helping you to understand how it works. With Yansan, you can create wallets, simulate transactions between wallets, mine new blocks to the blockchain, reward miners with tokens, and validate the integrity of the blockchain.
- Uses SHA-256 hash algorithm. (Same as Bitcoin)
- Create wallets.
- Simulate transactions between wallets.
- Mine new blocks to the blockchain.
- Reward miners with tokens.
- Check wallet address balance.
- Validate the integrity of the blockchain.
- Node.js installed.
- Crypto-js installed.
- Elliptic installed.
- Clone Yansan locally from the repository.
- Install the required dependencies using npm.
- Initialize or reinitialize the blockchain by running
node init-blockchain.js
. - Upon (re)initializing the blockchain, a new wallet (Me) will be created with 0 balance. In order to send tokens to other wallets, at least 2 new blocks must be mined to acquire miner reward tokens.
- Mine new blocks by running
node mine-block.js
- Create new wallets with the command
node create-wallet.js <walletname>
. If the wallet name isn't specified, defaults to Undefined. - To add transactions, run
node add-transactions.js <privatekey> <walletname> <amount>
where<privatekey>
is the sender's private key,<walletname>
is the recipient's wallet name, and<amount
is the amount being transferred. - Check a wallet's balance by running
node get-wallet-balance.js <walletname>
- Get a wallet's public address through
node get-wallet-address.js <walletname>
- To validate the integrity of the blockchain, run the following command in the terminal:
node validate-chain.js
That's it! You can now start creating new wallets, mining new blocks, simulating transactions and validating the integrity of the Yansan blockchain.
- The mined blocks can be accessed via
blockchain.json
- The transactions in the transaction pool can be accessed via
transactions.json
- Private keys for all created wallets can be accessed via
private-keys.txt
- Public keys for all created wallets can be found in
wallets.json
Yansan is an open-source project and contributions are welcome. Whether you are a beginner or an experienced developer, you can help make Yansan better by fixing bugs, adding new features, or improving the documentation.
Yansan provides a great opportunity to learn about blockchain technology and explore its possibilities. Give it a try and see what you can build with it.
Add a hashing function (SHA-256 OR KECCAK256)Add wallet creation- Add a GUI
Yansan is released under the MIT License. See the LICENSE file for details.