Deploy Your First Contract
Last updated March 20, 2026 ยท Estimated read time: 10 minutes
1.1 Your First Contract
In this guide, you'll write a simple token contract in JavaScript, deploy it to the Asentum testnet, and interact with it โ all in under 10 minutes. No Solidity. No Hardhat. Just JavaScript.
1.2 Using the Playground
The fastest path is the browser playground. Open playground.asentum.io, pick "Token" from the template gallery, and you'll have a working contract in the editor. The playground auto-funds a testnet wallet for you โ no faucet visit needed.
Alternatively, use the CLI: npx @asentum/cli init my-token --template token.
1.3 Writing the Contract
Asentum contracts are ES module classes. Here's a minimal token:
export default class MyToken {
constructor() {
this.name = "MyToken";
this.symbol = "MTK";
this.balances = {};
this.totalSupply = 0;
}
init(initialSupply) {
this.balances[msg.sender] = initialSupply;
this.totalSupply = initialSupply;
}
transfer(to, amount) {
assert(this.balances[msg.sender] >= amount, "Insufficient balance");
this.balances[msg.sender] -= amount;
this.balances[to] = (this.balances[to] || 0) + amount;
emit("Transfer", { from: msg.sender, to, amount });
}
balanceOf(address) {
return this.balances[address] || 0;
}
}Class properties are auto-persisted to chain state. msg.sender is the caller's address. assert() reverts the transaction on failure. emit() fires an indexed event.
1.4 Deploy to Testnet
Playground: Click "Deploy" โ done. The playground shows your contract address and a UI to call methods. CLI: Run npx @asentum/cli deploy --network testnet. Deployment costs ~32,000 gas + 200 gas per byte of contract code.
1.5 Interact with Your Contract
Call init(1000000) to mint tokens to your address, then transfer(recipientAddress, 100) to send some. Check the block explorer to see your transactions confirmed in ~3 seconds.
1.6 What's Next
You've deployed your first contract. From here, explore the template gallery (NFTs, DAOs, DEXes), read the advanced features guide, or start building your own dApp with @asentum/sdk.