Skip to main content

Quick Start

Connect a device and sign an Ethereum transaction end-to-end.

info

The bridge popup requires a browser that exposes WebHID (navigator.hid) or Web Bluetooth (navigator.bluetooth) — today the Chromium-based desktop browsers such as Chrome and Edge — and it is blocked on mobile user agents; elsewhere it shows an unsupported-browser screen.

Integration flow​

A typical integration runs top to bottom. The Handled by column says which side owns each step:

#StepDescriptionHandled by
0Import import dcent from 'dcent-web-connector'Add the connector to your app.App
1Select transport setTransport()Choose the transport method.Connector
2Connect device in the DCENT popupA USB device that already has permission connects automatically; otherwise (always for Bluetooth) the user picks it in the popup.DCENT popup / user
3Get address getAddress()Read an address from the connected device.Connector
4Build transaction construct the payloadBuild the transaction to send.App
5Sign sign()Sign the transaction on the device.Connector
6Broadcast send to the networkSend the signed transaction to the network.App

Handled by Connector · Handled in the DCENT popup / by the user · Handled by your app

Steps 4 (build payload) and 6 (broadcast) are handled in your app.

1 · Select transport​

Call once before the first device interaction. If you omit it, the popup offers the transports the browser supports — but a USB device this browser already has permission for connects automatically without a choice.

import dcent from 'dcent-web-connector'

dcent.setTransport('hid') // WebHID over USB. Use 'ble' for Bluetooth.

2 · Get an address​

const res = await dcent.getAddress({
chainId: 'eip155:1/slip44:60',
keyPath: "m/44'/60'/0'/0/0",
})
const address = res.body.parameter.address // "0x6A5C…"

3 · Sign a transaction​

const signed = await dcent.sign({
method: 'signTransaction',
chainId: 'eip155:1/slip44:60',
payload: {
keyPath: "m/44'/60'/0'/0/0",
transaction: {
type: 2,
to: '0x000000000000000000000000000000000000dEaD',
value: '0x2386f26fc10000', // 0.01 ETH (wei, hex)
gasLimit: '0x5208',
maxFeePerGas: '0x77359400',
maxPriorityFeePerGas: '0x3b9aca00',
nonce: '0x0',
data: '0x',
},
},
})

if (signed.header.status === 'success') {
const rawTx = signed.body.parameter.signature // RLP-encoded signed tx
// 4 · broadcast: provider.send('eth_sendRawTransaction', [rawTx])
}
warning

Always pair request + response. A successful sign returns body.parameter.signature; a failure returns body.error.code (a string — see the Error Codes page).

Handle the result​

try {
const r = await dcent.sign({ /* … */ })
if (r.header.status === 'success') use(r.body.parameter)
else handleError(r.body.error.code) // 'user_cancel', 'param_error', …
} catch (e) {
// only input validation throws (e.g. missing keyPath, bad chainId) — before anything is sent;
// transport failures (popup closed, timeout) resolve as failure above
}
info

Stuck on the first call? Email contact@iotrust.kr with the chainId, the method, and the response you received.