For developers
Build with Orien
Orien is a quantum-proof cryptocurrency whose payments are final in a fraction of a second. Everything here is free and open: the network, its code, the explorer’s API and Sign in with Orien Wallet. This page is everything you need to build with it.
The basics
- Units
- ORN has nine decimals. Everything below the surface counts in billionths of an ORN: 1 ORN is 1,000,000,000.
- Addresses
- 64 characters, 0–9 and a–f.
- Fees
- The sender pays 0.1% on top of the amount, at least 0.000001 and at most 1 ORN. The receiver gets the full amount. Fees go to the staked validators.
- Finality
- A payment is final in a fraction of a second, once validators holding more than two thirds of the stake have signed for it. There are no blocks and no confirmations to wait for.
- Checkpoints
- Once an hour the validators agree on every balance. An hour is an epoch, and checkpoint N closes epoch N. Mining rewards and fees are paid at each checkpoint.
- Validators
- Reached at v1.orien.network:7101 to v4.orien.network:7104, plus any staked validator. The orien command and Orien Wallet find them from the genesis file.
- Genesis file
- The network’s founding document, which every program checks against: orien.network/network/genesis.json. The installer puts it in ~/.orien.
The orien command
orien is the network’s own program: a wallet, a miner and a validator in one, for scripts and servers. Install it on a Mac or Linux:
curl -fsSL https://orien.network/install.sh | shOn Windows, in PowerShell:
irm https://orien.network/install.ps1 | iexThe installer checks the download against its signed checksum, and puts orien and the genesis file in ~/.orien. The wallet is ~/.orien/wallet unless you pass --wallet or set ORIEN_WALLET.
- orien wallet new
- A new wallet, with a 24-word recovery phrase to write down. orien wallet restore brings it back.
- orien wallet address
- The wallet’s address.
- orien balance [ADDRESS]
- A balance: your wallet’s, or any address’s. --json answers for programs.
- orien activity [ADDRESS]
- What came in and what was sent, from the validators themselves. --json answers for programs.
- orien send --to ADDRESS --amount 5
- Pays, and waits until the payment is final. --receipt FILE keeps the proof.
- orien verify FILE
- Checks a receipt offline, against the genesis file and the checkpoints.
- orien escrow / claim / escrow-status
- Locked payments: lock ORN behind a secret, claim it, or look one up.
- orien mine [ADDRESS]
- Mines for a wallet or any address. orien benchmark finds the best number of cores.
- orien status
- Every validator’s state, and the next checkpoint.
- orien ping HOST:PORT
- Whether a validator answers: exits with 0 if it does.
- orien keygen / node / stake / unstake
- Running a validator, and staking for it.
- orien update
- Installs the newest version, only if the Orien release key signed it.
- orien devnet init / run
- A local test network with test coins, for building against.
Every command explains itself with --help.
Accepting ORN
A payment can’t carry a note, so tell payments apart by who sent them or where they went. Either way you know the moment one is final.
- An address for each customer or order. Make a wallet for each with
orien wallet newand watch its address. - Know who your customers are. With Sign in with Orien Wallet, people sign in with their wallet, so you know its address and a payment from it is theirs.
To see payments arrive, ask the explorer’s API about your address. Final payments appear within seconds, withtime empty until the hour’s checkpoint:
https://explorer.orien.network/api/explorer/address/ADDRESS{
"address": "be5b7c…258b",
"balance": "40193878403538",
"activity": [
{
"epoch": 141,
"time": null,
"kind": "received",
"amount": "25000000000",
"counterparty": "c969e8…4352"
}
],
…
}Entries of kind received are payments to you, from counterparty, of amount billionths of an ORN. Or ask the validators themselves, with nothing of ours in between: orien activity ADDRESS --json lists the same payments, and orien balance ADDRESS --json gives the balance.
Sending ORN
From a server, send with the orien command. It returns once the payment is final:
orien send --to ADDRESS --amount 25 --receipt payment.receiptThe receipt holds the validators’ signatures for the payment. Anyone can check it offline with orien verify payment.receipt, which makes it proof of payment to anyone.
Listing ORN on an exchange? Listing ORN puts what you need on one page.
Send one payment at a time from one wallet, and keep each wallet on one computer. See Rules to build by.
Reading the network
The explorer’s API answers in JSON, free and with no key: the network now, every checkpoint, any address and the largest wallets. Up to 2 requests a second, with short bursts of 10.
The explorer’s API describes each address and field, with real answers.
Sign in with Orien Wallet
Let people sign in to your website with their Orien wallet, as with Phantom or MetaMask: no email, no password, and no ORN moves. They approve in the Orien Wallet browser extension, and your website gets their wallet address with a proof it checks itself, offline, with Orien’s quantum-safe signatures.
Sign in with Orien Wallet for developers has the code, and a demo to try.
Locked payments and swaps
A locked payment holds ORN for someone who can take it by revealing a secret before a deadline. After the deadline it returns to the sender by itself. Locks are what let people swap ORN for other cryptocurrencies with no one in the middle.
orien escrow --to ADDRESS --amount 500 --hours 48- The secret is 32 bytes; a lock names its SHA-256. Pass
--hashto lock behind someone else’s secret. Locks last 2 to 720 hours. - The receiver takes it with
orien claim ADDRESS:NUMBER, revealing the secret, andorien escrow-statusshows any lock and, once claimed, its secret. - On Solana the other side locks in the orien-lock program,
DAeXj31NAoSgno7SiFX7t4tWoMDBtpN9rn8c2X7WNtYE, which is final and can never be changed. On Bitcoin it is a script.
The design, step by step, is in the code’s locked payments and Solana swaps notes.
Mining
Every checkpoint releases new ORN, shared among the miners of that hour in proportion to the work shares each found. Mining uses RandomX, which suits ordinary computers’ processors. Work only shares out new ORN: it never decides payments.
orien mine ADDRESS --threads 4- Mine for any address; the miner needs no wallet of its own.
- The miner keeps itself on the newest signed release, so a change to the network’s rules never leaves it doing work nobody counts.
- The explorer shows who was paid at each checkpoint, and the network’s hashrate. Half of what remains of the 100 million cap is released every four years.
Running a validator
Anyone can run a validator by staking at least 10,000 ORN behind a validator key. It joins at the next checkpoint, earns a share of the fees in proportion to its stake, and votes on every payment. Run a validator walks through it step by step.
orien keygen validator.key orien node -k validator.key -d data --listen 0.0.0.0:7100 orien stake --amount 10000 --validator-key validator.key --address HOST:7100
- A validator that votes for two conflicting payments, or signs twice with one key, loses its stake at the next checkpoint.
orien unstakereleases stake after 168 checkpoints, a week, during which it can still be taken for cheating.- Validators install new signed releases by themselves, one at a time, in the minutes after a checkpoint. Allow about 45,000 open files: each connection uses a thread and two.
The code
Everything is open source, under the MIT or Apache 2.0 license, written in Rust: github.com/GnosysLabs/orien.
- orien-ledger
- Accounts, payments and their rules, checkpoints and mining work.
- orien-crypto
- BLAKE3 and the one-time hash-based signatures.
- orien-net
- Validators, and the client wallets use to pay and to read the network.
- orien-cli
- The orien command.
Use the crates from the repository as a git dependency. Build against a local test network first, with test coins: orien devnet init then orien devnet run. The technical paper states every rule exactly.
Rules to build by
- Never sign two payments at once from one wallet. Every payment is signed with a one-time key. Two copies of a wallet signing different payments at the same moment use one key twice, which can let someone forge a payment from it. Keep each wallet on one computer, and send from it one payment at a time.
- A signed payment can’t be cancelled. If sending stops halfway,
orien resumefinishes it as it was signed. - Keep the recovery phrase offline. Anyone with it can spend the wallet’s ORN. Seal wallet files with
orien wallet password. - Install only signed releases. The installer and
orien updatecheck the Orien release key’s signature.
Found a security problem? Please write to [email protected] before publishing it. Questions are welcome on Discord.