For Developers

Smart contracts in plain JavaScript.

No Solidity. No Rust. No new language to learn. Write contracts in JavaScript, test them in your browser, deploy to a chain with 2-second target blocks, fast finality and post-quantum signatures.

Contract Source

It looks like the code you already write.

// A weekly subscription that charges itself.
// Customers approve the token once. The cron registry calls chargeAll.
const WEEK = 7n * 24n * 60n * 60n * 1000n; // chain.blockTimestamp is in ms

({
  // token, merchant and the cron registry come in as ase1 addresses;
  // the SDK passes them to the contract as lowercase hex.
  init(token, merchant, cron) {
    assert(!storage.get('token'), 'already initialised');
    storage.set('token', token);
    storage.set('merchant', merchant);
    storage.set('cron', cron);
  },

  subscribe(amountPerWeek) {
    const sub = {
      amount: BigInt(amountPerWeek).toString(),
      nextCharge: (chain.blockTimestamp + WEEK).toString(),
    };
    storage.set('sub:' + msg.sender, JSON.stringify(sub));
    emit('Subscribed', { user: msg.sender, amount: sub.amount });
  },

  // Fired by the cron registry every day.
  chargeAll() {
    assert(msg.sender === storage.get('cron'), 'only the cron registry');
    for (const key of storage.keys('sub:')) {
      const sub = JSON.parse(storage.get(key));
      if (chain.blockTimestamp < BigInt(sub.nextCharge)) continue;
      const user = key.slice(4);
      try {
        E(storage.get('token')).transferFrom(user, storage.get('merchant'), sub.amount);
      } catch (err) {
        emit('ChargeFailed', { user });
        continue;
      }
      sub.nextCharge = (BigInt(sub.nextCharge) + WEEK).toString();
      storage.set(key, JSON.stringify(sub));
      emit('Charged', { user, amount: sub.amount });
    }
  },
});

A contract is one script that ends in an object literal. Its methods are the contract. Storage holds strings, so structured values go through JSON.stringify and JSON.parse, and amounts are stored as decimal strings.

Then one transaction to the cron registry, and the chain calls chargeAll every day:

// wallet: an AsentumWallet. subs: the deployed contract's ase1 address.
const CRON = 'ase1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxgkr943'; // cron registry
const DAY_MS = 86_400_000;

await wallet.sendCall({
  to: CRON,
  method: 'schedule',
  args: [
    subs, 'chargeAll', [],   // target, method, args
    Date.now() + DAY_MS,     // first run, in ms
    DAY_MS, 0, 2_000_000,    // every day, no run limit, gas per run
  ],
  valueWei: 2_000_000n * 365n, // gas escrow, refunded when the job ends
});

Deployed as plain source. Readable on-chain. Verifiable in a single hash compare. A contract already on the call stack cannot be called again, so reentrancy is blocked.

01Write

Write your contract in JavaScript.

Use storage, emit, msg, chain and assert, globals injected by the VM. A contract is one script that ends in an object literal of methods. No compiler, no ABI generation, no build step.

02Test

Test it live in your browser.

The Asentum IDE at ide.asentum.com lets you write, deploy, and interact with contracts without installing anything.

03Deploy

Deploy to testnet in seconds.

One click from the IDE, or use the SDK and CLI. Your contract is live within seconds, on 2-second target blocks. Post-quantum signed from the first block.

Side-by-side

The same contract. In both languages.

A weekly subscription that charges itself. The Solidity version needs Chainlink Keepers (external service, LINK funding, registered upkeep) and a manual subscribers array because mappings can't be iterated. The Asentum version lists its subscribers with storage.keys and is fired by the chain's own cron registry.

Solidity / EVM~52 lines + external Keepers
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@chainlink/contracts/src/v0.8/AutomationCompatible.sol";

contract Subscriptions is AutomationCompatibleInterface {
    IERC20 public immutable token;
    address public immutable merchant;

    struct Sub { uint256 amount; uint256 nextCharge; }
    mapping(address => Sub) public subs;
    address[] public subscribers;
    mapping(address => bool) private known;

    event Subscribed(address indexed user, uint256 amount);
    event Charged(address indexed user, uint256 amount);

    constructor(IERC20 _token, address _merchant) {
        token = _token; merchant = _merchant;
    }

    function subscribe(uint256 amountPerWeek) external {
        subs[msg.sender] = Sub(amountPerWeek, block.timestamp + 7 days);
        if (!known[msg.sender]) {
            known[msg.sender] = true;
            subscribers.push(msg.sender);
        }
        emit Subscribed(msg.sender, amountPerWeek);
    }

    function checkUpkeep(bytes calldata) external view
        returns (bool upkeepNeeded, bytes memory)
    {
        for (uint i = 0; i < subscribers.length; i++) {
            if (block.timestamp >= subs[subscribers[i]].nextCharge)
                return (true, "");
        }
        return (false, "");
    }

    function performUpkeep(bytes calldata) external {
        for (uint i = 0; i < subscribers.length; i++) {
            address u = subscribers[i];
            Sub storage s = subs[u];
            if (block.timestamp >= s.nextCharge) {
                token.transferFrom(u, merchant, s.amount);
                s.nextCharge += 7 days;
                emit Charged(u, s.amount);
            }
        }
    }
}
// + register with Chainlink Automation (fund LINK)
Asentum / JavaScript~45 lines + one schedule call
// A weekly subscription that charges itself.
// Customers approve the token once. The cron registry calls chargeAll.
const WEEK = 7n * 24n * 60n * 60n * 1000n; // chain.blockTimestamp is in ms

({
  // token, merchant and the cron registry come in as ase1 addresses;
  // the SDK passes them to the contract as lowercase hex.
  init(token, merchant, cron) {
    assert(!storage.get('token'), 'already initialised');
    storage.set('token', token);
    storage.set('merchant', merchant);
    storage.set('cron', cron);
  },

  subscribe(amountPerWeek) {
    const sub = {
      amount: BigInt(amountPerWeek).toString(),
      nextCharge: (chain.blockTimestamp + WEEK).toString(),
    };
    storage.set('sub:' + msg.sender, JSON.stringify(sub));
    emit('Subscribed', { user: msg.sender, amount: sub.amount });
  },

  // Fired by the cron registry every day.
  chargeAll() {
    assert(msg.sender === storage.get('cron'), 'only the cron registry');
    for (const key of storage.keys('sub:')) {
      const sub = JSON.parse(storage.get(key));
      if (chain.blockTimestamp < BigInt(sub.nextCharge)) continue;
      const user = key.slice(4);
      try {
        E(storage.get('token')).transferFrom(user, storage.get('merchant'), sub.amount);
      } catch (err) {
        emit('ChargeFailed', { user });
        continue;
      }
      sub.nextCharge = (BigInt(sub.nextCharge) + WEEK).toString();
      storage.set(key, JSON.stringify(sub));
      emit('Charged', { user, amount: sub.amount });
    }
  },
});

Native cron

One schedule transaction to the cron registry system contract, paid from an escrow, vs registering with Chainlink Automation, funding LINK, and waiting for off-chain triggers.

Iterable storage

storage.keys(prefix) lists every key under a prefix, sorted. Solidity mappings can't be iterated, so you maintain a parallel array by hand.

No constructor, no ABI, no compile

Deploy source directly, then call init like any other method. The VM is the runtime. Inspect any contract on-chain in plain JavaScript.

New in 0.9.0 · Block 1,200,000

Native @usernames.

Resolve @names with one call: GET /name/:name, GET /name-of/:address, ase_resolveName and ase_lookupAddress on every node, plus resolveName and lookupAddress in the SDK, and a wallet method for every write (register, transfer, primary, records) in @asentum/sdk 0.3.1. The address stays the account; the name is a pointer.

Send to @name

Wallets resolve a name to its address when you sign, and the confirm screen shows both.

One primary name

Apps show your primary @name next to your address: the explorer, the airdrop leaderboard, Social and Communities.

Built into the chain

A system contract every node can read. No third-party resolver: any app gets names on day one.

Fees: 3 characters 500 ASE, 4 characters 100 ASE, 5 characters 50 ASE, 6 or more 10 ASE. Half burned, half to the treasury. Testnet names do not carry over to mainnet.

Contract VM

What your contract has access to.

Contracts run inside SES (Secure ECMAScript), a hardened JavaScript sandbox. No filesystem, no network, no eval. These seven globals are everything the VM injects:

storage

Key-value store: get, set, delete, has, keys(prefix). Values are stored as strings.

emit

Emit named events with data. Indexed and queryable.

msg

Call context: sender, value (BigInt), contractAddress.

chain

Block context: blockNumber, blockTimestamp (ms), chainId. All BigInt.

E(addr)

Cross-contract calls, synchronous. A contract on the call stack cannot be re-entered.

transfer

Send ASE from the contract to another address.

assert

assert(condition, message) throws and reverts when the condition is falsy.

Scheduling

Not a global. Call schedule on the cron registry system contract (ARC-21).

Tutorial

Build a token in 10 minutes.

Step-by-step guide: write a token contract, deploy it, transfer tokens, query balances.

Guide

Hardened JavaScript explained.

How SES protects contracts from prototype pollution, eval injection, and supply chain attacks.

Reference

Network parameters.

Chain ID, block time, gas limits, contract size limits, and every protocol constant.

Testnet Live

Stop learning new languages. Start building.