ByronAddress

scalus.cardano.address.ByronAddress
See theByronAddress companion object
case class ByronAddress(bytes: ByteString) extends Address

Byron address - legacy Cardano address format using Base58 encoding.

Byron addresses have the following CBOR structure:

  • Outer: [tag24(payload_bytes), crc32_checksum]
  • Inner payload: [addrRoot (28 bytes), addrAttributes (map), addrType (uint)]

Address attributes (map):

  • Key 1: Optional derivation path (HD address payload)
  • Key 2: Optional network magic (CBOR-encoded Word32)

Address types:

  • 0: Verification key address (ATVerKey)
  • 2: Redeem address (ATRedeem)

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Address
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def attributesSize: Int

Calculate the size of Byron address attributes.

Calculate the size of Byron address attributes.

This matches Haskell's bootstrapAddressAttrsSize which calculates: derivationPathLength + unknownAttributesLength

Known attributes are:

  • Key 1: Derivation path (HD address payload)
  • Key 2: Network magic

Only derivation path (key 1) and unknown attributes (keys other than 1 and 2) are counted in the size. Network magic (key 2) is NOT counted.

Attributes

Returns

The total size of relevant attributes in bytes

def byronAddrType: Int

Get the address type (0 = VerKey, 2 = Redeem)

Get the address type (0 = VerKey, 2 = Redeem)

Attributes

def derivationPath: Option[ByteString]

Get the derivation path if present (HD wallet addresses)

Get the derivation path if present (HD wallet addresses)

Attributes

def encode: Try[String]

Encode to human-readable format (Base58 for Byron addresses)

Encode to human-readable format (Base58 for Byron addresses)

Attributes

inline override def getNetwork: Option[Network]

Get network from address attributes.

Get network from address attributes.

Byron addresses encode network magic in attribute key 2. If absent or equals mainnet magic (764824073), returns Mainnet. Otherwise returns Testnet.

Attributes

Definition Classes
def hasScript: Boolean

Check if address contains scripts

Check if address contains scripts

Attributes

def hrp: Try[String]

HRP is not applicable for Byron addresses (they use Base58)

HRP is not applicable for Byron addresses (they use Base58)

Attributes

def isEnterprise: Boolean

Check if this is an enterprise address

Check if this is an enterprise address

Attributes

Extract payment key hash from Byron address.

Extract payment key hash from Byron address.

Byron addresses contain an addrRoot which is the payment key hash. This matches Haskell's bootstrapKeyHash.

Attributes

def networkMagic: Option[Long]

Get the network magic if present

Get the network magic if present

Attributes

Get script hash if available

Get script hash if available

Attributes

def toBase58: String

Encode to Base58 string (Byron addresses use Base58, not Bech32)

Encode to Base58 string (Byron addresses use Base58, not Bech32)

Attributes

Serialize to bytes

Serialize to bytes

Attributes

def toHex: String

Convert to hex string

Convert to hex string

Attributes

def typeId: Byte

Get type ID

Get type ID

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

Lazily parsed Byron address structure

Lazily parsed Byron address structure

Attributes