比特币(BSV)知识库:应用-比特币地址(Bitcoin address)

​​​​​​​​​​​​​​​

更新日期:2022年2月11日 


比特币地址

比特币地址,简称地址,是一串由26-35个字母或数字字符组成的标识符。地址以数字1开头,在进行比特币支付时,它代表了在P2PKH输出中使用的公钥哈希。BSV目前使用的地址格式的前缀数字是1。例如:1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2

地址的隐私问题

如果比特币用户使用同一个比特币地址接收所有对他的付款,那么任何人都可以轻易地发现这个用户有多少钱,以及他用这笔钱做了什么。为保护用户隐私,我们不鼓励地址重复使用。用户保护原本就在比特币最初的设计中, 比特币白皮书的《10隐私中提到了:

As an additional firewall, a new key pair should be used for each transaction to keep them from being linked to a common owner.

(每笔交易都应该使用一个新的密钥对,它可以成为额外的防火墙,防止这些交易能够链接到同一个所有者。)

在离线时创建地址

创建地址可以在没有连接互联网的情况下完成,这个过程不需要与比特币网络进行任何联系或注册。可以使用免费的软件工具离线创建大量地址。在很多情况下,批量生成地址是很有用的,例如电子商务网站,可以通过这个功能向每个选择“用比特币支付”选项的客户分配一个唯一的预生成地址。新推出的“HD钱包”可以生成“主公钥”token,该token可用于允许不受信任的系统(例如网络服务器)生成无限数量的地址,而无需访问私钥,也不能创建出相应的私钥。

地址通常区分大小写,且必须保证准确

旧式比特币地址是区分大小写的。应当尽量使用计算机的剪贴板复制和粘贴比特币地址。如果您通过键入“逐个字符”来复制比特币地址,且未能确保每个字符都被准确转录(包括字母未能大写),那么这样的错误地址很可能会被BSV钱包软件拒绝。您必须检查输入的内容并再次重试。

由于存在4字节的校验和,输错的地址被接受为有效地址的概率仅为232分之一,即大约42.9亿分之一。不过,在这种罕见的情况下,如果收款人向付款人提供了错误地址,收款人将永远无法解锁被发送到错误地址的资金。

证明您收到了地址

大多数比特币钱包都有“签署”消息的功能,用来证明拥有该地址的,接收资金的实体已经同意了消息。例如,这个功能可用于在付款之前,以密码学的、可证明的方式完成合同“签署”。

一些服务还通过将特定地址专门用于身份验证来搭载此功能,在这种情况下,该地址不应用于实际的比特币交易。当您登录或使用他们的服务时,您将提供一个签名,证明您与预先协商的地址的所有者是同一个人。

当前的消息签名标准只与“版本0”的比特币地址兼容,这些地址以数字1开头。

地址验证

如果您想在应用程序中验证比特币地址的有效性,建议使用此线程中的方法:https://bitcointalk.org/index.php?topic=1026.0 ,而不是仅仅检查字符串长度、以及被允许的字符或该地址是否以1开头。此验证过程也可以使用提供多种语言的开源代码或在线验证工具来完成,请参考:

Bitcoin/address validation - Rosetta Code

Bitcoin Base58 Encoder, Decoder, and Validator 

地址中都有什么

大多数BSV地址有34个字符。它们随机地由数字和大写字母和小写字母组成,除了大写字母“O”、大写字母“I”、小写字母“l”和数字“0”,删除这些元素是为了防止由视觉产生的歧义。

一些BSV地址可以少于34个字符并且仍然有效,很大一部分比特币地址只有33个字符,有些地址甚至可能更短(比如26个字符)。每个比特币地址代表一个数字。这些较短的地址之所以有效,只是因为它们代表的数字恰好以零开头,当省略其前导零时,编码地址就会变短。

比特币地址中有几个字符被用作校验和,以便可以自动发现拼字错误,并拒绝向该地址发送比特币。校验和还使得比特币软件可以判断出33 个字符(或更短)的地址是有效的,而不是一个缺少字符的地址。

测试网

BSV测试网上的地址有不同的版本,因此它们也具有不同的前缀。

误解

地址重复使用

地址不应当被多次使用,这样做会带来许多相关的问题。详细信息请参阅地址重复使用。

地址里的余额

需要注意的是,地址既不是钱包也不是账户,也不拥有余额。地址仅用来接收资金,“从”某个地址发送资金出去的这种观点是错误的。但是现在服务和软件加剧了这种混淆,他们使用“地址余额”这个概念来显示“通过地址收到的比特币”减去“在随机的无关的交易中发送的比特币”的资金余额。但是,这个“地址余额”值没有意义;因为它既不能表示地址的所有者是否已经花费了这笔资金,也不能表示他是否还保留着这些比特币资金。

举个例子来说明这种误区:比如现在用户认为他的“地址里包含了3BSV”,现在他提交了一笔要花费0.5BSV的交易,然后他认为“地址现在应该有2.5BSV”,然而实际上这个地址里现在是0BSV。因为地址不重复使用的原则,这笔交易中找零的2.5BSV被转移到了另一个地址里。要是用户没有对新地址进行备份,就有可能造成永久性的资金损失。这种情况在纸钱包的用户的身上发生过几次。

“发件人”地址

在BSV交易的信息中,不存在“发件人”地址信息、付款地址、资金来源地址。

其他资料

• 比特币地址的技术背景

• 椭圆曲线数字签名算法

• 钱包和密钥管理

• Base58Check编码

内容来源

本篇文章基于Creative Commons Attribution 3.0https://en.bitcoin.it/wiki/Address虽然它可能已被大量修订和更新,但我们仍要向原作者致以感谢。

                                                                                                                                                                       

Bitcoin address

A Bitcoin address, or simply address, is an identifier of 26-35 alphanumeric characters, beginning with the number 1 that represents a public key hash to be used in a P2PKH output to create a Bitcoin payment. Bitcoin SV currently utilizes an address format delineated with the prefix number 1. e.g: 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2.

Privacy concerns

If a Bitcoin user receives all of their payments into a single Bitcoin address it becomes very easy for anyone to discover how much money they have and what they are doing with that money. To protect user privacy, Address reuse is discouraged. This idea is part of the original plan for user protections in Bitcoin and is mentioned in Section 10: Privacy of the Bitcoin Whitepaper where it is stated:

As an additional firewall, a new key pair should be used for each transaction to keep them from being linked to a common owner.

Offline creation

Creating addresses can be done without an Internet connection and does not require any contact or registration with the Bitcoin network. It is possible to create large batches of addresses offline using freely available software tools. Generating batches of addresses is useful in several scenarios, such as e-commerce websites where a unique pre-generated address is dispensed to each customer who chooses a "pay with Bitcoin" option. Newer "HD wallets" can generate a "master public key" token which can be used to allow untrusted systems (such as webservers) to generate an unlimited number of addresses without having access to or being able to create the corresponding private keys.

Addresses are often case sensitive and exact

Old-style Bitcoin addresses are case-sensitive. Bitcoin addresses should be copied and pasted using the computer's clipboard wherever possible. If you copy a Bitcoin address by re-typing the address ‘character by character’, and each character is not transcribed exactly - including capitalization - the incorrect address will most likely be rejected by the Bitcoin SV wallet software. You will have to check your entry and try again.

Due to the presence of a 4 byte checksum, the probability that a mistyped address is accepted as being valid is 1 in 232 , that is, approximately 1 in 4.29 billion. Importantly, in this rare case, a payee providing a payer with an incorrect address will lead to the payee being unable to ever unlock the funds sent to said incorrect address.

Proving you receive with an address

Most Bitcoin wallets have a function to "sign" a message, proving the entity receiving funds with an address has agreed to the message. This can be used to, for example, finalise a contract in a cryptographically provable way prior to making payment for it.

Some services will also piggy-back on this capability by dedicating a specific address for authentication only, in which case the address should never be used for actual Bitcoin transactions. When you login to or use their service, you will provide a signature proving you are the same person with the pre-negotiated address.

Current standards for message signatures are only compatible with "version zero" Bitcoin addresses (that begin with the number 1).

Address validation

If you would like to validate a Bitcoin address in an application, it is advisable to use a method from this thread rather than to just check for string length, allowed characters, or that the address starts with a 1. Validation may also be done using open source code available in various languages or with an online validating tool.

What's in an address

Most Bitcoin SV addresses are 34 characters. They consist of random digits and uppercase and lowercase letters, with the exception that the uppercase letter "O", uppercase letter "I", lowercase letter "l", and the number "0" are never used to prevent visual ambiguity.

Some Bitcoin SV addresses can be shorter than 34 characters (as few as 26) and still be valid. A significant percentage of Bitcoin addresses are only 33 characters, and some addresses may be even shorter. Every Bitcoin address stands for a number. These shorter addresses are valid simply because they stand for numbers that happen to start with zeroes, and when the zeroes are omitted, the encoded address gets shorter.

Several of the characters inside a Bitcoin address are used as a checksum so that typographical errors can be automatically found and rejected. The checksum also allows Bitcoin software to confirm that a 33-character (or shorter) address is in fact valid and is not simply an address with a missing character.

Testnet

Addresses on the Bitcoin SV Testnet are generated with a different address version, which results in a different prefix.

Misconceptions

Address reuse

Addresses are not intended to be used more than once, and doing so has numerous problems associated. See the dedicated article on address reuse for more details.

Address balances

It is important to note that addresses are not wallets nor accounts, and do not carry balances. Addresses only receive funds, the transfer of funds should not be seen at any time as the funds being sent ‘from’ an address. Unfortunately, services and software have contributed to this confusion by displaying ‘bitcoins received with an address - bitcoins sent in random unrelated transactions’ as an "address balance". However, this “address balance” value is not meaningful; it does not imply that the recipient of the bitcoins sent to the address had spent them, nor that said recipient had retained the bitcoins received.

As an example of where such a misunderstanding can be problematic, are occasions where individual would believe that their ‘address contains 3BSV’. They submit a transaction that spends 0.5BSV believing the ‘address now contained 2.5BSV’ when, in actuality, it contained zero. The absent 2.5BSV would have been transferred to a change address for which efforts had not been made to have this change address backed up, causing or risking a permanent loss of funds. This has happened on a few occasions to users of paper wallets.

"From" addresses

Bitcoin SV transactions do not have any kind of origin-, source- or "from" address.

See Also

  • Technical background of Bitcoin addresses
  • Elliptic Curve Digital Signature Algorithm
  • Wallets and key management
  • Base58Check encoding

Attribution

This content is based on content sourced from Invoice address - Bitcoin Wiki under Creative Commons Attribution 3.0. Although it may have been extensively revised and updated we acknowledge the original authors.

声明:

BSV知识库项目由BSV区块链发起并支持,更多信息请参见知识库官网:BSV Wiki


目前,全球已有超过400个项目构建于BSV区块链之上。凭借坚如磐石的协议及超高的网络性能,BSV生态系统迅猛发展,我们期待未来出现更多前所未有的商业应用。


  • 对BSV区块链开发感兴趣的朋友可以通过CSDN站内私信联系我们,申请加入BSV开发者交流群。
  • 同时,您也可以扫描下方二维码,关注BSV区块链官方微信公众号,了解更多区块链领域的实时资讯。

    Alt

你可能感兴趣的:(BSV知识库)