Crates.io | magic-domain-program |
lib.rs | magic-domain-program |
version | 0.0.1 |
created_at | 2025-08-19 08:01:41.019497+00 |
updated_at | 2025-08-19 08:01:41.019497+00 |
description | Domain registration program for Ephemeral Rollups |
homepage | https://www.magicblock.gg/ |
repository | https://github.com/magicblock-labs/magic-domain-program |
max_upload_size | |
id | 1801549 |
size | 233,298 |
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.
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.
Currently the program supports 3 instructions:
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