Lexon

Lexon is a contract programming language for lawyers. Lexon scripts are compiled, in parallel, into legal English language contracts and blockchain smart contracts.

Smart Contracts are programs that can move money and resolve automatically. They don't need notaries, judges or attorneys, neither on the happy path nor to resolve edge cases or when the parties disagree about what should happen.

The English text describes precisely what the blockchain contract does. It allows for the smart contract program to be understable by non-programmers and to reason about whether it is legal. These are major roadblocks for the adoption of smart contracts.

The English text also serves as description how to use the smart contract that might be an offer for anyone to enter into, for example a crowd funding offer. The blockchain makes sure that the letters of the contract are exactly fulfilled.

# Lexys

The Computational Law Firm (Berlin)

- http://lexys.org - mail@lexys.org - https://github.com/lexys - https://claryon.github.io/lexon

# Example

This is a partial example for a crowdfunding contract. The contract allows a benificiary to set a funding goal and deadline. When after the deadline the funding goal is met, the beneficiary will collect the money. Otherwise the funders can withdraw it. This example shows the withdrawal part.

# Lexon Script

Here is the code not available (yet?)

ARTICLE: WITHDRAWAL. Comment: This article describes how collected funds can be withdrawn. SECTION 1: a funder wants to withdraw. IF WITHDRAWAL BY FUNDERS ALLOWED AND REQUESTER'S BALANCE GREATER THAN 0, THEN: TRANSFER REQUESTER'S BALANCE TO REQUESTER; AND IF THIS TRANSFER SUCCEEDS, THEN: RECORD: 'FUND TRANSFER', REQUESTER, BALANCE; AND SET REQUESTER'S BALANCE 0. SECTION 2: the beneficiary wants to pick up the funds. IF REQUESTER IS BENEFICIARY, AND SUM OF FUNDS GREATER OR EQUAL FUNDING GOAL, AND FUNDING DEADLINE PAST, THEN: TRANSFER AMOUNT RAISED TO BENEFICIARY; AND IF THIS TRANSFER SUCCEEDS, THEN: RECORD: 'FUND TRANSFER', BENEFICIARY, AMOUNT RAISED; OR ELSE ALLOW WITHDRAWAL BY FUNDERS.

# Legal English

ARTICLE: WITHDRAWAL. A PARTY CAN MAKE A WITHDRAWAL AS FOLLOWS. ON THE ETHEREUM MAINNET THE PARTY MAY INITIATE A DIGITALLY SIGNED 'CALL' FROM THE PARTY'S ETHEREUM MAINNET ACCOUNT, FOR A FEE, TO THIS CONTRACT'S SMART CONTRACT INSTANCE ON THE ETHEREUM MAINNET, SPECIFICALLY ITS FUNCTION 'withdrawal'. SECTION 1: a funder wants to withdraw. IF AT THE TIME WITHDRAWALS ARE ALLOWED AND IF THE REQUESTER'S BALANCE IS GREATER THAN ZERO, THEN THE REQUESTER'S BALANCE SHALL BE TRANSFERRED TO THE ACCOUNT OF THE REQUESTER ON THE ETHEREUM MAINNET IN THE CRYPTOCURRENCY ETHER. IF THIS TRANSFER SUCCEEDS, THEN: A PUBLIC 'FUND TRANSFER' ENTRY SHALL BE RECORDED ON THE ETHEREUM MAINNET RECEIPT LOG, RECORDING THE REQUESTER'S ACCOUNT NUMBER, AND THE BALANCE; AND THE REQUESTER'S BALANCE IS SET TO ZERO. SECTION 2: the beneficiary wants to pick up the funds. IF THE REQUESTER IS THE BENEFICIARY AND AND THE FUNDING GOAL HAS BEEN REACHED, THEN THE AMOUNT RAISED SHALL BE TRANSFERRED TO THE ACCOUNT OF THE BENEFICIARY ON THE ETHEREUM MAINNET, IN THE CRYPTOCURRENCY ETHER, IF THIS TRANSFER SUCCEEDS, THEN: A PUBLIC 'FUND TRANSFER' ENTRY SHALL BE RECORDED ON THE ETHEREUM MAINNET RECEIPT LOG, RECORDING THE BENEFICIARY'S ACCOUNT NUMBER, AND THE AMOUNT RAISED; OR ELSE, THE WITHDRAWAL BY FUNDERS IS ALLOWED FROM THEN ON.

And this is the smart contract to be executed on the blockchain, namely Solidity code for Ethereum.

# Smart Contract

function withdrawal() { if (funderWithdrawalsAllowed && balanceOf[msg.sender] > 0) { bool ok = msg.sender.send(balanceOf[msg.sender]); if (ok) { FundTransfer(msg.sender, balanceOf[msg.sender], false); balanceOf[msg.sender] = 0; } } if (beneficiary == msg.sender && amountRaised >= fundingGoal && now >= deadline) { bool ok = beneficiary.send(amountRaised); if (ok) { FundTransfer(beneficiary, amountRaised, false); } else { funderWithdrawalsAllowed = true; } } }

# See also

~

‘Computer language that anyone can read’ launches Aeternity compiler post