Address format
How a Lotus address is built: the lotus prefix, the network character, the Base58 payload, its checksum, and the two address types.
A Lotus address is a short text that encodes an output script. Mainnet addresses start with lotus_.
lotus_16PSJPVHNWEF4t1nSFefhth6HAtqn6oripT4k9iNvStructure #
<token><network character><Base58(type || payload || checksum)>| Part | Size | Value |
|---|---|---|
| Token | 5 characters | lotus, in plain text |
| Network character | 1 character | _ mainnet, T testnet, R regtest, in plain text |
| Type | 1 byte | Address type, see below |
| Payload | variable | Depends on the type |
| Checksum | 4 bytes | Integrity check, see below |
Only the type, the payload and the checksum are Base58-encoded. The token and the network character are readable as they are, so you can tell the network from the first six characters:
| Network | Prefix |
|---|---|
| Mainnet | lotus_ |
| Testnet and the Napoleon testnet | lotusT |
| Regtest | lotusR |
A node rejects an address whose network character is not the one of the network it runs on.
Address types #
| Type byte | Name | Payload |
|---|---|---|
0 | Script | The complete output script (scriptPubKey). |
1 | Reserved | Not assigned. An address of this type does not decode. |
2 | Taproot | The 33-byte Taproot commitment (a compressed public key). |
Type 0: script #
The payload is the output script itself. The node encodes these two scripts as type 0:
| Script | Bytes |
|---|---|
| Pay to public key hash | OP_DUP OP_HASH160 <20-byte hash> OP_EQUALVERIFY OP_CHECKSIG |
| Pay to script hash | OP_HASH160 <20-byte hash> OP_EQUAL |
The example at the top of this page decodes to type 0 with the payload 76a914d03a7e6b979b705c931d137762582b27b10f442c88ac, a pay-to-public-key-hash script.
Type 2: Taproot #
The payload is exactly the 33 bytes that follow OP_SCRIPTTYPE OP_1 0x21 in a Taproot output script. Decoding fails when the payload is not 33 bytes or is not a valid compressed public key.
Address: lotus_JHGFUAijruWK1NG8Nw9UatXG9qmD1E3gq4jYFQMdtMvQ4hvpNzX
Type: 2
Commitment: 039a1cfea64fb7e7c3dbc56516e0fb08c9bc116d4ca10b45881e6987a3541c385a
scriptPubKey: 625121039a1cfea64fb7e7c3dbc56516e0fb08c9bc116d4ca10b45881e6987a3541c385aChecksum #
The checksum is the first 4 bytes of one SHA-256 over these bytes, in this order:
SHA256( token || network character || type byte || payload )The token is hashed as its 5 ASCII bytes and the network character as its single ASCII byte (_ is 0x5f). The checksum detects a mistyped address; it does not correct errors.
Encode an address #
- Build the payload: the output script (type 0) or the 33-byte commitment (type 2).
- Compute the checksum over
lotus, the network character, the type byte and the payload. - Base58-encode
type || payload || checksum. - Write
lotus, the network character, then the Base58 text.
Decode an address #
- Find the first character that is an upper-case letter, a digit or
_. It is the network character; everything before it is the token. - Base58-decode the rest. The result must be at least 5 bytes.
- The first byte is the type, the last 4 bytes are the checksum, the bytes between are the payload.
- Recompute the checksum and compare.
- Check that the token is
lotusand that the network character matches your network.
Check an address with the node #
lotus-cli validateaddress lotus_JHGFUAijruWK1NG8Nw9UatXG9qmD1E3gq4jYFQMdtMvQ4hvpNzX{
"isvalid": true,
"address": "lotus_JHGFUAijruWK1NG8Nw9UatXG9qmD1E3gq4jYFQMdtMvQ4hvpNzX",
"scriptPubKey": "625121039a1cfea64fb7e7c3dbc56516e0fb08c9bc116d4ca10b45881e6987a3541c385a",
"isscript": false,
"istaproot": true
}The node also accepts the internal form taproot:<66 hex characters> wherever it accepts an address.
