4 releases
| new 0.2.0 | Nov 22, 2025 |
|---|---|
| 0.0.3 | Nov 5, 2025 |
| 0.0.2 | Nov 5, 2025 |
| 0.0.1 | Aug 19, 2025 |
#4 in #magicblock
89 downloads per month
Used in magic-resolver
52KB
524 lines
Magic Domain Program
Magic Domain Program, a Solana smart contract which allows Ephemeral Rollups (ERs) to register themselves on chain, thus allowing clients to discover those ERs along with the services they provide.
Table of Contents
Introduction
The Magic Domain Program is a Solana-based smart contract that facilitates registration of Ephemeral Rollups providers on solana blockchain. The registration process allows those provides to advertise themselves to users, declaring various parameters of their services, like IP address via which the ER can reached, block time, fees, supported features and so on.
Usage
Currently the program supports 3 instructions:
- registration
- state synchronization
- unregistration
Once deployed, the Magic Domain Program can be interacted with using regular transactions. Here are some example commands:
-
Register ER
let identity = Keypair::new(); let features = FeaturesSet::default().activate(Feature::Randomness); // here we declare all the parameters of our ER let record = ErRecord::V0(RecordV0 { identity: identity.pubkey(), addr: "https://241.132.2.41:9324/".to_string(), block_time_ms: 50, fees: 1000, features, }); let ix = Instruction::Register(record); let ix = SolanaInstruction::new_with_borsh( mdp::ID, &ix, vec![ AccountMeta::new(identity.pubkey(), true), AccountMeta::new(pda, false), AccountMeta::new_readonly(system_program::ID, false), ], ); let hash = rpc.get_latest_blockhash().await.unwrap(); let tx = Transaction::new_signed_with_payer(&[ix], Some(&identity.pubkey()), &[identity], hash); rpc.send_transaction(tx).await -
Sync ER parameters with chain
let ix = Instruction::Sync(SyncInstruction { identity: identity.pubkey(), addr: Some("https://127.145.24.55:9324".to_string()), block_time_ms: Some(50), fees: None, features: None, }); let ix = SolanaInstruction::new_with_borsh( mdp::ID, &ix, vec![ AccountMeta::new(identity.pubkey(), true), AccountMeta::new(pda, false), AccountMeta::new_readonly(system_program::ID, false), ], ); let hash = rpc.get_latest_blockhash().await.unwrap(); let tx = Transaction::new_signed_with_payer(&[ix], Some(&identity.pubkey()), &[&identity], hash); rpc.send_transaction(tx).await -
Unregister ER (delete record on chain)
let ix = Instruction::Unregister(identity.pubkey()); let ix = SolanaInstruction::new_with_borsh( mdp::ID, &ix, vec![ AccountMeta::new(identity.pubkey(), true), AccountMeta::new(pda, false), AccountMeta::new_readonly(system_program::ID, false), ], ); let hash = rpc.get_latest_blockhash().await.unwrap(); let tx = Transaction::new_signed_with_payer(&[ix], Some(&identity.pubkey()), &[&identity], hash); rpc.send_transaction(tx).await
Dependencies
~11–16MB
~310K SLoC