A vibe coded feature-rich DEMO blockchain with CUSTOM smart contract support, multi-principal architecture (Wallet/User/App), and a complete wallet application (CLI + GUI).
- Proof of Stake (PoS) consensus mechanism
- Smart Contracts with Solidity-like language
- Multi-Principal System: Wallet, User, and App principals with access control
- ERC20 Tokens and ERC721 NFTs
- Data Storage via DATA transactions
- Wallet Application with CLI and GUI interfaces
- gRPC-based node communication
pip install grpcio grpcio-tools ecdsa mnemonic customtkinterpython -m grpc_tools.protoc -I protos --python_out=. --grpc_python_out=. protos/miner.protopython start_node.pyThe node will:
- Initialize blockchain storage (
test_blockchain.db) - Fund test wallet
0xc0e1a9546e05f6a4814b8d1264f73dbdd82f0536with 1000 COIN - Start gRPC server on
localhost:50051 - Auto-mine blocks every 5 seconds if transactions are pending
GUI (Recommended):
python wallet_gui.pyCLI:
# Create wallet
python wallet_app.py create
# View balance
python wallet_app.py info
# Send coins
python wallet_app.py transfer <RECEIVER_ADDRESS> <AMOUNT>
# Deploy contract
python wallet_app.py deploy --code contracts/erc20.sol
# Deploy as app
python wallet_app.py deploy --code contracts/game_score.sol --as-app "game:v1"- Home - View balance and address
- Send - Transfer native COINs
- Transactions - View transaction history (placeholder)
- Tokens - Manage ERC20 tokens
- NFTs - View NFT collections
- Contracts - Interact with any contract
- Deploy - Deploy smart contracts
- Data - Store and retrieve data on-chain
- Settings - Configure node address
- Navigate to Tokens tab
- Click "+ Add Token"
- Enter token name and contract address
- View balance and transfer tokens
- Navigate to NFTs tab
- Click "+ Add Collection"
- Enter collection name and contract address
- View owned NFTs
As Wallet (User-owned):
- Navigate to Deploy tab
- Paste contract source code
- Select "Wallet" radio button
- Click "Deploy Contract"
As App (App-owned with isolation):
- Select "App" radio button
- Enter App ID (e.g.,
game:chess) - Click "Deploy Contract"
- First deployment creates a new key for the app
- Subsequent deployments reuse the same key
- Navigate to Data tab
- Enter a key (identifier)
- Enter data (any text/JSON)
- Click "Store Data"
- Use "Retrieve Data" to view stored data
RapidChain supports three principal types:
- Traditional blockchain address (like Ethereum)
- Derived from ECDSA keypair
- Example:
0xc0e1a9546e05f6a4814b8d1264f73dbdd82f0536
- Virtual identity within an app
- Format:
user:alicewithinapp:my-app - Transactions signed by the app but attributed to the user
- Application-level identity
- Format:
app:my-awesome-app - Can own contracts with app isolation (only owner app can call
appmodifier functions)
contract MyToken {
public String name;
public String symbol;
public Integer totalSupply;
public mapping(Address => Integer) balances;
function initialize(String _name, String _symbol, Integer _supply) public {
name = _name;
symbol = _symbol;
totalSupply = _supply;
balances[msg.sender] = _supply;
}
function transfer(Address to, Integer amount) public {
balances[msg.sender] = balances[msg.sender] - amount;
balances[to] = balances[to] + amount;
}
function balanceOf(Address owner) public returns Integer {
return balances[owner];
}
}contract GameScore {
mapping(String => Integer) scores;
// Only the owner app can call this
function submitScore(String player, Integer score) app {
scores[player] = score;
}
// Anyone can read
function getScore(String player) public returns Integer {
return scores[player];
}
}Send native COINs from one address to another.
python wallet_app.py transfer 0xBOB 50Deploy a smart contract.
python wallet_app.py deploy --code contracts/erc20.solExecute a smart contract method.
python wallet_app.py exec --contract 0xTOKEN --method transfer --args '["0xBOB", 100]'Store arbitrary data on-chain.
# Via GUI: Data tab -> Enter key/value -> Store Data├── chain/
│ ├── blockchain.py # Core blockchain logic
│ ├── node.py # gRPC node server
│ ├── wallet.py # Wallet/key management
│ ├── transaction.py # Transaction types
│ ├── block.py # Block structure
│ └── storage.py # SQLite persistence
├── sol/
│ ├── lexer.py # Contract lexer
│ ├── lang_ast.py # AST parser
│ ├── compiler.py # Bytecode compiler
│ └── bytecode.py # Virtual machine
├── contracts/ # Sample contracts
│ ├── erc20.sol
│ ├── nft.sol
│ ├── game_score.sol
│ └── ...
├── protos/
│ └── miner.proto # gRPC definitions
├── wallet_client.py # Shared wallet logic
├── wallet_app.py # CLI wallet
├── wallet_gui.py # GUI wallet
└── start_node.py # Node startup script
Run the comprehensive test suite:
python tests/test.pyTests include:
- ERC20 operations
- NFT minting/transfers
- Multisig wallets
- Auction systems
- Staking with cross-contract calls
- User/App modifiers
- App isolation security
The node exposes the following gRPC methods:
SubmitTransaction- Submit a transaction to the mempoolProposeBlock- Propose a new block (PoS)SyncChain- Synchronize blockchain stateGetState- Query account balance and nonceCall- Execute read-only contract call
If you see "address already in use" error:
Windows:
netstat -ano | findstr :50051
taskkill /PID <PID> /FLinux/Mac:
lsof -i :50051
kill -9 <PID>Run python wallet_app.py create first.
Ensure start_node.py is running and listening on localhost:50051.
Wait 5-10 seconds for the block to be mined, then check node.log for the contract address.
Blocks are mined every 5 seconds if there are pending transactions. Check node.log output.