专栏首页Netkiller以太坊 Iban 地址

以太坊 Iban 地址

本文节选自电子书《Netkiller Blockchain 手札》

Netkiller Blockchain 手札

Mr. Neo Chan, 陈景峯(BG7NYT)

中国广东省深圳市龙华新区民治街道溪山美地 518131 +86 13113668890 <netkiller@msn.com>


版权 © 2018 Netkiller(Neo Chan). All rights reserved.





为什么会写区块链电子书?因为2018年是区块链年,区块链是一个风口,前几个风口我都错过了。例如web2.0, 云, 大数据等等,都从身旁擦肩而过。所以我要抓住这次。

这本电子书是否会出版(纸质图书)? 不会,因为互联网技术更迭太快,纸质书籍的内容无法实时更新,一本书动辄百元,很快就成为垃圾,你会发现目前市面的上区块链书籍至少是一年前写的,内容已经过时,很多例子无法正确运行。所以我不会出版,电子书的内容会追逐技术发展,及时跟进软件版本的升级,做到内容最新,至少是主流。

这本电子书与其他区块链书籍有什么不同?市面上大部分区块链书籍都是用2/3去讲区块链原理,只要不到 1/3 的干货,干货不够理论来凑,通篇将理论或是大谈特谈区块链行业,这些内容更多是头脑风暴,展望区块链,均无法落地实施。本书与那些书籍完全不同,不讲理论和原理,面向应用落地,注重例子,均是干货。


电子书更新频率?每天都会有新内容加入,更新频率最迟不会超过一周,更新内容请关注 https://github.com/netkiller/netkiller.github.io/commits/master

本文采用碎片化写作,原文会不定期更新,请尽量阅读原文 http://www.netkiller.cn/blockchain/index.html


接受 ETH 打赏:0x3e827461Cc53ed7c75A29187CfF39629FCAE3661

相关文章 https://github.com/ethereum/wiki/wiki/ICAP:-Inter-exchange-Client-Address-Protocol


Transferring funds between third-party accounts, especially those of exchanges, places considerable burden on the user and is error prone, due to the way in which deposits are identified to the client account. This problem was tackled by the existing banking industry through having a common code known as IBAN. This code amalgamated the institution and client account along with a error-detection mechanism practically eliminating trivial errors and providing considerable convenience for the user. Unfortunately, this is a heavily regulated and centralised service accessible only to large, well-established institutions. The present protocol, ICAP, may be viewed as a decentralised version of it suitable for any institutions containing funds on the Ethereum system.


For a good overview of the IBAN system, please see Wikipedia's IBAN article. An IBAN code consists of up to 34 case insensitive alpha-numeric characters. It contains three pieces of information:

  • The country code; a top-level identifier for the context of the following (ISO 3166-1 alpha-2);
  • The error-detection code; uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003);
  • The basic bank account number (BBAN); an identifier of the institution, branch and client account, whose composition is dependent on the aforementioned country.

For the UK, the BBAN is composed of:

  • Institution identifier, 4-character alphabetical, e.g. MIDL (ironically) represents HSBC bank.
  • Sort-code (branch identifier within the institution), a 6-digit decimal number, e.g. 402702 would be the Lancaster branch of HSBC.
  • Account number (client identifier within the branch), an 8-digit decimal number.

Proposed Design

Introduce a new IBAN country code: XE, formulated as the Ethereum E prefixed with the "extended" X, as used in non-jurisdictional currencies (e.g. XRP, XCP).

There will be three BBAN possibilities for this code; direct, basic and indirect.


The BBAN for this code when direct will be 30 characters and will comprise one field:

  • Account identifier, 30 characters alphanumeric (< 155-bit). This will be interpreted as a big-endian encoded base-36 integer representing the least significant bits of a 160-bit Ethereum address. As such, these Ethereum addresses will generally begin with a zero byte.

e.g. XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS corresponds to the address 00c5496aee77c1ba1f0854206a26dda82a81d6d8.


The same as the direct encoding, except that the code is 31 characters (making it non-compliant for IBAN) and composes the same, single, field:

  • Account identifier, 31 characters alphanumeric (< 161-bit). This will be interpreted as a big-endian encoded base-36 integer representing a 160-bit Ethereum address.


The BBAN for this code when indirect will be 16 characters and will comprise three fields:

  • Asset identifier, 3-character alphanumeric (< 16-bit);
  • Institution identifier, 4-character alphanumeric (< 21-bit);
  • Institution client identifier, 9-character alphanumeric (< 47-bit);

Including the four initial characters, this leads to a final client-account address length of 20 characters, of the form:

Split into:

  • XE The country code for Ethereum;
  • 81 The checksum;
  • ETH The asset identifier within the client account - in this case, "ETH" is the only valid asset identifier, since Ethereum's base registry contract supports only this asset;
  • XREG The institution code for the account - in this case, Ethereum's base registry contract;
  • GAVOFYORK The client identifier within the institution - in this case, a direct payment with no additional data to whatever primary address is associated with the name "GAVOFYORK" in Ethereum's base registry contract;


Institution codes beginning with X are reserved for system use.

Other forms


General URIs can be formed though the URI scheme name iban, followed by the colon character :, followed by the 20-character alphanumeric identifier, thus for the example above, we would use:

QR Code

A QR code may be generated directly from the URI using standard QR encodings. For example, the example above iban:XE81ETHXREGGAVOFYORK would have the corresponding QR code:

Transaction Semantics

The mechanism for indirect asset transfer over three routing protocols are specified, all of which are specific to the Ethereum domain (country-code of XE). One is for currency transfers directly to an included address ("direct"), another is for clients with the system address found through a Registry-lookup system of the client-ID, denoted by asset class ETH, whereas the last is for transfers to an intermediary with associated data to specify client, denoted by asset class XET (the latter two are "indirect").


If the IBAN code is 34 characters, it is a direct address; a direct transfer is made to the address which, when base-36 encoded gives exactly the data segment (the last 30 characters) of the IBAN code.

Indirect ETH Asset: Simple transfers

Within the ETH asset code of Ethereum's country-code (XE), i.e. as long as the code begins with XE**ETH (where ** is the valid checksum), then we can define the required transaction to be the deposit address given by a call to the registry contract denoted by the institution code. For institutions not beginning with X, this corresponds to the primary address associated with the Ethereum standard name:

[institution code] / [client identifier]

The Ethereum standard name is simply the normal hierarchical lookup mechanism, as specified in the Ethereum standard interfaces document.

We define a registry contract as a contract fulfilling the Registry interface as specified in the Ethereum standard interfaces document.

TODO: JS code for specifying the transfer.

Indirect XET Asset: Institution transfers

For the XET asset code within the Ethereum country code (i.e. while the code begins XE**XET), then we can derive the transaction that must be made through a lookup to the Ethereum iban registry contract. For a given institution, this contract specifies two values: the deposit call signature hash and the institution's Ethereum address.

At present, only a single such deposit call is defined, which is:

whose signature hash is 0x13765838. The transaction to transfer the assets should be formed as an ether-laden call to the institution's Ethereum address using the deposit method as specified above, with the client account determined through the value of the big-endian, base-36 interpretation of the alpha-numeric Institution client identifier, literally using the value of the characters 0 to 9, then evaluating 'A' (or 'a') as 10, 'B' (or 'b') as 11 and so forth.

TODO: JS code for specifying the transfer.

IBAN 格式如下



	public static void main(String[] args) {
		IBAN iban = new IBAN();
		// TODO Auto-generated method stub
		String address = iban.toAddress("XE039RBH0XKV9FZMTH2701Q37FLX10NTWXU");
		System.out.println("IBAN to Address: " + address);

		String ibanAddress = iban.toIban("0x538b392D57d867A57eE8Eed05737cB08B4691302");
		System.out.println("Address to IBAN: " + ibanAddress);

		Iban ibanObj = iban.decode("iban:XE039RBH0XKV9FZMTH2701Q37FLX10NTWXU?token=ETH&amount=5");
		System.out.println("IBAN decode: " + ibanObj.toString());

		String ibanString = iban.encode("0x538b392D57d867A57eE8Eed05737cB08B4691302", "NBRC", "5");
		System.out.println("IBAN encode: " + ibanString);


IBAN to Address: 0x538b392d57d867a57ee8eed05737cb08b4691302
IBAN decode: Iban [ibanAddress=0x538b392d57d867a57ee8eed05737cb08b4691302, token=ETH, amount=5]
IBAN encode: iban:XE039RBH0XKV9FZMTH2701Q37FLX10NTWXU?token=NBRC&amount=5


如有侵权,请联系 yunjia_community@tencent.com 删除。


0 条评论
登录 后参与评论


  • How Badoo saved one million dollars switching to PHP7

    How Badoo saved one million dollars switching to PHP7 By Badoo on 14 Mar 2016 - ...

    netkiller old
  • 数据库安全·保护表字段

    以下节选择《Netkiller Architect 手札》地址 http://www.netkiller.cn/architect/ 接下来几周的话题是数据库安...

    netkiller old
  • Email 服务器之 SPF 记录

    节选自《Netkiller Mail 手札》 6.1. Sender Policy Framework 6.1.1. 分析 SPF 记录 从主域开始查看 txt...

    netkiller old
  • SAP Hybris和CRM WebUI里UI模型的类比

    Jerry Wang
  • SAP S/4HANA里如何创建Customer主数据以及执行后续处理

    1, Launch tcode: BP and select the Organization 2, Maintain the information for...

    Jerry Wang
  • REST API设计指导——译自Microsoft REST API Guidelines(四)

    前面我们说了,如果API的设计更规范更合理,在很大程度上能够提高联调的效率,降低沟通成本。那么什么是好的API设计?这里我们不得不提到REST API。

  • 关于db_files和maxdatafiles的问题(r4笔记第31天)


  • Kubernetes Scheduler Extender浅析

    Scheduler 组件可以视为一种监视 watche 和将 Pod 分配 assign 到 Node 的特殊类型控制器 controller。在 Kubern...

  • JDBC读取数据优化-fetch size


  • Font support in Adobe form

    版权声明:署名,允许他人基于本文进行创作,且必须基于与原先许可协议相同的许可协议分发本文 (Creative Commons)

    Jerry Wang