In this lesson, you'll learn:
We'll briefly compare Solana and Ethereum's development environments. Unlike Ethereum's single-account system (handling both code and data), Solidity contracts on Solana use two accounts: one for the executable code (program account) and another for storage variables (data account).
Adapting Solidity for Solana
For Solidity to work with Solana, some changes are needed. In Solana's Solidity contracts, you'll find two accounts: the program account (holding the contract's executable code) and the data account (for storage variables). This is different from Ethereum's single-account system.
address
type), different from Ethereum's 20-byte address. For example, a Solana address looks like 36VtvSbE6jVGGQytYWSaDPG7uZphaxEjpJHUUpuUbq4D
, which isn't compatible with Ethereum's format like 0xE0f5206BBD039e7b0592d8918820024e2a7437b9
.msg.sender
function, and because of different signature algorithms, it lacks ecrecover()
but has signatureVerify()
for ed25519 signatures.Here's a comparison table highlighting these differences:
Concept | Solana | Ethereum |
---|---|---|
Account Address Format | 32-byte key (address type) | 20-byte address |
Wallet Address Length | About 44 characters | 40 characters (with 0x prefix) |
Required Solana Version | v1.8.1 | - |
Gas and Resource Management | Compute Units (200k per function) | Gas and EVM instructions |
msg.sender Function | Not Available | Available |
Signature Verification | signatureVerify() | ecrecover() |
Try-Catch Statements | Not Functional | Available |
Error Handling and Reverts | Limited | Available |
ERC-20 Compatibility | Not Compatible | Compatible |
In the next lesson, we'll provide a detailed technical comparison between Solana and Ethereum, focusing on their architectures and how they utilize Solidity.