BlockSimulate is a simple blockchain simulator written in Go. It creates a local blockchain with features for wallet management, transaction signing, and blockchain operations.
- Create and manage wallets
- Transfer funds between wallets
- Sign and verify transactions
- Retrieve blockchain data and transaction history
- Go 1.21 or higher: https://golang.org/dl/
- Clone the repository:
git clone https://github.com/adarshswaminath/BlockSimulate.git
2.Navigate to the project directory:
cd BlockSimulate
3.Install dependencies:
go mod tidy
You can run the application in two ways:
- Running with go run
go run main.go wallet.go block.go
- Building and running the binary
go build -o blocksimulate
3.Run the binary:
./blocksimulate
For frontend
4.After running the Go application, open a new terminal:
cd frontend
5.Install dependencies
npm install
6.Run the frontend
npm run dev
The application will start a web server on http://localhost:3000.
- GET
/block-data
: Retrieve all blocks in the blockchain. - GET
/latest-block
: Retrieve the latest block in the blockchain. - GET
/wallets
: Retrieve all wallets. - POST
/create-wallet
: Create a new wallet. Responds with the public and private keys and initial balance. - POST
/transfer
: Transfer funds between wallets. Request body:
{
"sender_public_key": "Sender's public key",
"sender_private_key": "Sender's private key",
"receiver_public_key": "Receiver's public key",
"amount": 10
}
- GET
/account-details/:public_key
: Retrieve account details by public key. - GET
/transactions
: Retrieve all transactions.
Screenshots of the frontend are available in the /screenshots
folder.