ethereum/go-ethereum · error · Error

invalid iban address

Error message

invalid iban address

What it means

Iban.transfer converts the recipient 'to' argument to an Iban object and validates it with iban.isValid() (mod-97 checksum + format). If the string is not a well-formed IBAN, it throws 'invalid iban address' before constructing any transaction.

Source

Thrown at internal/jsre/deps/web3.js:6370

 * @date 2015
 */

var Iban = require('./iban');
var exchangeAbi = require('../contracts/SmartExchange.json');

/**
 * Should be used to make Iban transfer
 *
 * @method transfer
 * @param {String} from
 * @param {String} to iban
 * @param {Value} value to be transferred
 * @param {Function} callback, callback
 */
var transfer = function (eth, from, to, value, callback) {
    var iban = new Iban(to); 
    if (!iban.isValid()) {
        throw new Error('invalid iban address');
    }

    if (iban.isDirect()) {
        return transferToAddress(eth, from, iban.address(), value, callback);
    }
    
    if (!callback) {
        var address = eth.icapNamereg().addr(iban.institution());
        return deposit(eth, from, address, value, iban.client());
    }

    eth.icapNamereg().addr(iban.institution(), function (err, address) {
        return deposit(eth, from, address, value, iban.client(), callback);
    });
    
};

/**

View on GitHub (pinned to 6bb0588ad8)

Solutions

  1. Use Iban.fromAddress('0x...') or Iban.createIndirect(...) to generate a checksummed IBAN instead of hand-writing it.
  2. Validate first: new web3.eth.Iban(str).isValid() before calling transfer.
  3. If the recipient is a plain address, use eth.sendTransaction to the 0x address rather than Iban.transfer.
  4. Re-derive the checksum: recreate the IBAN with Iban tools or a checksum calculator.

Example fix

// before
Iban.transfer(eth, from, 'XE81ETHXREGGAVOFYORKx', value); // bad checksum

// after
var iban = new web3.eth.Iban('XE81ETHXREGGAVOFYORK');
if (iban.isValid()) Iban.transfer(eth, from, iban.toString(), value);
Defensive patterns

Strategy: type-guard

Validate before calling

var Iban = require('web3/lib/web3/iban'); // or web3.eth.Iban
function safeIbanTransfer(eth, from, to, value, cb) {
  var iban = new Iban(to);
  if (!iban.isValid()) throw new Error('not a valid IBAN: ' + to);
  return Iban.transfer(eth, from, to, value, cb);
}

Type guard

function isValidIban(s) {
  try { return new web3.eth.Iban(s).isValid(); } catch (e) { return false; }
}

Prevention

When it happens

Trigger: Calling Iban.transfer(eth, from, to, value[, callback]) with a malformed ICAP/IBAN string: wrong country code length, bad checksum digits, invalid institution/character layout. The synchronous no-callback path validates first and throws.

Common situations: Hand-typing an ICAP address (XE81ETHXREGGAVOFYORK style) with a checksum error, passing an 0x address where an IBAN was expected, or trailing whitespace/case issues corrupting the checksum.

Related errors


AI-assisted analysis of ethereum/go-ethereum@6bb0588ad8 (2026-08-15). Data as JSON: /api/errors/934f5edf08f3e3e3. Report an issue: GitHub.