Depends on #30
Block structure for solidity
Cut hashes up to 160 bits. It provides us 80bit reliability.
struct MerkleProof {
uint160 from,
bytes proof,
uint index
}
Use following structure of transactions:

Merkle proof index bit map
- 32 bits for block to tx merkle proof
- 1 bit for tx netto proof (must be zero for outputs, inputs, max_blockid and must be one for signatures)
- 5 bits for merkle proof for outputs, inputs and max_block_id
- 3 bits for merkle proof for signatures.
So, maximal outputNumber is limited by 31 (must checked on the contract for input structures).
Data types encoding
leaf = keccak256(concat(datatype_byte, abi.encode(data))
Simple exit challenges
Use following requests:
struct SimpleExit {
Input point
}
struct ExitQueueItem {
uint160 exitHash,
uint SFT
}
function withdrawal(Input point, address queuePtr) external payable returns (bool);
function withdrawalChallangeSpend(SimpleExit exit, address queuePtr,
Input spend, MerkleProof txProof, MerkleProof spendProof,
uint32 maxBlockId, MerkleProof maxBlockIdProof,
Signature sign, MerkleProof signProof) external returns (bool);
function withdrawalChallangeBlock(SimpleExit exit, address queuePtr, MerkleProof proof) external returns (bool);
- Somebody published exit and the bond. We check the validity of input on the contract and put it into the exit queue with finalization time ordered by
SFT = max(now+REP+MFT, input.timestamp+MFT), where REP=MFT=1 week. Also withdrawal emit SFT in event.
- anybody can challenge the spend of the input.
- anybody can challenge the existence of input inside the blockchain.
Signer guarantees validity of the transaction (or he have a risk to burn his money). That's why it is enough to check the signature and maxBlockId to run withdrawalChallangeSpend.
2nd, 3rd, 4th merkle proof are short (linked to tx hash, not to block hash).
.
UX for simple withdraw
- Somebody published exit and the bond. We check the validity of input on the contract and put it into the exit queue with finalization time ordered by SFT = max(now+REP+MFT, input.timestamp+MFT), where REP=MFT=1 week
- anybody can challenge the spend of the input.
- anybody can challenge the existence of input inside the blockchain.
If the input is challenged, it must be removed from the exit queue.
After finalization time the exit must be withdrawable in the queue order.
We must not store all information for the exit inside the storage. (hash, SFT) is enough to store, where hash is the hash of Input.

Depends on #30
Block structure for solidity
Cut hashes up to 160 bits. It provides us 80bit reliability.
Use following structure of transactions:
Merkle proof index bit map
So, maximal outputNumber is limited by 31 (must checked on the contract for input structures).
Data types encoding
leaf = keccak256(concat(datatype_byte, abi.encode(data))Simple exit challenges
Use following requests:
SFT = max(now+REP+MFT, input.timestamp+MFT), whereREP=MFT=1week. AlsowithdrawalemitSFTin event.Signer guarantees validity of the transaction (or he have a risk to burn his money). That's why it is enough to check the signature and maxBlockId to run
withdrawalChallangeSpend.2nd, 3rd, 4th merkle proof are short (linked to tx hash, not to block hash).
.
UX for simple withdraw
If the input is challenged, it must be removed from the exit queue.
After finalization time the exit must be withdrawable in the queue order.
We must not store all information for the exit inside the storage. (hash, SFT) is enough to store, where hash is the hash of Input.