Quick Start
Connect a device and sign an Ethereum transaction end-to-end.
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:
| # | Step | Description | Handled by |
|---|---|---|---|
| 0 | Import import dcent from 'dcent-web-connector' | Add the connector to your app. | App |
| 1 | Select transport setTransport() | Choose the transport method. | Connector |
| 2 | Connect device in the DCENT popup | A USB device that already has permission connects automatically; otherwise (always for Bluetooth) the user picks it in the popup. | DCENT popup / user |
| 3 | Get address getAddress() | Read an address from the connected device. | Connector |
| 4 | Build transaction construct the payload | Build the transaction to send. | App |
| 5 | Sign sign() | Sign the transaction on the device. | Connector |
| 6 | Broadcast send to the network | Send 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])
}
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
}
Stuck on the first call? Email contact@iotrust.kr with the chainId, the method, and the response you received.