Setting up for web applications
Modern ScatterJS for browsers
The quickest path for JS apps is the Scatter JavaScript SDK. If you still rely on scatter-js, switch to scatterjs-core to get newer features, faster calls, more chains, and SSL socket support so Scatter Desktop works across Safari, Firefox, Edge, Opera, and more.
Installation using NPM
Install the core package, then add the plugins for the blockchains you target.
npm i -S scatterjs-core
# eosjs
npm i -S scatterjs-plugin-eosjs # eosjs <= 16.0.9
npm i -S scatterjs-plugin-eosjs2 # eosjs 20+ / beta
# ethereum
npm i -S scatterjs-plugin-web3
# tron
npm i -S scatterjs-plugin-tron
# babel/webpack helpers if needed
npm i -D @babel/runtime
Installation for HTML/JS projects
Pick only the plugins you need, but always include the core.
<script src="https://cdn.scattercdn.com/file/scatter-cdn/js/latest/scatterjs-core.min.js"></script>
<script src="https://cdn.scattercdn.com/file/scatter-cdn/js/latest/scatterjs-plugin-eosjs.min.js"></script>
<script src="https://cdn.scattercdn.com/file/scatter-cdn/js/latest/scatterjs-plugin-eosjs2.min.js"></script>
<script src="https://cdn.scattercdn.com/file/scatter-cdn/js/latest/scatterjs-plugin-web3.min.js"></script>
<script src="https://cdn.scattercdn.com/file/scatter-cdn/js/latest/scatterjs-plugin-tron.min.js"></script>
Package names
In Node you can alias imports; in plain HTML they stay as-is. eosjs and eosjs2 share a name—don’t load both.
Using ScatterJS
Import the core and only the plugins you need. In HTML builds the plugin globals sit on window.
import ScatterJS from 'scatterjs-core';
import ScatterEOS from 'scatterjs-plugin-eosjs';
ScatterJS.plugins(new ScatterEOS());
Connecting to Scatter
One call connects to desktop, mobile, and classic. Fall back gracefully if the wallet isn’t present.
ScatterJS.scatter.connect('Your_App_Name').then((connected) => {
if (!connected) return false;
const scatter = ScatterJS.scatter;
window.ScatterJS = null;
});
Keep one reference in state
Connecting has overhead. Store a single ScatterJS reference in your app state (Redux, Vuex, services, etc.).
dispatch(setScatter(ScatterJS.scatter));
store.dispatch('setScatter', ScatterJS.scatter);
ScatterService.setScatter(ScatterJS.scatter);
window.ScatterJS = null;
Always null out window.ScatterJS after connecting to prevent other scripts from reusing it.
Topology & account discovery
Networks
Scatter keeps accounts grouped by network and Chain ID so testnets don’t bleed into mainnet flows. Define each network explicitly.
const network = {
blockchain: 'eos',
host: 'localhost',
port: 8888,
protocol: 'http',
chainId: ''
};
Host
IP or domain only—no protocol or port inline.
host: '127.0.0.1'
host: 'localhost'
host: 'nodes.get-scatter.com'
Port
Use numeric ports. Common: 80 (HTTP), 443 (HTTPS).
port: 80
port: 443
Protocol
Match the node’s config: usually http or https.
protocol: 'http'
protocol: 'https'
Chain ID matters
Chain ID is the primary key for accounts. If you omit it, lookups can fail even when host/port/protocol match.
chainId: '1'
chainId: 'acab4m20dlsdl3DlsSo3'
What Scatter speaks
Supported blockchains
Use these identifiers when fetching accounts or signature providers.
const Blockchains = {
EOSIO: 'eos',
Ethereum: 'eth',
Tron: 'trx',
};
const blockchain = Blockchains.EOSIO;
Want security expectations or troubleshooting? Read the Security guide or the full FAQ.
Interaction flow
Respectful user journey
Scatter enforces a sequence to protect users: connect, request identity, then sign.
import ScatterJS from 'scatterjs-core';
import ScatterEOS from 'scatterjs-plugin-eosjs';
import Eos from 'eosjs';
ScatterJS.plugins(new ScatterEOS());
const network = {
blockchain: 'eos',
protocol: 'https',
host: 'nodes.get-scatter.com',
port: 443,
chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906',
};
ScatterJS.scatter.connect('My-App').then((connected) => {
if (!connected) return false;
const scatter = ScatterJS.scatter;
const requiredFields = { accounts: [network] };
scatter.getIdentity(requiredFields).then(() => {
const account = scatter.identity.accounts.find((x) => x.blockchain === 'eos');
const eosOptions = { expireInSeconds: 60 };
const eos = scatter.eos(network, Eos, eosOptions);
const transactionOptions = {
authorization: [`${account.name}@${account.authority}`],
};
eos
.transfer(account.name, 'helloworld', '1.0000 EOS', 'memo', transactionOptions)
.then((trx) => console.log(`Transaction ID: ${trx.transaction_id}`))
.catch((error) => console.error(error));
}).catch((error) => console.error(error));
});