This guide is intended for developers who want to understand the technical implementation of the bridge mechanism. For user-friendly instructions, see Withdraw Tokens.
Data Transfer Mechanism
The transfer process involves several key steps that ensure data integrity and security across the bridge:1
Transaction Creation on Shibarium
Execute a transaction on the child contract deployed on Shibarium, emitting an event that includes the data intended for transfer to Ethereum.
The data is encoded in bytes and emitted in the event for transfer to Ethereum.
2
Checkpoints by Validators
Validators on the Shibarium network pick up the transaction at specific intervals (typically 10-30 minutes), validate it, and add it to the checkpoint on Ethereum.
Checkpoint intervals ensure efficient batch processing while maintaining security.
3
Checkpointing on Ethereum
Validators create a checkpoint transaction on the RootChain contract in Ethereum, ensuring the inclusion of the Shibarium transaction hash.
4
RootChainManager Contract
After checkpointing, submit the hash of the Shibarium transaction to the RootChainManager contract on Ethereum as proof.
The RootChainManager contract validates the transaction, confirms its inclusion in the checkpoint, and decodes the event logs.
5
Predicate Contract Usage
Utilize a Predicate contract, triggered only by the RootChainManager contract, to secure state changes on Ethereum.
Implementation Overview
The complete flow ensures secure state changes on Ethereum:- A transaction is executed on the child contract on Shibarium, emitting an event with the data to transfer
- Validators validate and checkpoint the transaction on Ethereum
- The shib.js library is used to trigger the exit function of the RootChainManager contract
- State changes on Ethereum occur only when the Shibarium transaction is checkpointed and verified
Contract Mapping
To establish the connection between Shibarium and Ethereum contracts:1
Deploy Contracts
Deploy the Child contract on Shibarium and the Root contract on Ethereum using the provided contract code.
2
Map Contracts
Use the PoS bridge to map these contracts to maintain a connection between them across chains.
Ensure both contracts are deployed on the correct networks before mapping.
3
Verify Mapping
Confirm that the mapping is successful and both contracts can communicate through the bridge.
Testing the Implementation
1
Create Transaction
Create a transaction on Shibarium by calling the
setData
function of the child contract.2
Wait for Checkpoint
Wait for the checkpoint to be completed (typically 10-30 minutes).
You can monitor checkpoint status using the shib.js library.
3
Check Inclusion
Verify that your transaction hash is included in the checkpoint on Ethereum.
4
Trigger Exit
Use the shib.js SDK to call the exit function of the RootChainManager.
Security Features
The Shibarium to Ethereum bridge includes several security mechanisms:- Validator Verification: Multiple validators must approve checkpoint transactions
- Predicate Contracts: State changes on Ethereum are restricted to authorized contracts
- Event Verification: All transfers are verified through event logs
- Checkpoint Inclusion: Transactions must be included in official checkpoints
This multi-layered security approach ensures that only valid and verified transactions can trigger state changes on Ethereum.
Timeframes
Operation | Typical Duration |
---|---|
Transaction on Shibarium | Immediate |
Checkpoint Creation | 10-30 minutes |
Exit Process | 30 minutes - 1 hours |
Total Transfer Time | 40 minutes - 6.5 hours |
Actual times may vary based on network congestion and validator activity.
Troubleshooting
Checkpoint not created
Checkpoint not created
- Verify the transaction was successful on Shibarium
- Check that the event was properly emitted
- Ensure validators are active and processing checkpoints
- Wait for the standard checkpoint interval
Exit process fails
Exit process fails
- Verify the transaction hash is included in the checkpoint
- Check that the event signature matches your contract
- Ensure sufficient ETH for gas fees on Ethereum
- Verify contract mapping is correct
State not updated on Ethereum
State not updated on Ethereum
- Confirm the Predicate contract has the correct permissions
- Verify the RootChainManager processed the exit
- Check that the data encoding matches between contracts
- Ensure the Root contract is properly deployed
Next Steps
- Learn about Ethereum to Shibarium transfers
- Understand withdrawal procedures
- Explore token compatibility requirements