The Lava Network’s purpose is to allow everyday users of 0xBitcoin (or other ERC20s) to spend and transfer 0xBitcoin without having to carry any ETH or even worry about the Ethereum Mainnet at all. This is done by using offchain ‘checks’ called ‘Lava Packets’.
These Lava Packets are composed of eight integers, which all fit into a Solidity method as input parameters. When this Solidity method is called, it is like someone is depositing a signed check in the bank: A monetary transfer of 0xBTC is done between account A (always the signer/spender) and account B. The relayer (Account C) who turned in the ‘check’ to the Ethereum Mainnet had to pay some Gwei to do this, and so also in the check is a small reward of 0xBTC tokens for the relayer. This is what incentivises the relayers to submit the signed Lava Packets to the smart contract.
Here is a professional rendering:
You can play with this system at http://lavawallet.io but you have to set your Metamask to Ropsten Network.
Here is the code for the contract:
The most important method is the one which accepts the check (signed data), approveTokensWithSignature().
function approveTokensWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, uint256 nonce, bytes signature) public returns (bool)
Hopefully someone will make a ropsten 0xBTC faucet Before that, you can open the 0xBTC miner and run the command ‘test mine’ to mine for some test 0xBTCs automatically.
Test 0xBTC Contract:
Lava Wallet Contract:
Mining Delegate Contract: