A bridge contract for wrapping HIVE/HBD tokens on Ethereum and compatible EVM chains.
- ERC20 compliant token with gasless approvals (EIP-2612)
- Multisig-controlled governance for security
- Prevents double minting and replay attacks
- Emergency pause functionality
- Optimized for gas efficiency
Hive Blockchain ↔ Bridge Nodes ↔ WrappedHive Contract
- Decimals: 3 (matching HIVE precision)
- Standards: ERC20, ERC20Permit
- Security: Multisig, Pausable, Custom errors
- Node.js 18+ and npm
- Git
# Clone the repository
git clone https://github.com/mahdiyari/hive-bridge-eth.git
cd hive-bridge-eth
# Install dependencies
npm install
# Build contracts
npx hardhat build# Run all tests
npm test
# Run comprehensive test suite
npm run test:comprehensive# Configure testnet private key
npx hardhat keystore set SEPOLIA_PRIVATE_KEY
# Deploy to Sepolia
npm run deploy:sepolia- Send HIVE/HBD to the bridge address on Hive blockchain with memo containing your Ethereum address e.g.
ETH:0x1234... - Bridge nodes detect the transaction and create signatures
- Call
wrap()with the signatures to mint tokens on Ethereum
- Call
unwrap(amount, hiveUsername)on the contract - Bridge nodes detect the Unwrap event
- HIVE tokens sent to your Hive account after 12 confirmations
// Import the contract ABI
import WrappedHiveABI from './artifacts/contracts/WrappedHive.sol/WrappedHive.json'
// Create contract instance
const contract = new ethers.Contract(
contractAddress,
WrappedHiveABI.abi,
signer
)
// Check balance
const balance = await contract.balanceOf(userAddress)
// Unwrap tokens
await contract.unwrap(ethers.parseUnits('10', 3), 'hive-username')
// Get all signers
const signers = await contract.getAllSigners()Mints new tokens by wrapping HIVE from Hive blockchain.
- amount: Token amount (3 decimals, e.g., 1.000 HIVE = 1000)
- trx_id: Hive transaction ID
- op_in_trx: Operation index in the transaction
- signatures: Array of signatures from bridge signers
Burns tokens to unwrap back to Hive blockchain.
- amount: Token amount to burn (3 decimals)
- username: Hive username to receive tokens (3-16 characters)
Adds a new authorized signer (requires multisig approval).
Removes an authorized signer (requires multisig approval).
Updates the number of required signatures (requires multisig approval).
Emergency pause/unpause functions (requires multisig approval).
GPL-3.0 - see LICENSE file.