Ultimate Performance: The Aurora Layer2 Network
Deploying and onboarding users to the Aurora Network powered by NEAR Protocol
We've covered several Layer 2 sidechains before:
But today might be the fastest of them all. On top it's tightly connected to the NEAR protocol ecosystem, a PoS chain with a scalable sharding design. And of course they have a bridge to Ethereum!
What is the Aurora Chain?
You can send regular Ethereum transactions to the Aurora Chain. NEAR has implemented a fully functioning EVM on top of its NEAR platform. The EVM is fully functioning with all precompiles and opcodes, but some opcodes are slightly modified to fit the architecture. Transactions are executed in the EVM runtime Sputnik VM which is an efficient EVM implementation written in Rust. For increased performance some operations of the EVM runtime may be moved to the NEAR protocol level.
Funds can be transferred using the decentralized Rainbow Bridge from near. Users can transfer ETH onto Aurora which must be used to pay for transactions. This was done to confuse users less keeping the same EVM currency as Ethereum. The ETH balance will also be duplicated inside the NEAR runtime allowing you to use it on NEAR and Aurora.
All code for Aurora can be found here.
Why choose Aurora?
Extremely low fees up, one example given by the team was a single ERC-20 token transfer for Ethereum being about 5.40$ (50 Gwei gas price) and only 0.01$ on Aurora. That’s more than 500x cheaper!
2000+ transactions per second (more than 50x faster than ETH1.0).
Decentralization through DAO governance.
Future-proof sharing design of NEAR core infrastructure.
Fast finality.
How to deploy to Aurora
Deploying to the Aurora Chain is very simple. If you're using Truffle, simply add the Aurora Chain network configuration like this:
aurora: {
provider: () => new HDWalletProvider(mnemonic, ' https://mainnet.aurora.dev'),
network_id: 1313161554,
},
},
aurora-testnet: {
provider: () => new HDWalletProvider(mnemonic, ' https://testnet.aurora.dev'),
network_id: 1313161555,
}
You'll also need funds in the chain of course. For the testnet you can use the faucet here. For how to transfer funds from the public chain, read on.
How to onboard users to your Aurora Dapp
1. Choice of wallet
These days you have much more than just MetaMask as possible wallets to support available. Take a look at Yearn Finance for example. They are supporting 11 different wallets alone at the time of this writing.
2. MetaMask example live in action
We'll focus on MetaMask as the biggest wallet with the most features. With MetaMask you can nowadays actually request to connect directly to a custom network.
If you want to see this live, check out Pancake Swap as example. Unless you already have Aurora Chain added, it will request to add this network. Or simply click 'Add network' in the Aurora bridge.
3. How to add Aurora automatically for users
You can see on the right how to add the Aurora Chain automatically to the wallet for the user. This will show the popup you see above. If the user confirms, the network is added and automatically switched to.
This is all thanks to EIP-3085 with the new RPC method wallet_addEthereumChain
. See also the MetaMask docs here.
const params = [{
"chainId": "0x4e454152", // 1313161554 in decimal
// testnet alternative: "chainId": "0x4e454153", // 1313161555 in decimal
"chainName": "Aurora",
"rpcUrls": [
"https://mainnet.aurora.dev" // testnet alternative: "https://testnet.aurora.dev"
],
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"blockExplorerUrls": [
// not yet available
]
}]
try {
await ethereum.request({
method: 'wallet_addEthereumChain',
params,
})
} catch (error) {
// something failed, e.g., user denied request
}
Using the Aurora Bridge
You can use the bridge here to transfer funds in and out of the Aurora Chain from the Ethereum network directly. It will lock the tokens on the bridge contract in the Ethereum mainnet. The bridge works bidirectionally, meaning you can transfer assets
- from Ethereum to Aurora an
- from Aurora to Ethereum
However it currently only supports the testnet. The mainnet functionality should be added very soon. (if you read this and mainnet already works, dont hesitate to contact me for correction)
Lastly, you can participate in the town hall event to ask further questions happening on July 12th. I will be updating this post with any potentially interesting new information coming from this event.
Solidity Developer