Construct Address
status: stable
Construct any address by specyfying credential for payment or delegation.
In Cardano, Addresses are made of three parts:
*---------*---------*-----------*
| NETWORK | PAYMENT | DELEGATION |
*---------*---------*-----------*
The NETWORK
part allows for distinguishing addresses between different networks like the mainnet or the testnet. It is implicitly
handled by the server without you having to worry about it. The PAYMENT
and DELEGATION
parts however can be constructed similarly, using
either:
- A public key
- A script
The script itself is either constructed out of a public key, one of two timelocks, or one of the three following primitives:
- all
- any
- some
The timelock can determine validity as respect to the slot. active_from slot
means the script is valid from the specified slot
and onward. active_until slot
means the script is valid until (not included) the specified slot.
Each of which contains one or more script(s) that can be either keys or primitives, and so on. Schematically:
┏─────────┓
SCRIPT = ──┬───────────────────────┤ pub key ├─────────────────────┬──
│ ┗─────────┛ │
│ ┏──────────────────┓ │
├───────────────────────┤ ACTIVE_FROM slot ├──── ───────┤
│ ┗──────────────────┛ │
│ ┏───────────────────┓ │
├───────────────────────┤ ACTIVE_UNTIL slot ├───────────┤
│ ┗───────────────────┛ │
│ │
│ ╭─────╮ ╭────────╮ │
├──┤ ALL ├───┤ SCRIPT ├─┬───────────────────────────────┤
│ ╰─────╯ ^ ╰────────╯ │ │
│ │ ╭───╮ │ │
│ └───┤ , ├────┘ │
│ ╰───╯ │
│ ╭─────╮ ╭────────╮ │
├──┤ ANY ├───┤ SCRIPT ├─┬───────────────────────────────┤
│ ╰─────╯ ^ ╰────────╯ │ │
│ │ ╭───╮ │ │
│ └───┤ , ├────┘ │
│ ╰───╯ │
│ ╭──────╮ ╭──────────╮ ┏───┓ ╭──────╮ ╭────────╮ │
└──┤ SOME ├─┤ AT_LEAST ├─┤ n ├─┤ FROM ├───┤ SCRIPT ├─┬──┘
╰──────╯ ╰──────────╯ ┗───┛ ╰──────╯ ^ ╰────────╯ │
│ ╭───╮ │
└───┤ , ├────┘
╰───╯
Body
payment
string(bech32) | object One of: A public key (public key without chain code) for credential - 32 bytes
Format should match the following pattern:
^((addr_vk)|(stake_vk))1[0-9a-z]*$
.An extended public key (public key with chain code) for credential - 64 bytes
Format should match the following pattern:
^((addr_xvk)|(stake_xvk))1[0-9a-z]*$
.A key hash for credential - 28 bytes
Format should match the following pattern:
^((addr_vkh)|(stake_vkh))1[0-9a-z]*$
.Leaf value for a script designating a required verification key hash.
Format should match the following pattern:
^((addr_shared_vkh)|(stake_shared_vkh)|(policy_vkh))1[0-9a-z]*$
.A script hash - 28 bytes
Format should match the following pattern:
^(script)1[0-9a-z]*$
.stake
string(bech32) | object One of: A public key (public key without chain code) for credential - 32 bytes
Format should match the following pattern:
^((addr_vk)|(stake_vk))1[0-9a-z]*$
.An extended public key (public key with chain code) for credential - 64 bytes
Format should match the following pattern:
^((addr_xvk)|(stake_xvk))1[0-9a-z]*$
.A key hash for credential - 28 bytes
Format should match the following pattern:
^((addr_vkh)|(stake_vkh))1[0-9a-z]*$
.Leaf value for a script designating a required verification key hash.
Format should match the following pattern:
^((addr_shared_vkh)|(stake_shared_vkh)|(policy_vkh))1[0-9a-z]*$
.A script hash - 28 bytes
Format should match the following pattern:
^(script)1[0-9a-z]*$
.-
validation
string Script validation level. Required validation sifts off scripts that would not be accepted by the ledger. Recommended level filters out scripts that do not pass required validation and additionally when:
- 'all' is non-empty
- there are redundant timelocks in a given level
- there are no duplicated verification keys in a given level
- 'at_least' coefficient is positive
- 'all', 'any' are non-empty and `'at_least' has no less elements in the list than the coefficient after timelocks are filtered out.
Values are
required
orrecommended
.
curl \
--request POST https://localhost:8090/v2/addresses \
--header "Content-Type: application/json" \
--data '{"payment":["stake_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7qau558d","addr_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7q3yvuv2"],"stake":["stake_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7qau558d","addr_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7q3yvuv2"],"validation":"required"}'
{
"payment": [
"stake_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7qau558d",
"addr_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7q3yvuv2"
],
"stake": [
"stake_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7qau558d",
"addr_vk16apaenn9ut6s40lcw3l8v68xawlrlq20z2966uzcx8jmv2q9uy7q3yvuv2"
],
"validation": "required"
}
{
"message": "string",
"code": "an_error_code"
}
{
"message": "string",
"code": "not_acceptable"
}
{
"message": "string",
"code": "bad_request"
}
{
"address": [
"stake17xt2z3pa7etaxp7jurdg0m8jhsmtp4r2z56pd3a5q3jhxycdxzmx9",
"addr1wy5np0m5x03tax3kcdh6e2cet98qcfs80wtv4cyvl5taclc6dnd8e",
"addr1xy5np0m5x03tax3kcdh6e2cet98qcfs80wtv4cyvl5tacluk59zrmajh6vra9cx6slk090pkkr2x59f5zmrmgpr9wvfs37hjk4"
]
}