API Reference¶
Detailed auto-generated reference for Accumulate Python Client.
Client¶
client
¶
AccumulateClient
¶
Client for interacting with the Accumulate JSON-RPC API with a persistent auto-incrementing request ID.
Source code in accumulate\api\client.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
close()
async
¶
Close the transport connection
Source code in accumulate\api\client.py
361 362 363 364 | |
faucet(account, token_url=None)
async
¶
Request tokens from the Accumulate faucet using JSON-RPC
Source code in accumulate\api\client.py
330 331 332 333 334 335 336 337 338 339 340 | |
find_service(options)
async
¶
Find available services on the Accumulate network using JSON-RPC
Source code in accumulate\api\client.py
342 343 344 345 346 347 348 349 350 351 | |
json_rpc_request(method, params=None)
async
¶
Send a JSON-RPC request with an auto-incrementing ID stored persistently.
Source code in accumulate\api\client.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
list_snapshots()
async
¶
List available blockchain snapshots using JSON-RPC
Source code in accumulate\api\client.py
357 358 359 | |
metrics()
async
¶
Retrieve network metrics such as transactions per second using JSON-RPC
Source code in accumulate\api\client.py
353 354 355 | |
network_status()
async
¶
Fetch the current network status from the Accumulate blockchain.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: JSON response containing network status details. |
Source code in accumulate\api\client.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
query(scope, query)
async
¶
Submit a query to the Accumulate network using JSON-RPC.
Source code in accumulate\api\client.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
query_block(block_type, index=None, start=None, count=None)
async
¶
Query a minor or major block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_type
|
str
|
Either "minor" or "major" |
required |
index
|
Optional[int]
|
Block index (if querying a specific block) |
None
|
start
|
Optional[int]
|
Start index for range queries |
None
|
count
|
Optional[int]
|
Number of blocks to retrieve in range queries |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
JSON response from the API |
Source code in accumulate\api\client.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
search(account_id, search_type, value, extra_params=None)
async
¶
Search an account for an anchor, public key, or delegate using JSON-RPC.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
The account ID to search within. |
required |
search_type
|
str
|
The type of search. Must be 'anchor', 'publicKey', or 'delegate'. |
required |
value
|
str
|
The value to search for (anchor hash, public key, or delegate URL). |
required |
extra_params
|
Optional[Dict[str, Any]]
|
Additional query parameters. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
JSON response from the API. |
Source code in accumulate\api\client.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
submit(envelope, verify=True, wait=True)
async
¶
Submit a transaction to the Accumulate network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
envelope
|
Dict[str, Any]
|
The transaction envelope containing transactions and signatures. |
required |
verify
|
bool
|
If True, verifies the envelope before submission. Defaults to True. |
True
|
wait
|
bool
|
If True, blocks until submission is confirmed or rejected. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The API response containing transaction details. |
Source code in accumulate\api\client.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
validate(envelope, full=False)
async
¶
Validate a transaction envelope against the Accumulate network using JSON-RPC
Source code in accumulate\api\client.py
149 150 151 152 | |
load_counter()
¶
Load the last used request ID from file or start at 1 if missing.
Source code in accumulate\api\client.py
30 31 32 33 34 35 | |
save_counter(counter)
¶
Save the current counter value to the file.
Source code in accumulate\api\client.py
37 38 39 40 | |
API Core (Context, Transport, Querier, Exceptions)¶
context
¶
RequestContext
¶
Represents the context for a request, including metadata and optional cancellation tokens.
Source code in accumulate\api\context.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
__init__(metadata=None)
¶
Initialize the RequestContext with optional metadata. :param metadata: A dictionary containing request-specific metadata.
Source code in accumulate\api\context.py
11 12 13 14 15 16 | |
get_metadata(key)
¶
Retrieve a value from the context metadata. :param key: Metadata key. :return: Metadata value or None if the key does not exist.
Source code in accumulate\api\context.py
18 19 20 21 22 23 24 | |
set_metadata(key, value)
¶
Set a value in the context metadata. :param key: Metadata key. :param value: Metadata value.
Source code in accumulate\api\context.py
26 27 28 29 30 31 32 | |
transport
¶
RoutedTransport
¶
Handles HTTP transport for the Accumulate RPC API.
Source code in accumulate\api\transport.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
__init__(base_url, timeout=15)
¶
Initialize the transport layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
The base URL of the Accumulate network (e.g., mainnet or testnet). |
required |
timeout
|
int
|
Request timeout in seconds. |
15
|
Source code in accumulate\api\transport.py
15 16 17 18 19 20 21 22 23 24 | |
close()
async
¶
Close the transport client.
Source code in accumulate\api\transport.py
82 83 84 | |
send_request(endpoint, method='GET', params=None, data=None, debug=False)
async
¶
Print the exact JSON-RPC request without sending it if debug mode is enabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
str
|
The API endpoint (e.g., "query/{scope}"). |
required |
method
|
str
|
The HTTP method (e.g., "GET", "POST"). |
'GET'
|
params
|
Dict[str, Any]
|
Query parameters for the request. |
None
|
data
|
Dict[str, Any]
|
JSON body for the request. |
None
|
debug
|
bool
|
If True, print the JSON request instead of sending it. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The printed request data as a dictionary. |
Raises:
| Type | Description |
|---|---|
Exception
|
If the request fails or the response contains an error. |
Source code in accumulate\api\transport.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
querier
¶
Querier
¶
Handles queries related to accounts, transactions, records, and events.
Source code in accumulate\api\querier.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
_deserialize_response(data, result_type)
¶
Deserialize a response into the expected result type.
Source code in accumulate\api\querier.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
query(ctx, scope, query, result_type)
async
¶
Submit a generic query to the Accumulate network.
Source code in accumulate\api\querier.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
query_account(ctx, account, query)
async
¶
Query account details.
Source code in accumulate\api\querier.py
125 126 127 128 129 130 | |
query_block(ctx, scope, query)
async
¶
Query block details.
Source code in accumulate\api\querier.py
155 156 157 158 159 160 161 | |
query_chain(ctx, scope, query)
async
¶
Query chain details.
Source code in accumulate\api\querier.py
132 133 134 135 136 137 | |
query_chain_entries(ctx, scope, query)
async
¶
Query chain entries.
Source code in accumulate\api\querier.py
139 140 141 142 143 144 | |
query_events(ctx, scope, query)
async
¶
Query for events.
Source code in accumulate\api\querier.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
query_generic(ctx, scope, query, result_type)
async
¶
Generic query handler.
Source code in accumulate\api\querier.py
120 121 122 123 | |
query_record(ctx, scope, query, result_type)
async
¶
Submit a query for a specific record type.
Source code in accumulate\api\querier.py
57 58 59 60 61 62 63 64 65 66 | |
query_transaction(ctx, txid, query)
async
¶
Query transaction details.
Source code in accumulate\api\querier.py
146 147 148 149 150 151 152 | |
exceptions
¶
AccumulateError
¶
Bases: Exception
Base class for all custom exceptions in the Accumulate client.
Source code in accumulate\api\exceptions.py
3 4 5 | |
FaucetError
¶
Bases: AccumulateError
Raised when faucet token requests fail.
Source code in accumulate\api\exceptions.py
23 24 25 | |
QueryError
¶
Bases: AccumulateError
Raised when a query to the RPC API fails.
Source code in accumulate\api\exceptions.py
8 9 10 | |
SubmissionError
¶
Bases: AccumulateError
Raised when a transaction submission fails.
Source code in accumulate\api\exceptions.py
13 14 15 | |
ValidationError
¶
Bases: AccumulateError
Raised when validation fails.
Source code in accumulate\api\exceptions.py
18 19 20 | |
Transactions (Models)¶
transactions
¶
AddCredits
¶
Bases: TransactionBodyBase
Represents an AddCredits transaction.
Source code in accumulate\models\transactions.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
__init__(client, recipient, amount)
¶
:param client: Instance of AccumulateClient (can be None when unmarshaling) :param recipient: The URL of the account receiving the credits. :param amount: The amount of credits to add (in whole credits; this will be multiplied by 1e6).
Source code in accumulate\models\transactions.py
464 465 466 467 468 469 470 471 472 473 | |
_normalize_recipient(recipient)
staticmethod
¶
Ensure the recipient is formatted correctly. It must start with "acc://", not include ".MAIN", and end with "/acme" (all lowercase).
Source code in accumulate\models\transactions.py
549 550 551 552 553 554 555 556 557 558 559 560 | |
fields_to_encode()
¶
Returns the fields to be marshaled.
Source code in accumulate\models\transactions.py
487 488 489 490 491 492 493 494 | |
initialize_oracle()
async
¶
Fetch and set the oracle price asynchronously from network status.
Source code in accumulate\models\transactions.py
475 476 477 478 479 480 481 482 | |
to_dict()
¶
Convert AddCredits transaction to a dictionary.
Source code in accumulate\models\transactions.py
496 497 498 499 500 501 502 503 | |
unmarshal(data)
classmethod
¶
Deserialize an AddCredits transaction from bytes.
Source code in accumulate\models\transactions.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
BurnTokens
¶
Bases: TransactionBodyBase
Represents a Burn Tokens transaction. This class accepts a provided-readable burn amount and then dynamically queries the blockchain to obtain the token's precision. It then calculates the final on-chain amount to burn.
The token account URL is provided, and from it the token issuer URL is obtained.
Source code in accumulate\models\transactions.py
1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 | |
__init__(token_account_url, provided_amount)
¶
:param token_account_url: The URL of the token account (e.g., acc://.../CTACUST). :param provided_amount: The provided-readable number of tokens to burn.
Source code in accumulate\models\transactions.py
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 | |
_encode_amount()
¶
Encodes the final amount as a raw big-endian number. For example, if the final amount is 110000, then: big_number_marshal_binary(110000) should yield its minimal big-endian representation.
Source code in accumulate\models\transactions.py
1661 1662 1663 1664 1665 1666 1667 1668 1669 | |
fields_to_encode()
¶
Fields for BurnTokens
- Field 1: Transaction type (encoded as varint)
- Field 2: Amount (encoded as a length-delimited big-endian number)
NOTE: The token URL is NOT included in the encoded body.
Source code in accumulate\models\transactions.py
1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 | |
initialize(client)
async
¶
Dynamically query the token account and token issuer to obtain the token's precision, then calculate the final on-chain burn amount.
Source code in accumulate\models\transactions.py
1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 | |
to_dict()
¶
Convert the BurnTokens transaction to a JSON-serializable dictionary. (Note: the token URL is not included in the output JSON.)
Source code in accumulate\models\transactions.py
1702 1703 1704 1705 1706 1707 1708 1709 1710 | |
unmarshal(data)
classmethod
¶
Deserialize BurnTokens transaction from bytes. (Since precision is not encoded, the returned instance will have token_account_url set to None.)
Source code in accumulate\models\transactions.py
1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 | |
CreateDataAccount
¶
Bases: TransactionBodyBase
Represents a Create Data Account transaction.
Source code in accumulate\models\transactions.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | |
__init__(url, authorities=None, metadata=None)
¶
:param url: The URL of the data account. :param authorities: List of authority URLs (optional). :param metadata: Optional metadata as bytes (optional).
Source code in accumulate\models\transactions.py
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | |
fields_to_encode()
¶
Returns the fields to encode as a list of (field_id, value, encoding_function).
Source code in accumulate\models\transactions.py
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | |
to_dict()
¶
Convert CreateDataAccount transaction to a dictionary.
Source code in accumulate\models\transactions.py
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | |
type()
¶
Return transaction type.
Source code in accumulate\models\transactions.py
668 669 670 | |
unmarshal(data)
classmethod
¶
Deserialize CreateDataAccount transaction from bytes.
Source code in accumulate\models\transactions.py
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | |
CreateIdentity
¶
Bases: TransactionBodyBase
Represents a CreateIdentity transaction, where the key hash is automatically derived.
Source code in accumulate\models\transactions.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
__init__(url, signer_public_key, key_book_url=None)
¶
:param url: The URL of the new identity. :param signer_public_key: The public key of the principal (used to derive the key hash). :param key_book_url: The key book URL (optional).
Source code in accumulate\models\transactions.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
fields_to_encode()
¶
Returns the fields to be marshaled in Accumulate format.
Source code in accumulate\models\transactions.py
395 396 397 398 399 400 401 402 403 404 405 406 | |
marshal()
¶
Encodes the transaction into bytes for submission.
Source code in accumulate\models\transactions.py
408 409 410 411 412 413 414 415 | |
to_dict()
¶
Convert CreateIdentity transaction to a dictionary.
Source code in accumulate\models\transactions.py
417 418 419 420 421 422 423 424 | |
type()
¶
Return the transaction type in Accumulate's expected format.
Source code in accumulate\models\transactions.py
391 392 393 | |
unmarshal(data)
classmethod
¶
Deserialize a CreateIdentity transaction from bytes.
Source code in accumulate\models\transactions.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
CreateKeyBook
dataclass
¶
Bases: TransactionBodyBase
Represents a Create Key Book transaction.
Source code in accumulate\models\transactions.py
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | |
fields_to_encode()
¶
Build the fields as follows
Field 1: Transaction type (as a varint) Field 2: URL (with a length prefix added by string_marshal_binary) Field 3: publicKeyHash (with a length prefix, which should be 0x20) Optionally, if authorities are provided, include them as fields 4 and 5
Source code in accumulate\models\transactions.py
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | |
to_dict()
¶
Convert transaction body to a JSON‑serializable dictionary
Source code in accumulate\models\transactions.py
1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | |
CreateKeyPage
dataclass
¶
Bases: TransactionBodyBase
Represents a Create Key Page transaction.
Source code in accumulate\models\transactions.py
985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | |
fields_to_encode()
¶
Define the fields to encode, following structured encoding.
Source code in accumulate\models\transactions.py
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | |
to_dict()
¶
Convert transaction to a dictionary with correct type formatting, including keys.
Source code in accumulate\models\transactions.py
1014 1015 1016 1017 1018 1019 | |
CreateToken
¶
Bases: TransactionBodyBase
Represents a Create Token transaction.
Source code in accumulate\models\transactions.py
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 | |
_encode_supply_limit()
¶
Encode the adjusted supply limit using a variable-length encoding. First, compute the minimal number of bytes needed to represent the adjusted value, then prefix that with its length encoded as a varint.
Source code in accumulate\models\transactions.py
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 | |
fields_to_encode()
¶
Expected official encoding
Field 1: Transaction Type (CREATE_TOKEN) -> 01 08 Field 2: Token URL -> 02 + length + url bytes Field 4: Symbol -> 04 + length + symbol bytes Field 5: Precision -> 05 + varint(precision) Field 7: Supply Limit -> 07 + (length varint + supply limit bytes) [variable length] Field 9: Authorities -> if provided.
Source code in accumulate\models\transactions.py
1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 | |
to_dict()
¶
Convert the transaction into a JSON-compatible dictionary. Outputs the dynamically adjusted supply limit (the on-chain value).
Source code in accumulate\models\transactions.py
1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 | |
unmarshal(data)
classmethod
¶
Deserialize CreateToken transaction from bytes.
Source code in accumulate\models\transactions.py
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 | |
CreateTokenAccount
¶
Bases: TransactionBodyBase
Represents a Create Token Account transaction.
Source code in accumulate\models\transactions.py
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | |
__init__(url, token_url, authorities=None)
¶
:param url: The URL of the token account. :param token_url: The URL of the token issuer. :param authorities: List of authorities for the token account (optional).
Source code in accumulate\models\transactions.py
752 753 754 755 756 757 758 759 760 761 762 763 764 765 | |
fields_to_encode()
¶
Returns the fields to encode as a list of (field_id, value, encoding_function).
Source code in accumulate\models\transactions.py
771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | |
to_dict()
¶
Convert CreateTokenAccount transaction to a dictionary.
Source code in accumulate\models\transactions.py
820 821 822 823 824 825 826 827 828 829 830 831 832 | |
type()
¶
Return transaction type.
Source code in accumulate\models\transactions.py
767 768 769 | |
unmarshal(data)
classmethod
¶
Deserialize CreateTokenAccount transaction from bytes.
Source code in accumulate\models\transactions.py
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | |
IssueTokens
¶
Bases: TransactionBodyBase
Represents an Issue Tokens transaction. This version includes only a list of token recipients.
Source code in accumulate\models\transactions.py
1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 | |
__init__(recipients)
¶
:param recipients: A list of TokenRecipient instances.
Source code in accumulate\models\transactions.py
1512 1513 1514 1515 1516 1517 1518 | |
_marshal_recipients()
¶
Serialize recipients as a length-prefixed list. Each recipient is encoded as: - Field 1: URL (as a length-prefixed string) - Field 2: Amount (as a big-number, using big_number_marshal_binary) The recipient fields are concatenated (without an extra length wrapper per recipient) and the entire recipients block is prefixed with a varint length.
Source code in accumulate\models\transactions.py
1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 | |
_unmarshal_recipients(data)
staticmethod
¶
Deserialize the recipients list from a byte stream. Each recipient is encoded as: - Field 1: URL (length-prefixed string) - Field 2: Amount (big-number bytes)
Source code in accumulate\models\transactions.py
1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 | |
fields_to_encode()
¶
Fields for IssueTokens
Field 1: Transaction type (encoded as varint). Field 4: Recipients (as a length-prefixed list of recipient fields).
Source code in accumulate\models\transactions.py
1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 | |
to_dict()
¶
Convert the IssueTokens transaction to a JSON‑serializable dictionary. The recipients are output under the key "to".
Source code in accumulate\models\transactions.py
1596 1597 1598 1599 1600 1601 1602 1603 1604 | |
unmarshal(data)
classmethod
¶
Deserialize IssueTokens transaction from bytes.
Source code in accumulate\models\transactions.py
1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | |
RemoteTransaction
¶
Bases: TransactionBodyBase
Represents a Remote Transaction, which references another transaction by its hash.
Source code in accumulate\models\transactions.py
1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 | |
__init__(hash)
¶
:param hash: The 32-byte transaction hash being referenced.
Source code in accumulate\models\transactions.py
1767 1768 1769 1770 1771 1772 1773 1774 | |
fields_to_encode()
¶
Fields to encode
Field 1: Transaction Type (remoteTransaction) Field 2: Transaction Hash (32-byte binary)
Source code in accumulate\models\transactions.py
1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | |
to_dict()
¶
Convert RemoteTransaction to a dictionary.
Source code in accumulate\models\transactions.py
1810 1811 1812 1813 1814 1815 | |
type()
¶
Return the transaction type.
Source code in accumulate\models\transactions.py
1776 1777 1778 | |
unmarshal(data)
classmethod
¶
Deserialize RemoteTransaction from bytes.
Source code in accumulate\models\transactions.py
1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 | |
SendTokens
¶
Bases: TransactionBodyBase
Represents a SendTokens transaction, supporting multiple recipients.
Source code in accumulate\models\transactions.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | |
_marshal_recipients()
¶
Encodes the list of TokenRecipients without an extra field wrapper.
Returns a varint length prefix followed by the concatenated recipient fields.
Source code in accumulate\models\transactions.py
594 595 596 597 598 599 600 601 602 603 604 605 | |
add_recipient(to, amount)
¶
Add a recipient to the transaction, converting ACME to micro-units.
Source code in accumulate\models\transactions.py
573 574 575 576 577 578 579 580 581 582 | |
to_dict()
¶
Convert SendTokens transaction to a dictionary.
Source code in accumulate\models\transactions.py
607 608 609 610 611 612 | |
type()
¶
Return the transaction type.
Source code in accumulate\models\transactions.py
584 585 586 | |
unmarshal(data)
classmethod
¶
Deserialize a SendTokens transaction from bytes.
Source code in accumulate\models\transactions.py
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | |
Transaction
¶
Source code in accumulate\models\transactions.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
add_signer(url, version)
¶
Add a signer dynamically.
Source code in accumulate\models\transactions.py
101 102 103 104 | |
create(client, signer, transaction_type, *args, **kwargs)
async
classmethod
¶
Fully constructs a transaction, including the header and body.
:param client: AccumulateClient instance :param signer: Signer instance :param transaction_type: The type of transaction to create :param args: Additional arguments passed to the transaction body :param kwargs: Additional keyword arguments for the transaction body :return: A fully constructed Transaction instance
Source code in accumulate\models\transactions.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
get_body_hash()
¶
Compute the hash of the transaction body separately for debugging.
Source code in accumulate\models\transactions.py
213 214 215 216 217 218 219 | |
get_hash()
¶
Compute transaction hash ensuring Accumulate's hashing order.
Source code in accumulate\models\transactions.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
get_id()
¶
Get the transaction ID based on its hash and principal URL.
Source code in accumulate\models\transactions.py
171 172 173 174 | |
get_signer(url)
¶
Retrieve a signer dynamically.
Source code in accumulate\models\transactions.py
106 107 108 | |
is_remote()
¶
Check if this transaction is a RemoteTransaction.
Source code in accumulate\models\transactions.py
72 73 74 | |
is_user()
¶
Check if the transaction is initiated by a user.
Source code in accumulate\models\transactions.py
110 111 112 | |
marshal()
¶
Serialize the transaction to bytes. Format: [header length (varint)] + [header bytes] [body length (varint)] + [body bytes]
Source code in accumulate\models\transactions.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
to_dict()
¶
Convert a Transaction into a dictionary format suitable for submission.
Source code in accumulate\models\transactions.py
161 162 163 164 165 166 167 168 169 | |
unmarshal(data)
staticmethod
¶
Deserialize a Transaction from bytes. Format: [header length (varint)] + [header bytes] [body length (varint)] + [body bytes]
Source code in accumulate\models\transactions.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
TransactionStatus
¶
Source code in accumulate\models\transactions.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
add_signer(url, version)
¶
Add a signer dynamically.
Source code in accumulate\models\transactions.py
354 355 356 357 358 359 | |
get_signer(url)
¶
Retrieve a signer dynamically
Source code in accumulate\models\transactions.py
361 362 363 364 365 366 | |
marshal()
¶
Serialize TransactionStatus to bytes using Accumulate encoding.
Source code in accumulate\models\transactions.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
set(error)
¶
Set the error and update the status code based on the provided error.
Source code in accumulate\models\transactions.py
343 344 345 346 347 348 349 | |
to_dict()
¶
Serialize the TransactionStatus to a dictionary.
Source code in accumulate\models\transactions.py
242 243 244 245 246 247 248 249 250 251 252 | |
unmarshal(data)
staticmethod
¶
Deserialize TransactionStatus from bytes.
Source code in accumulate\models\transactions.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
TransferCredits
¶
Bases: TransactionBodyBase
Source code in accumulate\models\transactions.py
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 | |
__init__(to)
¶
Represents a Transfer Credits transaction.
:param to: A list of CreditRecipient objects.
Source code in accumulate\models\transactions.py
1715 1716 1717 1718 1719 1720 1721 1722 1723 | |
marshal()
¶
Serialize TransferCredits transaction to bytes.
Source code in accumulate\models\transactions.py
1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 | |
unmarshal(data)
staticmethod
¶
Deserialize TransferCredits transaction from bytes.
Source code in accumulate\models\transactions.py
1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 | |
UpdateAccountAuth
dataclass
¶
Bases: TransactionBodyBase
Represents an Update Account Auth transaction.
Source code in accumulate\models\transactions.py
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 | |
_marshal_operation(operation)
staticmethod
¶
Serialize a single operation into bytes. Expected structure for addAuthority: - Nested field 1 (tag 0x01): Operation type (varint). - Nested field 2 (tag 0x02): Authority (length-prefixed string).
Source code in accumulate\models\transactions.py
1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 | |
_marshal_operations()
¶
Serialize operations as a length-prefixed binary format.
Source code in accumulate\models\transactions.py
1318 1319 1320 1321 1322 1323 1324 | |
_unmarshal_operations(data)
staticmethod
¶
Deserialize operations from a byte stream.
Source code in accumulate\models\transactions.py
1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 | |
fields_to_encode()
¶
Field 1: Transaction type as a varint. Field 2: Operations as a length-prefixed list.
Source code in accumulate\models\transactions.py
1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | |
to_dict()
¶
Convert transaction body to a JSON‑serializable dictionary.
Source code in accumulate\models\transactions.py
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 | |
unmarshal(data)
classmethod
¶
Deserialize UpdateAccountAuth transaction from bytes.
Source code in accumulate\models\transactions.py
1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | |
UpdateKeyPage
dataclass
¶
Bases: TransactionBodyBase
Represents an Update Key Page transaction.
Source code in accumulate\models\transactions.py
1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 | |
_marshal_operation(operation)
staticmethod
¶
Serialize an operation dictionary into bytes. Handles standard operations (with keyHash or delegate), threshold operations (setThreshold, setRejectThreshold, setResponseThreshold) and update operations.
Source code in accumulate\models\transactions.py
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | |
_unmarshal_operations(data)
staticmethod
¶
Deserialize operations from a byte stream.
Source code in accumulate\models\transactions.py
1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 | |
fields_to_encode()
¶
Define the fields to encode for the transaction.
Source code in accumulate\models\transactions.py
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | |
to_dict()
¶
Convert transaction body to a JSON‑serializable dictionary.
Source code in accumulate\models\transactions.py
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 | |
unmarshal(data)
classmethod
¶
Deserialize UpdateKeyPage transaction from bytes.
Source code in accumulate\models\transactions.py
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | |
WriteData
¶
Bases: TransactionBodyBase
Represents a Write Data transaction.
Source code in accumulate\models\transactions.py
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | |
__init__(entry, scratch=None, write_to_state=None)
¶
:param entry: The data entry (must be AccumulateDataEntry or DoubleHashDataEntry).
:param scratch: Flag indicating whether it's a scratch write.
:param write_to_state: Flag indicating whether it writes to state.
Source code in accumulate\models\transactions.py
840 841 842 843 844 845 846 847 848 849 850 851 | |
hash_tree()
¶
Compute the Merkle tree hash of the data entry.
Go SDK uses sha256(sha256(MerkleRoot(entry_data)))
Source code in accumulate\models\transactions.py
952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | |
marshal_without_entry()
¶
Marshal WriteData without the entry field.
Needed to match Go SDK hashing logic.
Source code in accumulate\models\transactions.py
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | |
to_dict()
¶
Convert WriteData transaction to a dictionary, ensuring that default values (scratch=False, writeToState=True) are omitted.
Source code in accumulate\models\transactions.py
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | |
type()
¶
Return transaction type.
Source code in accumulate\models\transactions.py
853 854 855 | |
unmarshal(data)
classmethod
¶
Deserialize WriteData transaction from bytes.
Source code in accumulate\models\transactions.py
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | |
Queries (Models)¶
queries
¶
AccumulateError
¶
Bases: Exception
Base class for all custom exceptions in the Accumulate client.
Source code in accumulate\models\queries.py
14 15 16 | |
AnchorSearchQuery
¶
Bases: Query
Represents an anchor search query.
Source code in accumulate\models\queries.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
is_valid()
¶
Validate the anchor search query.
Source code in accumulate\models\queries.py
259 260 261 262 263 264 265 266 | |
BlockQuery
¶
Bases: Query
Represents a block query.
Source code in accumulate\models\queries.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
is_valid()
¶
Validate the block query. Ensure at least one required field is set.
Source code in accumulate\models\queries.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
to_dict()
¶
Convert BlockQuery to the API-compatible format.
Source code in accumulate\models\queries.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
ChainQuery
¶
Bases: Query
Represents a chain query.
Source code in accumulate\models\queries.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
is_valid()
¶
Validate the chain query.
Source code in accumulate\models\queries.py
80 81 82 83 84 85 86 87 | |
to_dict()
¶
Ensure name is always included in the query.
Source code in accumulate\models\queries.py
90 91 92 93 94 95 96 97 98 99 100 | |
DataQuery
¶
Bases: Query
Represents a data query.
Source code in accumulate\models\queries.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
is_valid()
¶
Validate the data query.
Source code in accumulate\models\queries.py
119 120 121 122 | |
DefaultQuery
¶
Bases: Query
Represents the default query type.
Source code in accumulate\models\queries.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
is_valid()
¶
Validate the default query.
Source code in accumulate\models\queries.py
46 47 48 49 50 51 | |
DelegateSearchQuery
¶
Bases: Query
Represents a delegate search query.
Source code in accumulate\models\queries.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
is_valid()
¶
Validate the delegate search query.
Source code in accumulate\models\queries.py
375 376 377 378 | |
DirectoryQuery
¶
Bases: Query
Represents a directory query.
Source code in accumulate\models\queries.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
is_valid()
¶
Validate the directory query.
Source code in accumulate\models\queries.py
141 142 143 144 145 146 | |
to_dict()
¶
Ensure the query outputs correctly formatted range parameters.
Source code in accumulate\models\queries.py
148 149 150 151 152 153 154 155 156 157 158 159 160 | |
MessageHashSearchQuery
¶
Bases: Query
Represents a message hash search query.
Source code in accumulate\models\queries.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
is_valid()
¶
Validate the message hash search query.
Source code in accumulate\models\queries.py
396 397 398 399 | |
PendingQuery
¶
Bases: Query
Represents a pending query.
Source code in accumulate\models\queries.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
is_valid()
¶
Validate the pending query.
Source code in accumulate\models\queries.py
171 172 173 174 175 176 | |
to_dict()
¶
Ensure the query outputs correctly formatted range parameters.
Source code in accumulate\models\queries.py
178 179 180 181 182 183 184 185 186 187 188 189 190 | |
PublicKeyHashSearchQuery
¶
Bases: Query
Represents a public key hash search query.
Source code in accumulate\models\queries.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
is_valid()
¶
Validate the public key hash search query.
Source code in accumulate\models\queries.py
354 355 356 357 | |
to_dict()
¶
Convert the query to a dictionary ensuring correct JSON-RPC format.
Source code in accumulate\models\queries.py
359 360 361 362 363 364 | |
PublicKeySearchQuery
¶
Bases: Query
Represents a public key search query.
Source code in accumulate\models\queries.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
_convert_to_hex(public_key)
¶
Detect and convert the provided public key to HEX.
Source code in accumulate\models\queries.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
is_valid()
¶
Validate the public key search query.
Source code in accumulate\models\queries.py
323 324 325 326 327 328 329 330 | |
to_dict()
¶
Ensure the query outputs HEX for publicKey and correctly formatted Type field.
Source code in accumulate\models\queries.py
332 333 334 335 336 337 338 339 340 341 342 343 344 | |
Query
¶
Base class for all query types.
Source code in accumulate\models\queries.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
is_valid()
¶
Validate the query parameters.
Source code in accumulate\models\queries.py
26 27 28 | |
to_dict()
¶
Convert the query to a dictionary ensuring queryType is formatted correctly.
Source code in accumulate\models\queries.py
30 31 32 33 34 35 36 | |
Models & Schemas¶
records
¶
AccountRecord
dataclass
¶
Bases: Record
Represents an account record.
Source code in accumulate\models\records.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
balance
property
¶
Convert raw balance (stored in micro-ACME) to actual ACME tokens.
AccumulateError
¶
Bases: Exception
Base class for all custom exceptions in the Accumulate client.
Source code in accumulate\models\records.py
10 11 12 | |
ChainEntryRecord
dataclass
¶
Bases: Record
Represents a chain entry record.
Source code in accumulate\models\records.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
ChainRecord
dataclass
¶
Bases: Record
Represents a chain record.
Source code in accumulate\models\records.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
from_dict(data)
classmethod
¶
Creates a ChainRecord instance from a dictionary.
Source code in accumulate\models\records.py
155 156 157 158 159 160 161 162 163 164 | |
to_dict()
¶
Converts the ChainRecord to a dictionary.
Source code in accumulate\models\records.py
145 146 147 148 149 150 151 152 153 | |
KeyRecord
dataclass
¶
Bases: Record
Represents a key record.
Source code in accumulate\models\records.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
MessageRecord
dataclass
¶
Bases: Record
Represents a message record.
Source code in accumulate\models\records.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
Record
dataclass
¶
Base class for records in the Accumulate blockchain.
Source code in accumulate\models\records.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
RecordRange
dataclass
¶
Bases: Generic[T]
Represents a range of records.
Source code in accumulate\models\records.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
SignatureSetRecord
dataclass
¶
Bases: Record
Represents a signature set record.
Source code in accumulate\models\records.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
TxIDRecord
dataclass
¶
Bases: Record
Represents a TxID record.
Source code in accumulate\models\records.py
59 60 61 62 63 64 65 66 67 68 69 | |
UrlRecord
dataclass
¶
Bases: Record
Represents a URL record.
Source code in accumulate\models\records.py
46 47 48 49 50 51 52 53 54 55 56 | |
range_of(record_range, item_type)
¶
Validate and cast a RecordRange to a specific item type.
Source code in accumulate\models\records.py
14 15 16 17 18 19 20 21 | |
accounts
¶
Account
¶
Bases: UnionValue
Base class for all account types.
Source code in accumulate\models\accounts.py
12 13 14 15 16 17 18 19 20 21 22 | |
FullAccount
¶
Bases: Account
Base class for accounts with authentication.
Source code in accumulate\models\accounts.py
25 26 27 28 29 30 31 32 | |
KeyBook
¶
Bases: FullAccount
Source code in accumulate\models\accounts.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
_validate_key_book_url()
¶
Validation specific to KeyBook URLs.
Source code in accumulate\models\accounts.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
LiteIdentity
¶
Bases: Account
Source code in accumulate\models\accounts.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
__repr__()
¶
Custom representation for LiteIdentity.
Source code in accumulate\models\accounts.py
118 119 120 121 122 123 124 | |
LiteTokenAccount
¶
Bases: Account
Source code in accumulate\models\accounts.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
_ensure_url(url)
¶
Ensure the URL is valid or parse it.
Source code in accumulate\models\accounts.py
141 142 143 144 145 146 | |
UnknownAccount
¶
Bases: Account
Source code in accumulate\models\accounts.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
_ensure_url(url)
¶
Ensure the URL is a valid instance or parse it.
Source code in accumulate\models\accounts.py
40 41 42 43 44 45 | |
submission
¶
Submission
dataclass
¶
Represents a transaction submission in the Accumulate blockchain.
Source code in accumulate\models\submission.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
from_dict(data)
classmethod
¶
Creates a Submission instance from a dictionary.
Source code in accumulate\models\submission.py
32 33 34 35 36 37 38 39 40 41 42 | |
to_dict()
¶
Converts the Submission instance to a dictionary.
Source code in accumulate\models\submission.py
21 22 23 24 25 26 27 28 29 30 | |
signature_types
¶
SignatureType
¶
Bases: Enum
Cryptographic signature algorithms using string identifiers.
Source code in accumulate\models\signature_types.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
from_value(value)
classmethod
¶
Retrieve an enum instance by its value.
Source code in accumulate\models\signature_types.py
25 26 27 28 29 30 31 | |
to_rpc_format()
¶
Convert SignatureType to the expected string format for JSON-RPC.
Source code in accumulate\models\signature_types.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
Additional Models & Schemas¶
AccountAuthOperations
¶
AccountAuthOperation
¶
Base class for account authentication operations.
Source code in accumulate\models\AccountAuthOperations.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
hash()
¶
Generate a unique hash for this operation based on its attributes.
Source code in accumulate\models\AccountAuthOperations.py
25 26 27 28 29 30 | |
type()
¶
Return the operation type. Must be implemented by subclasses.
Source code in accumulate\models\AccountAuthOperations.py
19 20 21 22 23 | |
AddAccountAuthorityOperation
¶
Bases: AccountAuthOperation
Represents an operation to add an authority to an account's authorization list.
:param authority: The URL of the authority to add.
Source code in accumulate\models\AccountAuthOperations.py
61 62 63 64 65 66 67 68 69 70 71 72 | |
DisableAccountAuthOperation
¶
Bases: AccountAuthOperation
Represents an operation to disable authorization for a specific authority.
:param authority: The URL of the authority to disable.
Source code in accumulate\models\AccountAuthOperations.py
47 48 49 50 51 52 53 54 55 56 57 58 | |
EnableAccountAuthOperation
¶
Bases: AccountAuthOperation
Represents an operation to enable authorization for a specific authority.
:param authority: The URL of the authority to enable.
Source code in accumulate\models\AccountAuthOperations.py
33 34 35 36 37 38 39 40 41 42 43 44 | |
RemoveAccountAuthorityOperation
¶
Bases: AccountAuthOperation
Represents an operation to remove an authority from an account's authorization list.
:param authority: The URL of the authority to remove.
Source code in accumulate\models\AccountAuthOperations.py
75 76 77 78 79 80 81 82 83 84 85 86 | |
address
¶
Address
¶
Abstract base class for addresses.
Source code in accumulate\models\address.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
__str__()
¶
Return the string representation of the address.
Source code in accumulate\models\address.py
28 29 30 | |
get_private_key()
¶
Get the private key.
Source code in accumulate\models\address.py
24 25 26 | |
get_public_key()
¶
Get the public key.
Source code in accumulate\models\address.py
20 21 22 | |
get_public_key_hash()
¶
Get the public key hash.
Source code in accumulate\models\address.py
16 17 18 | |
get_type()
¶
Get the type of the address.
Source code in accumulate\models\address.py
12 13 14 | |
Lite
¶
Bases: Address
Represents a lightweight address.
Source code in accumulate\models\address.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
PrivateKey
¶
Bases: PublicKey
Represents an address based on a private key.
Source code in accumulate\models\address.py
107 108 109 110 111 112 113 114 115 116 117 118 | |
PublicKey
¶
Bases: Address
Represents an address based on a public key.
Source code in accumulate\models\address.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
PublicKeyHashAddress
¶
Bases: Address
Represents an address based on a public key hash.
Source code in accumulate\models\address.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
Unknown
¶
Bases: Address
Represents an unknown address.
Source code in accumulate\models\address.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
format_address(signature_type, hash_value)
¶
Format an address based on its type and hash value.
Source code in accumulate\models\address.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
hash_public_key(public_key, signature_type)
¶
Hash a public key based on its signature type.
Source code in accumulate\models\address.py
161 162 163 164 165 166 167 168 169 170 | |
auth
¶
AccountAuth
¶
Manages account authorities for access control.
Source code in accumulate\models\auth.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
__init__(authorities=None)
¶
Initialize AccountAuth.
:param authorities: Optional list of AuthorityEntry objects.
Source code in accumulate\models\auth.py
23 24 25 26 27 28 29 | |
add_authority(entry_url)
¶
Add a new authority entry.
:param entry_url: The URL of the new authority. :return: A tuple containing the new or existing AuthorityEntry and a boolean indicating if it was newly added.
Source code in accumulate\models\auth.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
all_authorities_are_disabled()
¶
Check if all authorities are disabled.
:return: True if all authorities are disabled, False otherwise.
Source code in accumulate\models\auth.py
47 48 49 50 51 52 53 | |
get_authority(entry_url)
¶
Get an authority entry by its URL.
:param entry_url: The URL of the authority to find. :return: A tuple containing the AuthorityEntry and a boolean indicating if it was found.
Source code in accumulate\models\auth.py
55 56 57 58 59 60 61 62 63 64 65 | |
key_book()
¶
Get the primary authority's URL.
:return: URL of the primary authority or None if not available.
Source code in accumulate\models\auth.py
31 32 33 34 35 36 37 | |
manager_key_book()
¶
Get the secondary authority's URL.
:return: URL of the secondary authority or None if not available.
Source code in accumulate\models\auth.py
39 40 41 42 43 44 45 | |
remove_authority(entry_url)
¶
Remove an authority entry by its URL.
:param entry_url: The URL of the authority to remove. :return: True if the authority was removed, False otherwise.
Source code in accumulate\models\auth.py
82 83 84 85 86 87 88 89 90 91 92 93 | |
AuthorityEntry
¶
Represents an authority entry with a URL and a disabled flag.
Source code in accumulate\models\auth.py
6 7 8 9 10 11 12 13 14 15 16 17 | |
__init__(url, disabled=False)
¶
Initialize an AuthorityEntry.
:param url: The URL of the authority. :param disabled: Boolean flag indicating if the authority is disabled.
Source code in accumulate\models\auth.py
9 10 11 12 13 14 15 16 17 | |
base_transactions
¶
ExpireOptions
¶
Represents expiration options for a transaction.
Source code in accumulate\models\base_transactions.py
138 139 140 141 142 143 144 145 146 147 | |
__init__(at_time=None)
¶
:param at_time: The expiration time as a Unix timestamp.
Source code in accumulate\models\base_transactions.py
143 144 145 146 147 | |
HoldUntilOptions
¶
Represents hold-until options for a transaction.
Source code in accumulate\models\base_transactions.py
150 151 152 153 154 155 156 157 158 159 | |
__init__(minor_block=None)
¶
:param minor_block: The minor block at which the transaction is held until.
Source code in accumulate\models\base_transactions.py
155 156 157 158 159 | |
TransactionBodyBase
¶
Bases: ABC
Base class for all transaction bodies, providing standardized marshaling/unmarshaling.
Source code in accumulate\models\base_transactions.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
_format_transaction_type(transaction_type)
staticmethod
¶
Convert ENUM transaction type to lowerCamelCase for JSON compatibility.
Source code in accumulate\models\base_transactions.py
78 79 80 81 82 | |
fields_to_encode()
abstractmethod
¶
Return the fields to encode as a list of (field_id, value, encoding_function).
Source code in accumulate\models\base_transactions.py
40 41 42 43 | |
marshal()
¶
Generic marshaling for all transactions using structured encoding.
Source code in accumulate\models\base_transactions.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
to_dict()
¶
Convert transaction to a dictionary with correct type formatting.
Source code in accumulate\models\base_transactions.py
74 75 76 | |
type()
abstractmethod
¶
Return the transaction type.
Source code in accumulate\models\base_transactions.py
35 36 37 38 | |
unmarshal(data)
abstractmethod
classmethod
¶
Generic unmarshaling method to be implemented per transaction type.
Source code in accumulate\models\base_transactions.py
68 69 70 71 72 | |
TransactionBodyFactory
¶
Factory for creating transaction body instances based on transaction type.
Source code in accumulate\models\base_transactions.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
create(client, transaction_type, *args, **kwargs)
async
classmethod
¶
Dynamically create a transaction body instance of the specified type.
:param client: AccumulateClient instance (optional, for API interactions). :param transaction_type: Enum specifying the transaction type. :param args: Positional arguments for the transaction body constructor. :param kwargs: Keyword arguments for the transaction body constructor. :return: A fully initialized TransactionBodyBase subclass instance, or None if unsupported.
Source code in accumulate\models\base_transactions.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
TransactionHeader
¶
Represents the header of a transaction, containing metadata and conditions.
Source code in accumulate\models\base_transactions.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | |
build_transaction(txn)
¶
Build transaction JSON while conditionally including optional fields. Ensures transactionHash matches header['initiator'] for validation. Automatically wraps the transaction inside a list.
Source code in accumulate\models\base_transactions.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | |
create(principal, public_key, signer, timestamp=None, transaction_body=None)
async
classmethod
¶
Automatically compute the initiator hash and return a fully constructed TransactionHeader.
Source code in accumulate\models\base_transactions.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
marshal_binary()
¶
Serialize the transaction header to bytes using the updated field‐based encoding.
Source code in accumulate\models\base_transactions.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
to_dict()
¶
Convert the transaction header to a dictionary while conditionally including optional fields.
Source code in accumulate\models\base_transactions.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
unmarshal(data)
staticmethod
¶
Deserialize the transaction header from bytes using the updated encoding scheme.
Source code in accumulate\models\base_transactions.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
credits
¶
CreditsAccount
¶
Represents an account with a credit balance.
Source code in accumulate\models\credits.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
__init__(credit_balance=0)
¶
Initialize a credits account.
:param credit_balance: Initial credit balance of the account.
Source code in accumulate\models\credits.py
6 7 8 9 10 11 12 | |
can_debit_credits(amount)
¶
Check if the account has enough credits to debit.
:param amount: The amount to check for debiting. :return: True if the account can debit the amount, False otherwise.
Source code in accumulate\models\credits.py
30 31 32 33 34 35 36 37 | |
credit_credits(amount)
¶
Add credits to the account.
:param amount: The amount of credits to add.
Source code in accumulate\models\credits.py
22 23 24 25 26 27 28 | |
debit_credits(amount)
¶
Debit credits from the account.
:param amount: The amount of credits to debit. :return: True if the debit was successful, False otherwise.
Source code in accumulate\models\credits.py
39 40 41 42 43 44 45 46 47 48 49 | |
get_credit_balance()
¶
Get the current credit balance.
:return: The credit balance as an integer.
Source code in accumulate\models\credits.py
14 15 16 17 18 19 20 | |
data_entries
¶
AccumulateDataEntry
¶
Bases: DataEntry
Represents a single-hash data entry.
Source code in accumulate\models\data_entries.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
marshal()
¶
Serialize the DataEntry to bytes.
Source code in accumulate\models\data_entries.py
80 81 82 83 84 85 86 87 88 | |
to_dict()
¶
Convert AccumulateDataEntry to a JSON-serializable dictionary.
Source code in accumulate\models\data_entries.py
90 91 92 93 94 95 96 97 | |
DataEntry
¶
Base class for data entries.
Source code in accumulate\models\data_entries.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
get_data()
¶
Return the raw data of the entry.
Source code in accumulate\models\data_entries.py
22 23 24 | |
hash()
¶
Return the hash of the data entry (must be implemented by subclasses).
Source code in accumulate\models\data_entries.py
26 27 28 | |
marshal()
¶
Serialize the DataEntry to bytes. FIX: Ensure the correct entry encoding.
Source code in accumulate\models\data_entries.py
30 31 32 33 34 35 36 37 38 | |
type()
¶
Return the data entry type (must be implemented by subclasses).
Source code in accumulate\models\data_entries.py
18 19 20 | |
unmarshal(data)
classmethod
¶
Deserialize a data entry from bytes.
Source code in accumulate\models\data_entries.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
DataEntryUtils
¶
Utility functions for data entries.
Source code in accumulate\models\data_entries.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
calculate_data_entry_cost(entry, fee_data)
staticmethod
¶
Calculate the cost of writing a data entry.
:param entry: The data entry to calculate the cost for. :param fee_data: The base fee multiplier for data entries. :return: The cost in credits.
Source code in accumulate\models\data_entries.py
163 164 165 166 167 168 169 170 171 172 173 | |
check_data_entry_size(entry)
staticmethod
¶
Validate the size of the data entry.
:param entry: The data entry to check. :return: The size of the marshaled data entry in bytes. :raises ValueError: If the entry is empty or exceeds the size limit.
Source code in accumulate\models\data_entries.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
DoubleHashDataEntry
¶
Bases: DataEntry
Represents a double-hash data entry (Used in Go JSON).
Source code in accumulate\models\data_entries.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
hash()
¶
Compute the double SHA-256 hash (Merkle root of the data).
Source code in accumulate\models\data_entries.py
107 108 109 110 111 112 113 | |
marshal()
¶
Serialize the DataEntry to bytes. FIX: Ensure the correct entry encoding.
Source code in accumulate\models\data_entries.py
115 116 117 118 119 120 121 122 123 124 125 126 | |
to_dict()
¶
Convert DoubleHashDataEntry to a JSON-serializable dictionary.
Source code in accumulate\models\data_entries.py
129 130 131 132 133 134 135 136 | |
type()
¶
Return the DataEntryType for double-hash entries.
Source code in accumulate\models\data_entries.py
103 104 105 | |
enums
¶
AccountAuthOperationType
¶
Bases: Enum
Operations for account authorization.
Source code in accumulate\models\enums.py
209 210 211 212 213 214 215 | |
AccountType
¶
Bases: Enum
Types of accounts in the Accumulate blockchain.
Source code in accumulate\models\enums.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
BookType
¶
Bases: Enum
Types of key books.
Source code in accumulate\models\enums.py
233 234 235 236 237 | |
DataEntryType
¶
Bases: Enum
Types of data entries in the blockchain.
Source code in accumulate\models\enums.py
131 132 133 134 135 136 | |
EventType
¶
Bases: Enum
Types of blockchain events.
Source code in accumulate\models\enums.py
87 88 89 90 91 | |
ExecutorVersion
¶
Bases: Enum
Versions of the executor system.
Source code in accumulate\models\enums.py
219 220 221 222 223 224 225 226 227 228 229 | |
KeyPageOperationType
¶
Bases: Enum
Operations for key pages.
Source code in accumulate\models\enums.py
196 197 198 199 200 201 202 203 204 205 | |
KnownPeerStatus
¶
Bases: Enum
Statuses of known peers in the network.
Source code in accumulate\models\enums.py
95 96 97 98 99 | |
QueryType
¶
Bases: Enum
Query types for retrieving blockchain data.
Source code in accumulate\models\enums.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
from_value(value)
classmethod
¶
Retrieve an enum instance by its numeric value.
Source code in accumulate\models\enums.py
43 44 45 46 47 48 49 | |
to_rpc_format()
¶
Convert to the expected JSON-RPC queryType format (camelCase).
Source code in accumulate\models\enums.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
RecordType
¶
Bases: Enum
Types of records stored in the blockchain.
Source code in accumulate\models\enums.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
ServiceType
¶
Bases: Enum
Types of services available in the Accumulate network, using hexadecimal values.
Source code in accumulate\models\enums.py
6 7 8 9 10 11 12 13 14 15 16 17 18 | |
TransactionType
¶
Bases: Enum
Transaction types supported by the Accumulate blockchain.
Source code in accumulate\models\enums.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
is_anchor()
¶
Check if the transaction type is an anchor transaction.
Source code in accumulate\models\enums.py
189 190 191 | |
is_synthetic()
¶
Check if the transaction type is synthetic.
Source code in accumulate\models\enums.py
185 186 187 | |
is_user()
¶
Check if the transaction type is a user transaction.
Source code in accumulate\models\enums.py
181 182 183 | |
VoteType
¶
Bases: Enum
Vote types used in governance.
Source code in accumulate\models\enums.py
122 123 124 125 126 127 | |
enum_from_name(enum_cls, name)
¶
Retrieve enum value by name.
Source code in accumulate\models\enums.py
241 242 243 244 245 246 | |
errors
¶
AccumulateError
¶
Bases: Exception
Base class for Accumulate-related errors.
Source code in accumulate\models\errors.py
41 42 43 44 45 46 47 48 | |
EncodingError
¶
Bases: AccumulateError
Error raised when encoding or decoding fails.
Source code in accumulate\models\errors.py
52 53 54 55 56 57 | |
ErrorCode
¶
Bases: Enum
Enumeration of error codes and their descriptions.
Source code in accumulate\models\errors.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
from_value(value)
classmethod
¶
Retrieve the error code enum from its integer value.
:param value: The integer value of the error code. :return: The corresponding ErrorCode enum. :raises ValueError: If the value is not a valid error code.
Source code in accumulate\models\errors.py
27 28 29 30 31 32 33 34 35 36 37 38 39 | |
success()
¶
Determines if the error code represents a successful state.
Source code in accumulate\models\errors.py
21 22 23 24 25 | |
FailedError
¶
Bases: AccumulateError
Error raised for general failure cases.
Source code in accumulate\models\errors.py
61 62 63 64 65 66 | |
PanicError
¶
Bases: AccumulateError
Error raised for fatal errors.
Source code in accumulate\models\errors.py
69 70 71 72 73 74 | |
UnknownError
¶
Bases: AccumulateError
Error raised for unknown issues.
Source code in accumulate\models\errors.py
77 78 79 80 81 82 | |
ValidationError
¶
Bases: Exception
Raised when validation fails.
Source code in accumulate\models\errors.py
109 110 | |
raise_for_error_code(code, message=None)
¶
Raise the appropriate exception based on the error code.
:param code: The error code as an integer. :param message: An optional message describing the error. :raises AccumulateError: The corresponding exception for the error code.
Source code in accumulate\models\errors.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
events
¶
BlockEvent
¶
Bases: Record
Represents a block event.
Source code in accumulate\models\events.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
from_dict(data)
staticmethod
¶
Create a BlockEvent from a dictionary.
Source code in accumulate\models\events.py
53 54 55 56 57 58 59 60 61 62 | |
to_dict()
¶
Convert to dictionary.
Source code in accumulate\models\events.py
42 43 44 45 46 47 48 49 50 51 | |
ErrorEvent
¶
Represents an error event in the system.
Source code in accumulate\models\events.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
from_dict(data)
staticmethod
¶
Create an ErrorEvent from a dictionary.
Source code in accumulate\models\events.py
18 19 20 21 | |
to_dict()
¶
Convert to dictionary.
Source code in accumulate\models\events.py
14 15 16 | |
GlobalsEvent
¶
Represents a global values change event.
Source code in accumulate\models\events.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
from_dict(data)
staticmethod
¶
Create a GlobalsEvent from a dictionary.
Source code in accumulate\models\events.py
77 78 79 80 81 82 83 | |
to_dict()
¶
Convert to dictionary.
Source code in accumulate\models\events.py
73 74 75 | |
faucet
¶
Faucet
¶
Represents the Accumulate faucet account.
Source code in accumulate\models\faucet.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
__init__()
¶
Initialize the Faucet.
Source code in accumulate\models\faucet.py
24 25 26 | |
_generate_faucet_url()
¶
Generate the faucet URL using the public key.
:return: A string representing the faucet URL.
Source code in accumulate\models\faucet.py
28 29 30 31 32 33 34 35 | |
public_key()
¶
Get the public key of the faucet.
:return: The public key as bytes.
Source code in accumulate\models\faucet.py
37 38 39 40 41 42 43 44 45 46 | |
signer()
¶
Create a new faucet signer with the current timestamp.
:return: A FaucetSigner instance.
Source code in accumulate\models\faucet.py
48 49 50 51 52 53 54 | |
FaucetSigner
¶
Handles signing for the faucet.
Source code in accumulate\models\faucet.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
__init__(timestamp)
¶
Initialize the FaucetSigner.
:param timestamp: The timestamp to use for signing.
Source code in accumulate\models\faucet.py
60 61 62 63 64 65 66 | |
set_public_key(sig)
¶
Set the public key for a given signature.
:param sig: The signature object to update. :raises ValueError: If the signature type is unsupported.
Source code in accumulate\models\faucet.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
sign(sig, sig_md_hash, message)
¶
Sign the message with the faucet key.
:param sig: The signature object to update. :param sig_md_hash: The metadata hash for the signature. :param message: The message to sign. :raises ValueError: If the signature type is unsupported.
Source code in accumulate\models\faucet.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
version()
¶
Get the version of the signer.
:return: Version as an integer.
Source code in accumulate\models\faucet.py
68 69 70 71 72 73 74 | |
fee_schedule
¶
Fee
¶
Enumeration of transaction fees in credits.
Source code in accumulate\models\fee_schedule.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
FeeSchedule
¶
Source code in accumulate\models\fee_schedule.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
compute_transaction_fee(tx, transaction_size_max=20480)
staticmethod
¶
Compute the fee for a given transaction.
:param tx: The transaction object. :param transaction_size_max: Maximum allowed size for a transaction. :return: The calculated fee in credits.
Source code in accumulate\models\fee_schedule.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
general
¶
AccountAuth
dataclass
¶
Represents account authorization details.
Source code in accumulate\models\general.py
58 59 60 61 | |
AnchorMetadata
dataclass
¶
Metadata for an anchor.
Source code in accumulate\models\general.py
30 31 32 33 34 35 36 37 | |
AuthorityEntry
dataclass
¶
Represents an entry in the account's authorization list.
Source code in accumulate\models\general.py
64 65 66 67 68 | |
BlockEntry
dataclass
¶
Represents a single entry in a block.
Source code in accumulate\models\general.py
40 41 42 43 44 45 | |
CreditRecipient
dataclass
¶
Source code in accumulate\models\general.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
marshal()
¶
Serialize CreditRecipient to bytes.
Source code in accumulate\models\general.py
105 106 107 108 109 | |
to_dict()
¶
Convert TokenRecipient to dictionary format for JSON serialization.
Source code in accumulate\models\general.py
97 98 99 100 101 102 | |
unmarshal(data)
classmethod
¶
Deserialize bytes into CreditRecipient.
Source code in accumulate\models\general.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
FeeSchedule
dataclass
¶
Represents a fee schedule for the network.
Source code in accumulate\models\general.py
137 138 139 140 141 142 | |
IndexEntry
dataclass
¶
Represents an index entry in a chain.
Source code in accumulate\models\general.py
48 49 50 51 52 53 54 55 | |
NetworkGlobals
dataclass
¶
Represents network-level global configurations.
Source code in accumulate\models\general.py
157 158 159 160 161 162 163 164 165 | |
NetworkLimits
dataclass
¶
Represents network protocol limits.
Source code in accumulate\models\general.py
145 146 147 148 149 150 151 152 153 154 | |
Object
dataclass
¶
Generic object with chains and pending transactions.
Source code in accumulate\models\general.py
22 23 24 25 26 27 | |
TokenRecipient
dataclass
¶
Source code in accumulate\models\general.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
to_dict()
¶
Convert TokenRecipient to dictionary format for JSON serialization.
Source code in accumulate\models\general.py
81 82 83 84 85 86 | |
key_management
¶
AddKeyOperation
dataclass
¶
Represents an operation to add a key to a key page.
:param entry: The key specification to add.
Source code in accumulate\models\key_management.py
128 129 130 131 132 133 134 135 | |
KeyPage
dataclass
¶
Represents a page of keys with threshold signature requirements.
Source code in accumulate\models\key_management.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
add_key_spec(key_spec)
¶
Add a key specification to the key page.
:param key_spec: The key specification to add.
Source code in accumulate\models\key_management.py
66 67 68 69 70 71 72 73 74 75 | |
entry_by_key_hash(key_hash)
¶
Find a key entry by its hash.
:param key_hash: The hash of the key to search for. :return: A tuple (index, key_spec, found) where index is the position, key_spec is the found key, and found is a boolean.
Source code in accumulate\models\key_management.py
54 55 56 57 58 59 60 61 62 63 64 | |
get_m_of_n()
¶
Retrieve the signature requirements for the key page.
:return: A tuple (m, n) where m is the threshold and n is the total number of keys.
Source code in accumulate\models\key_management.py
31 32 33 34 35 36 37 | |
remove_key_spec_at(index)
¶
Remove a key specification at a specific index.
:param index: The index of the key to remove. :raises IndexError: If the index is out of range.
Source code in accumulate\models\key_management.py
77 78 79 80 81 82 83 84 85 86 | |
set_threshold(m)
¶
Set the signature threshold for the key page.
:param m: The required number of signatures. :raises ValueError: If the threshold is invalid.
Source code in accumulate\models\key_management.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
KeySpec
dataclass
¶
Represents a key specification with metadata.
Source code in accumulate\models\key_management.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
get_last_used_on()
¶
Retrieve the timestamp of the last key usage.
Source code in accumulate\models\key_management.py
16 17 18 | |
set_last_used_on(timestamp)
¶
Set the timestamp of the last key usage.
Source code in accumulate\models\key_management.py
20 21 22 | |
KeySpecParams
dataclass
¶
Represents the parameters for a key specification.
Source code in accumulate\models\key_management.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
marshal()
¶
Serialize the KeySpecParams to bytes correctly.
Source code in accumulate\models\key_management.py
95 96 97 98 99 100 101 102 103 | |
unmarshal(data)
classmethod
¶
Deserialize bytes into a KeySpecParams instance using field-based encoding.
Source code in accumulate\models\key_management.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
RemoveKeyOperation
dataclass
¶
Represents an operation to remove a key from a key page.
:param entry: The key specification to remove.
Source code in accumulate\models\key_management.py
138 139 140 141 142 143 144 145 | |
SetRejectThresholdKeyPageOperation
dataclass
¶
Represents an operation to set the rejection threshold for a key page.
:param threshold: The number of signatures required to reject.
Source code in accumulate\models\key_management.py
170 171 172 173 174 175 176 177 | |
SetResponseThresholdKeyPageOperation
dataclass
¶
Represents an operation to set the response threshold for a key page.
:param threshold: The number of signatures required for a response.
Source code in accumulate\models\key_management.py
180 181 182 183 184 185 186 187 | |
SetThresholdKeyPageOperation
dataclass
¶
Represents an operation to set the signature threshold for a key page.
:param threshold: The required number of signatures.
Source code in accumulate\models\key_management.py
160 161 162 163 164 165 166 167 | |
UpdateAllowedKeyPageOperation
dataclass
¶
Represents an operation to update the allowed or denied transactions for a key page.
:param allow: List of allowed transaction types. :param deny: List of denied transaction types.
Source code in accumulate\models\key_management.py
190 191 192 193 194 195 196 197 198 199 | |
UpdateKeyOperation
dataclass
¶
Represents an operation to update a key in a key page.
:param old_entry: The existing key specification to update. :param new_entry: The new key specification to replace the old one.
Source code in accumulate\models\key_management.py
148 149 150 151 152 153 154 155 156 157 | |
key_signature
¶
KeySignature
¶
Bases: ABC
Abstract base class to represent a cryptographic signature.
Source code in accumulate\models\key_signature.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
get_public_key()
abstractmethod
¶
Return the public key bytes.
Source code in accumulate\models\key_signature.py
20 21 22 23 | |
get_public_key_hash()
abstractmethod
¶
Return the hash of the public key.
Source code in accumulate\models\key_signature.py
15 16 17 18 | |
get_signature()
abstractmethod
¶
Return the signature bytes.
Source code in accumulate\models\key_signature.py
10 11 12 13 | |
get_signer_version()
abstractmethod
¶
Return the version of the signer.
Source code in accumulate\models\key_signature.py
25 26 27 28 | |
get_timestamp()
abstractmethod
¶
Return the timestamp of the signature.
Source code in accumulate\models\key_signature.py
30 31 32 33 | |
node_info
¶
NodeInfo
dataclass
¶
Represents information about a network node.
Source code in accumulate\models\node_info.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
from_dict(data)
classmethod
¶
Deserialize a dictionary into a NodeInfo object.
Source code in accumulate\models\node_info.py
19 20 21 22 23 24 25 26 27 28 29 30 | |
to_dict()
¶
Serialize a NodeInfo object into a dictionary.
Source code in accumulate\models\node_info.py
32 33 34 35 36 37 38 39 40 41 42 | |
options
¶
FaucetOptions
dataclass
¶
Options for requesting tokens from the faucet.
Source code in accumulate\models\options.py
37 38 39 40 | |
RangeOptions
dataclass
¶
Options for querying ranges.
Source code in accumulate\models\options.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
to_dict()
¶
Convert RangeOptions to a dictionary.
Source code in accumulate\models\options.py
15 16 17 18 19 20 21 22 | |
ReceiptOptions
dataclass
¶
Options for querying receipts.
Source code in accumulate\models\options.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
is_valid()
¶
Validate the receipt options.
Source code in accumulate\models\options.py
63 64 65 | |
to_dict()
¶
Convert ReceiptOptions to a dictionary.
Source code in accumulate\models\options.py
56 57 58 59 60 61 | |
SubmitOptions
dataclass
¶
Options for submitting transactions.
Source code in accumulate\models\options.py
24 25 26 27 28 | |
SubscribeOptions
dataclass
¶
Options for subscribing to events.
Source code in accumulate\models\options.py
43 44 45 46 47 | |
ValidateOptions
dataclass
¶
Options for validating transactions.
Source code in accumulate\models\options.py
31 32 33 34 | |
protocol
¶
AccountAuthOperation
¶
Base class for account authorization operations.
Source code in accumulate\models\protocol.py
151 152 153 154 | |
AccountWithTokens
¶
Interface for accounts that manage tokens.
Source code in accumulate\models\protocol.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
AddAccountAuthorityOperation
¶
Bases: AccountAuthOperation
Add a new authority to an account.
Source code in accumulate\models\protocol.py
167 168 169 | |
AllowedTransactions
¶
Bit mask for allowed transactions.
Source code in accumulate\models\protocol.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
clear(bit)
¶
Clear the bit (set to 0).
Source code in accumulate\models\protocol.py
224 225 226 | |
from_json(json_str)
classmethod
¶
Deserialize from JSON.
Source code in accumulate\models\protocol.py
256 257 258 259 260 261 262 263 | |
get_enum_value()
¶
Get the underlying integer value.
Source code in accumulate\models\protocol.py
244 245 246 | |
is_set(bit)
¶
Check if the bit is set.
Source code in accumulate\models\protocol.py
228 229 230 | |
set(bit)
¶
Set the bit to 1.
Source code in accumulate\models\protocol.py
220 221 222 | |
set_enum_value(value)
¶
Set the value from an integer.
Source code in accumulate\models\protocol.py
248 249 250 | |
to_json()
¶
Serialize the object to JSON.
Source code in accumulate\models\protocol.py
252 253 254 | |
unpack()
¶
List all set bits.
Source code in accumulate\models\protocol.py
232 233 234 235 236 237 238 239 240 241 242 | |
DisableAccountAuthOperation
¶
Bases: AccountAuthOperation
Disable authorization for an account.
Source code in accumulate\models\protocol.py
162 163 164 | |
EnableAccountAuthOperation
¶
Bases: AccountAuthOperation
Enable authorization for an account.
Source code in accumulate\models\protocol.py
157 158 159 | |
LiteTokenAccount
¶
Bases: AccountWithTokens
Represents a lite token account.
Source code in accumulate\models\protocol.py
127 128 129 | |
Receipt
dataclass
¶
Represents a receipt with block metadata.
Source code in accumulate\models\protocol.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
_validate_iso8601(date_str)
staticmethod
¶
Validate the string is in ISO 8601 format.
Source code in accumulate\models\protocol.py
205 206 207 208 209 210 211 | |
from_dict(data)
classmethod
¶
Create a receipt from a dictionary.
Source code in accumulate\models\protocol.py
192 193 194 195 196 197 198 199 200 201 202 203 | |
to_dict()
¶
Convert the receipt to a dictionary.
Source code in accumulate\models\protocol.py
184 185 186 187 188 189 190 | |
RemoveAccountAuthorityOperation
¶
Bases: AccountAuthOperation
Remove an authority from an account.
Source code in accumulate\models\protocol.py
172 173 174 | |
TokenAccount
¶
Bases: AccountWithTokens
Represents a standard token account.
Source code in accumulate\models\protocol.py
132 133 134 | |
TokenIssuer
¶
Represents a token issuer.
Source code in accumulate\models\protocol.py
137 138 139 140 141 142 143 144 145 146 147 148 | |
acme_url()
¶
Returns the URL for the ACME token.
Source code in accumulate\models\protocol.py
18 19 20 | |
lite_data_address(chain_id)
¶
Generates a lite data address from a chain ID.
Source code in accumulate\models\protocol.py
28 29 30 31 32 33 | |
lite_token_address(pub_key, token_url_str)
¶
Generates a lite token account URL from a public key and token URL.
Source code in accumulate\models\protocol.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
normalize_acc_url(url_str)
¶
Ensures a URL starts with the 'acc://' prefix.
Source code in accumulate\models\protocol.py
50 51 52 53 54 | |
parse_lite_address(url)
¶
Parses and validates a lite address.
Source code in accumulate\models\protocol.py
36 37 38 39 40 41 42 43 44 45 46 47 48 | |
unknown_url()
¶
Returns the URL for unknown entities.
Source code in accumulate\models\protocol.py
23 24 25 | |
responses
¶
SubmissionResponse
dataclass
¶
Represents the response for a transaction submission.
Source code in accumulate\models\responses.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
from_dict(data)
classmethod
¶
Deserialize the response from a dictionary.
Source code in accumulate\models\responses.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
to_dict()
¶
Serialize the response to a dictionary.
Source code in accumulate\models\responses.py
16 17 18 19 20 21 22 23 24 25 | |
TransactionResultSet
dataclass
¶
Represents a set of transaction results returned from a query.
Source code in accumulate\models\responses.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
add_result(result)
¶
Add a transaction status to the results.
Source code in accumulate\models\responses.py
54 55 56 57 | |
from_dict(data)
classmethod
¶
Create a TransactionResultSet from a dictionary.
Source code in accumulate\models\responses.py
65 66 67 68 69 70 71 72 73 74 75 76 | |
to_dict()
¶
Convert the result set to a dictionary representation.
Source code in accumulate\models\responses.py
59 60 61 62 63 | |
search
¶
AnchorSearchQuery
¶
Bases: SearchQuery
Search for an anchor in an account.
Source code in accumulate\models\search.py
35 36 37 38 39 40 41 42 43 44 45 46 | |
__init__(anchor, include_receipt=None)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
anchor
|
Union[bytes, str]
|
The anchor value (hash) to search for. |
required |
include_receipt
|
Optional[bool]
|
Whether to include a receipt in the response. |
None
|
Source code in accumulate\models\search.py
38 39 40 41 42 43 44 45 46 | |
DelegateSearchQuery
¶
Bases: SearchQuery
Search for a delegate in an account.
Source code in accumulate\models\search.py
61 62 63 64 65 66 67 68 69 | |
__init__(delegate_url)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delegate_url
|
str
|
The URL of the delegate being searched. |
required |
Source code in accumulate\models\search.py
64 65 66 67 68 69 | |
PublicKeySearchQuery
¶
Bases: SearchQuery
Search for a public key in an account.
Source code in accumulate\models\search.py
48 49 50 51 52 53 54 55 56 57 58 | |
__init__(public_key, key_type=None)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
str
|
The public key, address, or public key hash. |
required |
key_type
|
Optional[str]
|
The type of public key (e.g., 'ed25519', 'btc', 'eth'). |
None
|
Source code in accumulate\models\search.py
51 52 53 54 55 56 57 58 | |
SearchQuery
¶
Bases: Query
Base class for all search queries (Anchor, Public Key, Delegate).
Source code in accumulate\models\search.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
__init__(query_type, value, extra_params=None)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query_type
|
QueryType
|
The type of search query (anchor, publicKey, delegate). |
required |
value
|
str
|
The value being searched (hash, public key, or delegate URL). |
required |
extra_params
|
Optional[Dict[str, Any]]
|
Additional query parameters. |
None
|
Source code in accumulate\models\search.py
11 12 13 14 15 16 17 18 19 20 | |
is_valid()
¶
Validate the search query.
Source code in accumulate\models\search.py
22 23 24 25 | |
to_dict()
¶
Convert the search query into a dictionary that can be used with client.search().
Source code in accumulate\models\search.py
27 28 29 30 31 32 | |
service
¶
FindServiceOptions
dataclass
¶
Represents options for finding a service in the Accumulate network.
Source code in accumulate\models\service.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
from_dict(data)
classmethod
¶
Deserialize a dictionary into a FindServiceOptions object.
Source code in accumulate\models\service.py
108 109 110 111 112 113 114 115 116 117 118 | |
to_dict()
¶
Serialize a FindServiceOptions object into a dictionary.
Removes timeout if it is None to prevent JSON-RPC errors.
Source code in accumulate\models\service.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
FindServiceResult
dataclass
¶
Represents the result of a service search in the Accumulate network.
Source code in accumulate\models\service.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
from_dict(data)
classmethod
¶
Deserialize a dictionary into a FindServiceResult object.
Source code in accumulate\models\service.py
140 141 142 143 144 145 146 147 148 149 | |
to_dict()
¶
Serialize a FindServiceResult object into a dictionary.
Source code in accumulate\models\service.py
130 131 132 133 134 135 136 137 138 | |
ServiceAddress
dataclass
¶
Represents a service address with type and argument.
Source code in accumulate\models\service.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
type
property
¶
Alias for service_type.
__str__()
¶
Returns {type}:{argument}, or {type} if the argument is empty.
Source code in accumulate\models\service.py
21 22 23 24 25 26 | |
from_dict(data)
staticmethod
¶
Creates a ServiceAddress from a dictionary.
Source code in accumulate\models\service.py
34 35 36 37 38 39 | |
parse_service_address(address)
staticmethod
¶
Parses a string into a ServiceAddress.
:param address: A string representing the service address in the format {type}:{argument}. :return: A ServiceAddress instance. :raises ValueError: If the format is invalid.
Source code in accumulate\models\service.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
to_dict()
¶
Converts the object to a dictionary.
Source code in accumulate\models\service.py
28 29 30 31 32 | |
unpack_address(address)
staticmethod
¶
Simulates unpacking of an address string for its components.
:param address: A string representing the service address. :return: A dictionary containing type and argument of the service address. :raises ValueError: If the address cannot be parsed.
Source code in accumulate\models\service.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
signatures
¶
AuthoritySignature
¶
Bases: Signature
Source code in accumulate\models\signatures.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
hash()
¶
Calculate hash for AuthoritySignature.
Source code in accumulate\models\signatures.py
279 280 281 282 283 284 285 286 287 288 | |
DelegatedSignature
¶
Bases: Signature
Source code in accumulate\models\signatures.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
hash()
¶
Calculate hash for DelegatedSignature.
Source code in accumulate\models\signatures.py
256 257 258 259 260 261 262 263 264 265 | |
ECDSA_SHA256Signature
¶
Bases: Signature
Represents an ECDSA SHA-256 signature.
Source code in accumulate\models\signatures.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | |
hash()
¶
Calculate the SHA-256 hash of the public key.
Source code in accumulate\models\signatures.py
384 385 386 387 388 | |
sign(msg, private_key)
¶
Sign a message using ECDSA SHA-256 with the provided private key.
Source code in accumulate\models\signatures.py
402 403 404 405 406 407 408 409 410 411 412 413 | |
verify(msg)
¶
Verify the ECDSA SHA-256 signature for the provided message.
Source code in accumulate\models\signatures.py
390 391 392 393 394 395 396 397 398 399 400 | |
ED25519Signature
¶
Bases: Signature
Source code in accumulate\models\signatures.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
hash(message)
¶
Follow JS hashing structure for ED25519.
Source code in accumulate\models\signatures.py
63 64 65 66 67 | |
to_dict()
¶
Convert ED25519 signature to a dictionary.
Source code in accumulate\models\signatures.py
78 79 80 81 82 83 84 85 86 87 88 | |
EIP712Signature
¶
Bases: Signature
Source code in accumulate\models\signatures.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
_encode_typed_data(data)
staticmethod
¶
Encode EIP-712 typed data.
Source code in accumulate\models\signatures.py
120 121 122 123 | |
hash(data)
¶
Generate EIP-712 compliant hash.
Source code in accumulate\models\signatures.py
99 100 101 102 | |
ETHSignature
¶
Bases: Signature
Represents an Ethereum signature.
Source code in accumulate\models\signatures.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
get_public_key()
¶
Return the public key bytes.
Source code in accumulate\models\signatures.py
368 369 370 | |
get_signature()
¶
Return the raw signature bytes.
Source code in accumulate\models\signatures.py
364 365 366 | |
hash()
¶
Calculate the Ethereum-specific hash of the public key.
Source code in accumulate\models\signatures.py
344 345 346 | |
verify(message)
¶
Verify the Ethereum signature.
Source code in accumulate\models\signatures.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
Lite
¶
Represents a lite account URL and associated data.
Source code in accumulate\models\signatures.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | |
__str__()
¶
String representation of the lite account.
Source code in accumulate\models\signatures.py
571 572 573 | |
get_bytes()
¶
Return the raw bytes of the lite account.
Source code in accumulate\models\signatures.py
567 568 569 | |
get_url()
¶
Return the URL of the lite account.
Source code in accumulate\models\signatures.py
563 564 565 | |
PrivateKey
¶
Represents a private key and its associated public key.
Source code in accumulate\models\signatures.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | |
__init__(key, type_, public_key=None)
¶
Initialize a PrivateKey instance.
:param key: The private key bytes. :param type_: The type of the private key (e.g., ED25519, ECDSA). :param public_key: The optional public key bytes.
Source code in accumulate\models\signatures.py
471 472 473 474 475 476 477 478 479 480 481 | |
__str__()
¶
Format the private key as a string representation.
Source code in accumulate\models\signatures.py
515 516 517 518 519 | |
get_private_key()
¶
Get the raw private key bytes.
:return: A tuple containing the private key bytes and a boolean indicating success.
Source code in accumulate\models\signatures.py
499 500 501 502 503 504 505 | |
get_public_key()
¶
Get the associated public key.
:return: The associated PublicKey instance or None if not set.
Source code in accumulate\models\signatures.py
507 508 509 510 511 512 513 | |
get_type()
¶
Get the type of the private key.
Source code in accumulate\models\signatures.py
493 494 495 496 497 | |
PublicKey
¶
Represents a public key and provides methods for its operations.
Source code in accumulate\models\signatures.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |
__init__(key, type_)
¶
Initialize a PublicKey instance.
:param key: The public key bytes. :param type_: The type of the public key (e.g., ED25519, ECDSA).
Source code in accumulate\models\signatures.py
421 422 423 424 425 426 427 428 429 | |
__str__()
¶
Format the public key as a string.
Source code in accumulate\models\signatures.py
459 460 461 462 463 464 | |
get_public_key()
¶
Get the raw public key bytes.
:return: A tuple containing the public key bytes and a boolean indicating success.
Source code in accumulate\models\signatures.py
440 441 442 443 444 445 446 | |
get_public_key_hash()
¶
Get the hash of the public key.
:return: A tuple containing the hashed public key bytes and a boolean indicating success.
Source code in accumulate\models\signatures.py
448 449 450 451 452 453 454 455 456 457 | |
get_type()
¶
Get the type of the public key.
Source code in accumulate\models\signatures.py
434 435 436 437 438 | |
PublicKeyHash
¶
Represents a hash derived from a public key.
Source code in accumulate\models\signatures.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
__str__()
¶
String representation of the address.
Source code in accumulate\models\signatures.py
545 546 547 | |
get_public_key_hash()
¶
Return the hash of the public key.
Source code in accumulate\models\signatures.py
541 542 543 | |
get_type()
¶
Return the type of the public key hash.
Source code in accumulate\models\signatures.py
537 538 539 | |
RCD1Signature
¶
Bases: Signature
Source code in accumulate\models\signatures.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
hash()
¶
Calculate RCD1-specific hash.
Source code in accumulate\models\signatures.py
303 304 305 | |
verify(msg)
¶
Verify the signature using ED25519.
Source code in accumulate\models\signatures.py
307 308 309 310 311 312 313 | |
Signature
¶
Base class for managing all signature types.
Source code in accumulate\models\signatures.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
encode()
¶
Serialize signature metadata for consistent hashing.
Source code in accumulate\models\signatures.py
41 42 43 44 | |
hash(message)
¶
Follow JS hashing structure: First hash signature metadata, then concatenate and hash with message.
Source code in accumulate\models\signatures.py
35 36 37 38 39 | |
SignatureFactory
¶
Factory to create signatures based on type.
Source code in accumulate\models\signatures.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
TypedDataSignature
¶
Bases: Signature
Source code in accumulate\models\signatures.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
_encode_typed_data(data)
staticmethod
¶
Encode EIP-712 typed data.
Source code in accumulate\models\signatures.py
242 243 244 245 | |
hash(data)
¶
Generate EIP-712 compliant hash.
Source code in accumulate\models\signatures.py
229 230 231 232 | |
do_btc_hash(pub_key)
¶
Calculate the Bitcoin hash (RIPEMD160(SHA256(pub_key))).
Source code in accumulate\models\signatures.py
327 328 329 330 331 332 | |
do_eth_hash(pub_key)
¶
Calculate the Ethereum address hash.
Source code in accumulate\models\signatures.py
322 323 324 325 | |
transaction_results
¶
AddCreditsResult
¶
Bases: TransactionResult
Represents the result of an Add Credits transaction.
:param amount: The amount of tokens added. :param credits: The number of credits added. :param oracle: The oracle rate used for conversion.
Source code in accumulate\models\transaction_results.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
EmptyResult
¶
Bases: TransactionResult
Represents an empty transaction result.
Source code in accumulate\models\transaction_results.py
18 19 20 21 22 23 24 25 26 | |
TransactionResult
¶
Base class for transaction results.
Source code in accumulate\models\transaction_results.py
7 8 9 10 11 12 13 14 15 | |
WriteDataResult
¶
Bases: TransactionResult
Represents the result of a Write Data transaction.
:param entry_hash: The hash of the data entry. :param account_url: The URL of the account associated with the entry. :param account_id: The ID of the account associated with the entry.
Source code in accumulate\models\transaction_results.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
copy_transaction_result(result)
¶
Create a copy of the transaction result.
:param result: The transaction result to copy. :return: A copy of the transaction result.
Source code in accumulate\models\transaction_results.py
144 145 146 147 148 149 150 151 | |
deserialize_json(data)
¶
Deserialize JSON bytes into a dictionary.
:param data: JSON bytes. :return: A dictionary representation of the JSON data.
Source code in accumulate\models\transaction_results.py
154 155 156 157 158 159 160 161 162 | |
equal_transaction_result(a, b)
¶
Compare two transaction results for equality.
:param a: The first transaction result. :param b: The second transaction result. :return: True if they are equal, False otherwise.
Source code in accumulate\models\transaction_results.py
102 103 104 105 106 107 108 109 110 | |
new_transaction_result(typ)
¶
Factory method to create a new transaction result based on the type.
:param typ: The transaction type. :return: A new instance of the appropriate TransactionResult subclass.
Source code in accumulate\models\transaction_results.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
unmarshal_transaction_result(data)
¶
Deserialize a transaction result from raw data or JSON.
:param data: Raw bytes or JSON object containing the transaction result. :return: The deserialized TransactionResult.
Source code in accumulate\models\transaction_results.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
txid
¶
TxID
¶
Represents a transaction ID.
Source code in accumulate\models\txid.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
__eq__(other)
¶
Equality operator.
Source code in accumulate\models\txid.py
79 80 81 | |
__hash__()
¶
Hash operator.
Source code in accumulate\models\txid.py
83 84 85 | |
__str__()
¶
Return the string representation of the TxID.
Source code in accumulate\models\txid.py
50 51 52 53 54 55 56 57 58 | |
account()
¶
Get the account URL associated with the TxID.
Source code in accumulate\models\txid.py
75 76 77 | |
as_url()
¶
Construct a URL representation of the TxID.
Source code in accumulate\models\txid.py
69 70 71 72 73 | |
from_json(json_str)
classmethod
¶
Deserialize a JSON string into a TxID instance.
Source code in accumulate\models\txid.py
93 94 95 96 97 98 99 100 101 | |
json()
¶
Serialize the TxID to a JSON string.
Source code in accumulate\models\txid.py
87 88 89 90 91 | |
parse(txid_str)
staticmethod
¶
Parse a TxID string into a TxID object.
Source code in accumulate\models\txid.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
txid_set
¶
TxIdSet
¶
Source code in accumulate\models\txid_set.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
add(txid)
¶
Add a transaction ID to the set using a sorted insertion.
Source code in accumulate\models\txid_set.py
11 12 13 14 15 16 17 18 19 20 21 22 23 | |
contains_hash(hash_)
¶
Check if a transaction ID with the given hash exists in the set.
Source code in accumulate\models\txid_set.py
34 35 36 37 38 39 40 41 | |
remove(txid)
¶
Remove a transaction ID from the set if it exists.
Source code in accumulate\models\txid_set.py
25 26 27 28 29 30 31 32 | |
types
¶
AtomicSlice
¶
Thread-safe list management.
Source code in accumulate\models\types.py
26 27 28 29 30 31 32 33 34 35 36 | |
compare(other)
¶
Compare the items with another list.
Source code in accumulate\models\types.py
34 35 36 | |
AtomicUint
¶
Thread-safe atomic counter.
Source code in accumulate\models\types.py
11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Utils¶
conversion
¶
camel_to_snake(name)
¶
Converts camelCase to snake_case.
Source code in accumulate\utils\conversion.py
5 6 7 | |
address_from
¶
from_ecdsa_private_key(key)
¶
Create a PrivateKey instance from an ECDSA private key.
Source code in accumulate\utils\address_from.py
91 92 93 94 95 96 97 98 99 | |
from_ecdsa_public_key(key)
¶
Create a PublicKey instance from an ECDSA public key.
Source code in accumulate\utils\address_from.py
82 83 84 85 86 87 88 | |
from_ed25519_private_key(key)
¶
Create a PrivateKey instance from an Ed25519 private key (must be 64 bytes).
Source code in accumulate\utils\address_from.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
from_ed25519_public_key(key)
¶
Create a PublicKey instance from an Ed25519 public key (must be 32 bytes).
Source code in accumulate\utils\address_from.py
36 37 38 39 40 | |
from_eth_private_key(key)
¶
Create a PrivateKey instance from an Ethereum private key.
Source code in accumulate\utils\address_from.py
102 103 104 105 106 | |
from_private_key_bytes(key, signature_type)
¶
Create a PrivateKey instance from raw private key bytes.
Source code in accumulate\utils\address_from.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
from_rsa_private_key(key)
¶
Create a PrivateKey instance from an RSA private key.
Source code in accumulate\utils\address_from.py
71 72 73 74 75 76 77 78 79 | |
from_rsa_public_key(key)
¶
Create a PublicKey instance from an RSA public key.
Source code in accumulate\utils\address_from.py
62 63 64 65 66 67 68 | |
generate_ed25519_keypair()
¶
Generate an Ed25519 keypair that matches TweetNaCl (64-byte private key, 32-byte public key).
Source code in accumulate\utils\address_from.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
encoding
¶
consume(target, consumer)
¶
Extracts fields from an object and applies the consumer function to each field
Mirrors the JS consume() function
Source code in accumulate\utils\encoding.py
188 189 190 191 192 193 194 195 196 197 | |
decode_uvarint(buf)
¶
Decodes an unsigned integer from a bytes object using varint encoding
Source code in accumulate\utils\encoding.py
40 41 42 43 44 45 46 47 48 49 | |
encode(target)
¶
Python equivalent of the JS encode() function Encodes an object into a binary format using uvarint encoding.
Source code in accumulate\utils\encoding.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
encode_compact_int(value)
¶
Encodes an integer in compact form: a one‑byte length followed by the big‑endian bytes
Source code in accumulate\utils\encoding.py
67 68 69 70 71 72 73 74 | |
encode_uvarint(x)
¶
Encodes an unsigned integer using varint encoding.
Source code in accumulate\utils\encoding.py
27 28 29 30 31 32 33 34 35 36 37 38 | |
encode_value(value)
¶
Encodes a single value based on its type Mirrors the encoding rules from the JavaScript library
Source code in accumulate\utils\encoding.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
field_marshal_binary(field, val)
¶
Encodes a field by writing its field number as one byte, then appending the provided value (which itself may already be length‑prefixed)
Source code in accumulate\utils\encoding.py
77 78 79 80 81 82 83 84 85 86 | |
read_uvarint(reader)
¶
Reads an unsigned varint from a byte stream
Source code in accumulate\utils\encoding.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
hash_functions
¶
LiteAuthorityForHash(key_hash)
¶
Generate a Lite Token Account suffix from a key hash
:param key_hash: The SHA-256 first 20 bytes :return: A valid Lite Token Account suffix
Source code in accumulate\utils\hash_functions.py
108 109 110 111 112 113 114 115 116 117 118 119 | |
LiteAuthorityForKey(pub_key, signature_type)
¶
Generate a Lite Token Account (LTA) URL from a public key
:param pub_key: The public key in bytes :param signature_type: The signature type (e.g., "ED25519") :return: A valid Lite Token Account (LTA) URL
Source code in accumulate\utils\hash_functions.py
96 97 98 99 100 101 102 103 104 105 106 | |
btc_address(public_key)
¶
Generate a BTC address from a public key
Source code in accumulate\utils\hash_functions.py
61 62 63 64 65 66 67 68 69 70 | |
compute_hash(obj)
¶
Compute a SHA-256 hash for an object implementing a marshal_binary() method.
If raw bytes are provided, hash them directly.
Source code in accumulate\utils\hash_functions.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
eth_address(public_key)
¶
Generate an ETH address from a public key
Source code in accumulate\utils\hash_functions.py
73 74 75 76 77 78 79 80 81 82 | |
hash_data(data)
¶
Computes the SHA-256 hash of the given data
Source code in accumulate\utils\hash_functions.py
85 86 87 88 89 90 91 | |
public_key_hash(public_key, signature_type)
¶
Calculate the public key hash based on the signature type
Source code in accumulate\utils\hash_functions.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
Additional Utils¶
address_parse
¶
is_wif_key(wif)
¶
Check if a string is a valid WIF (Wallet Import Format) key.
:param wif: The WIF key string. :return: True if valid, False otherwise.
Source code in accumulate\utils\address_parse.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
parse_ac_address(address)
¶
Parse an Accumulate public key (AC) address.
Source code in accumulate\utils\address_parse.py
62 63 64 65 66 67 68 69 70 71 72 73 74 | |
parse_as_address(address)
¶
Parse an Accumulate private key (AS) address.
Source code in accumulate\utils\address_parse.py
77 78 79 80 81 82 83 84 85 86 87 88 89 | |
parse_btc_address(address)
¶
Parse a Bitcoin public key (BT) address.
Source code in accumulate\utils\address_parse.py
114 115 116 117 | |
parse_eth_address(address)
¶
Parse an Ethereum address.
Source code in accumulate\utils\address_parse.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
parse_fa_address(address)
¶
Parse a Factom public key (FA) address.
Source code in accumulate\utils\address_parse.py
93 94 95 96 97 98 99 100 | |
parse_fs_address(address)
¶
Parse a Factom private key (Fs) address.
Source code in accumulate\utils\address_parse.py
103 104 105 106 107 108 109 110 | |
parse_mh_address(address)
¶
Parse an unknown hash (as a multihash).
Source code in accumulate\utils\address_parse.py
138 139 140 141 142 143 144 145 146 | |
parse_wif(wif)
¶
Parse a WIF (Wallet Import Format) encoded key.
Source code in accumulate\utils\address_parse.py
202 203 204 205 206 207 208 209 210 211 212 213 | |
parse_with_checksum(address, length, prefix)
¶
Parse an address with a binary prefix and checksum.
Source code in accumulate\utils\address_parse.py
164 165 166 167 168 169 170 171 172 173 174 | |
parse_with_prefix(address, length, prefix)
¶
Parse an address with a specific prefix and length.
Source code in accumulate\utils\address_parse.py
150 151 152 153 154 155 156 157 158 159 160 | |
verify_checksum(data, checksum)
¶
Verify a double SHA-256 checksum.
Source code in accumulate\utils\address_parse.py
222 223 224 225 226 | |
config
¶
Config
¶
Configuration utility for managing environment-specific settings.
Source code in accumulate\utils\config.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
get_initial_oracle_value()
staticmethod
¶
Get the initial ACME oracle value for the configured network. :return: The oracle value as a float.
Source code in accumulate\utils\config.py
31 32 33 34 35 36 37 | |
get_network_type()
staticmethod
¶
Get the current network type. :return: 'testnet' or 'mainnet'
Source code in accumulate\utils\config.py
23 24 25 26 27 28 29 | |
initial_acme_oracle()
staticmethod
¶
Dynamically get the initial ACME oracle value based on the network type.
Source code in accumulate\utils\config.py
16 17 18 19 20 21 | |
is_testnet()
staticmethod
¶
Dynamically get the testnet status based on the environment variable.
Source code in accumulate\utils\config.py
9 10 11 12 13 14 | |
eip712
¶
eth_chain_id(network_name)
¶
Returns the Ethereum chain ID for an Accumulate network name
:param network_name: The name of the network (e.g., "mainnet") :return: The Ethereum chain ID
Source code in accumulate\utils\eip712.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
hash_eip712(transaction, signature)
¶
Hashes an EIP-712 transaction and signature
:param transaction: The transaction object :param signature: The signature object :return: SHA-256 hash of the EIP-712 message
Source code in accumulate\utils\eip712.py
172 173 174 175 176 177 178 179 180 181 182 | |
marshal_eip712(transaction, signature)
¶
Creates the EIP-712 JSON message for a transaction and signature
:param transaction: The transaction object :param signature: The signature object :return: Serialized EIP-712 JSON message
Source code in accumulate\utils\eip712.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
fields
¶
BoolField
¶
Bases: Field
Field for boolean values
Source code in accumulate\utils\fields.py
48 49 50 51 52 53 54 | |
DateTimeField
¶
Bases: Field
Field for datetime values
Source code in accumulate\utils\fields.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
DurationField
¶
Bases: Field
Field for timedelta (duration) values.
Source code in accumulate\utils\fields.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
from_json(data, instance)
¶
Convert a JSON-compatible dictionary back to a timedelta
Source code in accumulate\utils\fields.py
151 152 153 154 155 156 157 158 159 160 161 | |
is_empty(value)
¶
Check if the timedelta is empty (default value)
Source code in accumulate\utils\fields.py
163 164 165 | |
to_json(value)
¶
Convert a timedelta to a JSON-compatible dictionary
Source code in accumulate\utils\fields.py
143 144 145 146 147 148 149 | |
Field
¶
Base class for field access and validation
Source code in accumulate\utils\fields.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
from_json(data, instance)
¶
Deserialize the field from JSON
Source code in accumulate\utils\fields.py
24 25 26 27 | |
is_empty(value)
¶
Check if a field value is empty
Source code in accumulate\utils\fields.py
14 15 16 | |
to_json(value)
¶
Serialize the field to JSON
Source code in accumulate\utils\fields.py
18 19 20 21 22 | |
FloatField
¶
Bases: Field
Field for float values
Source code in accumulate\utils\fields.py
73 74 75 76 77 78 79 | |
IntField
¶
Bases: Field
Field for integer values
Source code in accumulate\utils\fields.py
30 31 32 33 34 35 36 | |
ReadOnlyAccessor
¶
Read-only accessor for managing field serialization and equality checks
Source code in accumulate\utils\fields.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
__init__(accessor)
¶
Initialize with a callable that provides access to the field value :param accessor: A callable that takes a parent object and returns the field value
Source code in accumulate\utils\fields.py
85 86 87 88 89 90 | |
copy_to(dst, src)
¶
Read-only accessor does not support copying
Source code in accumulate\utils\fields.py
127 128 129 | |
equal(obj1, obj2)
¶
Check if two objects have equal field values
Source code in accumulate\utils\fields.py
97 98 99 | |
from_json(json_data, obj)
¶
Read-only accessor does not support deserialization from JSON
Source code in accumulate\utils\fields.py
135 136 137 | |
is_empty(obj)
¶
Check if the field is empty
Source code in accumulate\utils\fields.py
92 93 94 95 | |
read_from(data, obj)
¶
Read-only accessor does not support deserialization
Source code in accumulate\utils\fields.py
131 132 133 | |
to_json(obj)
¶
Convert the field value to a JSON-compatible format
Source code in accumulate\utils\fields.py
101 102 103 104 105 106 107 108 109 110 | |
write_to(obj)
¶
Serialize the field value into binary For demonstration, this simply converts the value to bytes if possible
Source code in accumulate\utils\fields.py
112 113 114 115 116 117 118 119 120 121 122 123 124 | |
StringField
¶
Bases: Field
Field for string values
Source code in accumulate\utils\fields.py
39 40 41 42 43 44 45 | |
TimeAccessor
¶
Bases: ReadOnlyAccessor
Accessor for managing datetime fields
Source code in accumulate\utils\fields.py
168 169 170 171 172 173 174 175 176 177 | |
to_json(obj)
¶
Convert a datetime field to JSON-compatible ISO format
Source code in accumulate\utils\fields.py
174 175 176 177 | |
formatting
¶
_calculate_checksum(data)
¶
Calculates a double SHA-256 checksum
Source code in accumulate\utils\formatting.py
120 121 122 123 | |
_format_with_checksum(hash_bytes, prefix)
¶
Formats the address with a checksum
Source code in accumulate\utils\formatting.py
110 111 112 113 114 115 116 117 118 | |
_format_with_prefix(hash_bytes, prefix)
¶
Formats the address with a prefix and checksum
Source code in accumulate\utils\formatting.py
100 101 102 103 104 105 106 107 108 | |
_hash_with_algorithm(data, algorithm)
¶
Hashes data using the specified algorithm
:param data: Data to hash :param algorithm: Hashing algorithm (e.g., 'sha256', 'sha512'). :return: Hashed bytes
Source code in accumulate\utils\formatting.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
format_ac1(hash_bytes)
¶
Formats an Accumulate AC1 (ed25519) public key hash
Source code in accumulate\utils\formatting.py
11 12 13 | |
format_ac2(hash_bytes)
¶
Formats an Accumulate AC2 (ecdsa) public key hash
Source code in accumulate\utils\formatting.py
19 20 21 | |
format_ac3(hash_bytes)
¶
Formats an Accumulate AC3 (rsa) public key hash
Source code in accumulate\utils\formatting.py
27 28 29 | |
format_as1(seed)
¶
Formats an Accumulate AS1 (ed25519) private key
Source code in accumulate\utils\formatting.py
15 16 17 | |
format_as2(seed)
¶
Formats an Accumulate AS2 (ecdsa) private key
Source code in accumulate\utils\formatting.py
23 24 25 | |
format_as3(seed)
¶
Formats an Accumulate AS3 (rsa) private key
Source code in accumulate\utils\formatting.py
31 32 33 | |
format_btc(hash_bytes)
¶
Formats a Bitcoin P2PKH address prefixed with 'BT'
Source code in accumulate\utils\formatting.py
43 44 45 | |
format_eth(hash_bytes)
¶
Formats an Ethereum address
Source code in accumulate\utils\formatting.py
47 48 49 50 51 52 53 54 55 56 | |
format_fa(hash_bytes)
¶
Formats a Factom FA public key hash
Source code in accumulate\utils\formatting.py
35 36 37 | |
format_fs(seed)
¶
Formats a Factom Fs private key
Source code in accumulate\utils\formatting.py
39 40 41 | |
format_mh(hash_bytes, code='sha256')
¶
Formats a hash using a specified hashing algorithm and appends a checksum
:param hash_bytes: Input data to be hashed :param code: Hashing algorithm (e.g., 'sha256', 'sha512') :return: Multihash-formatted string
Source code in accumulate\utils\formatting.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
import_helpers
¶
get_signer()
¶
Dynamically import Signer to prevent circular imports.
Source code in accumulate\utils\import_helpers.py
9 10 11 12 | |
is_lite_account_lazy(url)
¶
Lazy-load is_lite_account() to prevent circular imports.
Source code in accumulate\utils\import_helpers.py
14 15 16 17 | |
query_signer_version(account_url, client=None)
async
¶
Fetch the signer version from the network API using AccumulateClient.
Source code in accumulate\utils\import_helpers.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
protocols
¶
BinaryValue
¶
Bases: Protocol
Protocol for objects supporting binary serialization and deserialization.
Source code in accumulate\utils\protocols.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
copy_as_interface()
¶
Create a copy of the instance.
Source code in accumulate\utils\protocols.py
16 17 18 | |
marshal_binary()
¶
Serialize to binary format.
Source code in accumulate\utils\protocols.py
8 9 10 | |
unmarshal_binary(data)
¶
Deserialize from binary format.
Source code in accumulate\utils\protocols.py
12 13 14 | |
unmarshal_binary_from(reader)
¶
Unmarshal binary data from a stream.
Source code in accumulate\utils\protocols.py
20 21 22 | |
UnionValue
¶
Bases: BinaryValue, Protocol
Protocol for objects supporting field unmarshaling.
Source code in accumulate\utils\protocols.py
24 25 26 27 28 29 | |
unmarshal_fields_from(reader)
¶
Unmarshal fields from a binary stream.
Source code in accumulate\utils\protocols.py
27 28 29 | |
rational
¶
Rational
¶
Source code in accumulate\utils\rational.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
set(numerator, denominator)
¶
Set the numerator and denominator of the rational value
Source code in accumulate\utils\rational.py
13 14 15 16 17 18 | |
threshold(key_count)
¶
Calculate the threshold based on the ratio and key count Equivalent to keyCount * numerator / denominator, rounded up
Source code in accumulate\utils\rational.py
20 21 22 23 24 25 26 27 28 | |
union
¶
UnionValue
¶
A Pythonic implementation for managing values with multiple representations, inspired by Go's UnionValue interface
Source code in accumulate\utils\union.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
__eq__(other)
¶
Check equality between two UnionValue instances
Source code in accumulate\utils\union.py
49 50 51 52 53 | |
__hash__()
¶
Allow the UnionValue to be used in hashable collections
Source code in accumulate\utils\union.py
55 56 57 | |
__repr__()
¶
Human-readable representation
Source code in accumulate\utils\union.py
59 60 61 | |
copy()
¶
Create a copy of the current UnionValue
Source code in accumulate\utils\union.py
45 46 47 | |
marshal_binary()
¶
Convert the value to its binary representation
Source code in accumulate\utils\union.py
16 17 18 19 20 21 22 23 24 25 | |
marshal_json()
¶
Convert the value to its JSON representation
Source code in accumulate\utils\union.py
31 32 33 34 35 36 | |
unmarshal_binary(data)
¶
Set the value from its binary representation
Source code in accumulate\utils\union.py
27 28 29 | |
unmarshal_json(data)
¶
Set the value from its JSON representation
Source code in accumulate\utils\union.py
38 39 40 41 42 43 | |
url
¶
InvalidHashError
¶
Bases: URLParseError
Raised when a transaction ID includes an invalid hash
Source code in accumulate\utils\url.py
28 29 | |
MissingHashError
¶
Bases: URLParseError
Raised when a transaction ID does not include a hash
Source code in accumulate\utils\url.py
24 25 | |
MissingHostError
¶
Bases: URLParseError
Raised when a URL does not include a hostname
Source code in accumulate\utils\url.py
16 17 | |
URL
¶
Source code in accumulate\utils\url.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
__eq__(other)
¶
Equality operator for URLs (case-insensitive).
Source code in accumulate\utils\url.py
209 210 211 | |
__lt__(other)
¶
Comparison operator for URLs.
Source code in accumulate\utils\url.py
213 214 215 | |
_normalize_path(path)
staticmethod
¶
Normalize a path to ensure it is clean and starts with a '/'.
Source code in accumulate\utils\url.py
65 66 67 68 69 | |
account_id()
¶
Generate the Account ID hash.
Source code in accumulate\utils\url.py
247 248 249 250 251 252 | |
hash()
¶
Generate a hash of the entire URL.
Source code in accumulate\utils\url.py
261 262 263 264 265 266 267 268 | |
identity()
¶
Return the Accumulate Digital Identity (ADI), which is the root authority.
Source code in accumulate\utils\url.py
237 238 239 240 241 242 243 244 245 | |
identity_id()
¶
Generate the Identity ID hash.
Source code in accumulate\utils\url.py
254 255 256 257 258 259 | |
is_key_page_url()
¶
Check if the URL represents a valid key page.
Source code in accumulate\utils\url.py
201 202 203 204 205 206 | |
parse(url_str)
staticmethod
¶
Parse a string into an Accumulate URL
Source code in accumulate\utils\url.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
root_identity()
¶
Return the root identity (authority only).
Source code in accumulate\utils\url.py
233 234 235 | |
strip_extras()
¶
Return a URL with only the authority and path.
Source code in accumulate\utils\url.py
229 230 231 | |
valid_utf8()
¶
Validate that all components are UTF-8.
Source code in accumulate\utils\url.py
270 271 272 273 274 275 276 277 278 279 280 | |
with_path(path)
¶
Return a new URL with modified path.
Source code in accumulate\utils\url.py
221 222 223 | |
with_query(query)
¶
Return a new URL with modified query.
Source code in accumulate\utils\url.py
225 226 227 | |
with_user_info(user_info)
¶
Return a new URL with modified user info.
Source code in accumulate\utils\url.py
217 218 219 | |
URLParseError
¶
Bases: Exception
Base class for URL parsing errors
Source code in accumulate\utils\url.py
12 13 | |
WrongSchemeError
¶
Bases: URLParseError
Raised when a URL includes an invalid scheme
Source code in accumulate\utils\url.py
20 21 | |
validation
¶
is_lite_account(account_type)
¶
Returns True if the account type is a Lite Account.
Source code in accumulate\utils\validation.py
125 126 127 | |
is_reserved_url(url)
¶
Checks if a URL object or string is reserved.
Source code in accumulate\utils\validation.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
is_valid_adi_url(url, allow_reserved=False)
¶
Validates an ADI URL according to protocol rules.
Source code in accumulate\utils\validation.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
process_signer_url(url, client=None)
async
¶
Determines if a signer is a Lite Identity, Key Page, or ADI and fetches signer version
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
{ "url": str (Processed signer URL), "signer_type": str ("liteIdentity", "keyPage", "adi"), "signer_version": int (1 for Lite, actual version for Key Page) |
dict
|
} |
Source code in accumulate\utils\validation.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
validate_accumulate_url(url)
¶
Validate if a URL object or string is a valid Accumulate URL.
Source code in accumulate\utils\validation.py
87 88 89 90 91 92 93 94 95 96 97 98 99 | |
Signing¶
builder
¶
Builder
¶
Source code in accumulate\signing\builder.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
_create_signature(transaction_data)
¶
Create a signature object based on the specified type.
Source code in accumulate\signing\builder.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
initiate(txn)
async
¶
Initiate a transaction and prepare the signature.
Source code in accumulate\signing\builder.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
prepare(init, transaction_data)
¶
Prepare a signature ensuring transaction data is included.
Source code in accumulate\signing\builder.py
137 138 139 140 141 142 | |
set_signer(signer)
¶
Sets the signer and assigns it to the builder.
Source code in accumulate\signing\builder.py
64 65 66 67 68 69 70 71 | |
sign(message)
async
¶
Sign the provided message and return a dictionary.
Source code in accumulate\signing\builder.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
signature_handler
¶
SignatureHandler
¶
Source code in accumulate\signing\signature_handler.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
btc_address(public_key)
staticmethod
¶
Generate a BTC address from a public key
Source code in accumulate\signing\signature_handler.py
27 28 29 30 | |
create_authority_signature(origin, authority, vote, txid)
staticmethod
¶
Create a signature for an authority.
Source code in accumulate\signing\signature_handler.py
46 47 48 49 50 51 52 53 54 | |
eth_address(public_key)
staticmethod
¶
Generate an ETH address from a public key
Source code in accumulate\signing\signature_handler.py
32 33 34 35 | |
sign_btc(private_key, message)
staticmethod
¶
Sign a message using Bitcoin ECDSA SECP256k1
Source code in accumulate\signing\signature_handler.py
80 81 82 83 84 | |
sign_delegated_signature(inner_signature, delegator)
staticmethod
¶
Create a delegated signature
Source code in accumulate\signing\signature_handler.py
170 171 172 173 | |
sign_ecdsa_sha256(private_key, message)
staticmethod
¶
Sign a message using ECDSA SHA256
Source code in accumulate\signing\signature_handler.py
147 148 149 150 151 | |
sign_ed25519(private_key, message)
staticmethod
¶
Sign a message using ED25519.
Source code in accumulate\signing\signature_handler.py
63 64 65 66 67 | |
sign_eth(private_key, message_hash)
staticmethod
¶
Sign an Ethereum message
Source code in accumulate\signing\signature_handler.py
97 98 99 100 101 102 103 104 | |
sign_rsa_sha256(private_key, message)
staticmethod
¶
Sign a message with RSA SHA-256
Source code in accumulate\signing\signature_handler.py
117 118 119 120 121 122 123 124 125 126 127 | |
sign_typed_data(private_key, message_hash)
staticmethod
¶
Sign an Ethereum message using EIP-712 Typed Data
Source code in accumulate\signing\signature_handler.py
164 165 166 167 | |
verify_authority_signature(authority_signature, origin, authority, vote, txid)
staticmethod
¶
Verify an authority signature.
Source code in accumulate\signing\signature_handler.py
56 57 58 59 60 | |
verify_btc(public_key, message, signature)
staticmethod
¶
Verify a BTC (ECDSA SECP256k1) signature
Source code in accumulate\signing\signature_handler.py
86 87 88 89 90 91 92 93 94 | |
verify_delegated_signature(delegated_signature, inner_signature, delegator)
staticmethod
¶
Verify a delegated signature.
Source code in accumulate\signing\signature_handler.py
175 176 177 178 179 | |
verify_ecdsa_sha256(public_key, message, signature)
staticmethod
¶
Verify an ECDSA SHA256 signature
Source code in accumulate\signing\signature_handler.py
153 154 155 156 157 158 159 160 161 | |
verify_ed25519(public_key, message, signature)
staticmethod
¶
Verify an ED25519 signature.
Source code in accumulate\signing\signature_handler.py
69 70 71 72 73 74 75 76 77 | |
verify_eth(public_key, message_hash, signature)
staticmethod
¶
Verify an Ethereum (EIP-712) signature
Source code in accumulate\signing\signature_handler.py
106 107 108 109 110 111 112 113 114 | |
verify_merkle_hash(metadata_hash, txn_hash, signature)
staticmethod
¶
Verify if a Merkle hash is valid.
Source code in accumulate\signing\signature_handler.py
37 38 39 40 41 42 43 44 | |
verify_rsa_sha256(public_key, message, signature)
staticmethod
¶
Verify an RSA SHA-256 signature
Source code in accumulate\signing\signature_handler.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
signer
¶
Signer
¶
Source code in accumulate\signing\signer.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
calculate_metadata_hash(public_key, timestamp, signer, version, signature_type)
staticmethod
¶
Compute Accumulate's signature metadata (initiator) hash using uvarint encoding for all fields. This exactly mirrors the Dart implementation.
Fields: - Field 1: Signature type (varint-encoded) - Field 2: Public key (varint-encoded length + raw bytes) - Field 4: Signer URL (UTF-8 encoded, with varint length prefix) - Field 5: Signer version (varint-encoded) - Field 6: Timestamp (varint-encoded)
Source code in accumulate\signing\signer.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
get_signature_type()
async
¶
Fetch the appropriate signature type dynamically.
- If already cached, return it.
- Otherwise, determine it dynamically.
Source code in accumulate\signing\signer.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
sign_and_submit_transaction(client, txn, signature_type, debug=False)
async
¶
Signs the transaction, constructs the envelope, and submits it.
:param client: AccumulateClient instance :param txn: Transaction object :param signature_type: Type of signature (e.g., ED25519) :param debug: If True, print the exact JSON request without sending it. :return: Response from the Accumulate network or printed JSON in debug mode.
Source code in accumulate\signing\signer.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
sign_transaction(signature_type, message, txn_header, signer_version=None)
async
¶
Signs the transaction using the timestamp from the TransactionHeader.
:param signature_type: The signature type (e.g., ED25519, BTC, etc.). :param message: The transaction hash to sign. :param txn_header: The TransactionHeader instance, containing the timestamp. :param signer_version: The signer's version (if None, uses the default). :return: A signed transaction dictionary.
Source code in accumulate\signing\signer.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
timestamp
¶
Timestamp
¶
Bases: ABC
Abstract base class for timestamp implementations.
Source code in accumulate\signing\timestamp.py
7 8 9 10 11 12 13 14 15 16 17 18 | |
get()
abstractmethod
¶
Retrieve the current timestamp value.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The current timestamp value. |
Source code in accumulate\signing\timestamp.py
10 11 12 13 14 15 16 17 18 | |
TimestampFromValue
¶
Bases: Timestamp
Static timestamp that always returns a predefined value.
Source code in accumulate\signing\timestamp.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
get()
¶
Retrieve the static timestamp value.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The predefined timestamp value. |
Source code in accumulate\signing\timestamp.py
28 29 30 31 32 33 34 35 | |
TimestampFromVariable
¶
Bases: Timestamp
Dynamic timestamp that starts with real time (in milliseconds) and increments.
Source code in accumulate\signing\timestamp.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
get()
¶
Atomically increment and retrieve the timestamp value.
Source code in accumulate\signing\timestamp.py
48 49 50 51 52 | |
reset(value=0)
¶
Reset the timestamp to a specified value (primarily for testing).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
The value to reset the timestamp to. Must be non-negative. |
0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the provided value is negative. |
Source code in accumulate\signing\timestamp.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |