Using Arbitrum

Using Arbitrum

The following highlight how to use Arbitrum with the SDK, CLI, and/or smart contracts.

Before diving into the details, be sure to check out the section about Arbitrum in Choosing a Chain, which details the basics about optimistic rollups and various links / resources that may be helpful during development.


Selecting a chain is rather straightforward when using the SDK. Upon connecting to Tableland, pass the chain as "arbitrum-goerli":

const tableland = await connect({ chain: "arbitrum-goerli" })

From there, chain interactions will now leverage Arbitrum Goerli. For Arbitrum One mainnet, simply do the following:

const tableland = await connect({ chain: "arbitrum" })


When using the CLI, you can check the different chains supported, which includes both the Arbitrum Goerli testnet and mainnet (since the CLI is built on top of the SDK). To use Arbitrum, specify the chain in a command — for example, with a read query:

> tableland chains # check the chains, optionally
> tableland read "SELECT * FROM healthbot_421613_1" --chain "arbitrum-goerli" 
> tableland read "SELECT * FROM healthbot_42161_1" --chain "arbitrum"

Smart Contracts

Selecting a chain is part of the smart contract deployment process. Since Arbitrum is EVM compatible, it’s easy to port over contracts that may have been developed on Ethereum or with Solidity since Arbitrum has full EVM support.

One of the most popular frameworks for deploying smart contracts is hardhat. Although the SDK and CLI examples above didn’t mention this, it is a best practice to use a provider for interacting with a chain. This ensures developers are not throttled and have full control of their deployment process.

When using hardhat, first set up a provider API key as well as a wallet private key. Make sure you store these in a .env that is never shared publicly. Sharing keys publicly could result in the loss of funds or unwanted usage of the API key itself.

In order to run hardhat with Arbitrum, first set up a project with hardhat using npx hardhat and follow the prompts (e.g., “Create a basic sample project”). Once a project is set up, one could run the following to deploy a contract on Arbitrum:

npx hardhat run scripts/deploy.js --network "arbitrum-goerli"

But first, the hardhat.config.js should be configured to resemble the following. Use dotenv as a best practice for accessing local environment variables like PRIVATE_KEY, ARBITRUM_API_KEY, and ARBITRUM_GOERLI_API_KEY. Note that the provider used here is Alchemy, but other providers can also be used with Tableland, too (including Etherscan and Infura):

module.exports = {
	solidity: "0.8.4",
	networks: {
		arbitrum: {
			url: `${process.env.ARBITRUM_API_KEY ?? ""}`,
			accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
		"arbitrum-goreli": {
			url: `${process.env.ARBITRUM_GOERLI_API_KEY ?? ""}`,
			accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],