Amazon Managed Blockchain Query

2023/10/19 - Amazon Managed Blockchain Query - 8 updated api methods

Changes  This release adds support for Ethereum Sepolia network

BatchGetTokenBalance (updated) Link ¶
Changes (request, response)
Request
{'getTokenBalanceInputs': {'tokenIdentifier': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}}
Response
{'errors': {'tokenIdentifier': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}},
 'tokenBalances': {'tokenIdentifier': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}}

Gets the token balance for a batch of tokens by using the BatchGetTokenBalance action for every token in the request.

See also: AWS API Documentation

Request Syntax

client.batch_get_token_balance(
    getTokenBalanceInputs=[
        {
            'tokenIdentifier': {
                'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
                'contractAddress': 'string',
                'tokenId': 'string'
            },
            'ownerIdentifier': {
                'address': 'string'
            },
            'atBlockchainInstant': {
                'time': datetime(2015, 1, 1)
            }
        },
    ]
)
type getTokenBalanceInputs:

list

param getTokenBalanceInputs:

An array of BatchGetTokenBalanceInputItem objects whose balance is being requested.

  • (dict) --

    The container for the input for getting a token balance.

    • tokenIdentifier (dict) -- [REQUIRED]

      The container for the identifier for the token including the unique token ID and its blockchain network.

      • network (string) -- [REQUIRED]

        The blockchain network of the token.

      • contractAddress (string) --

        This is the token's contract address.

      • tokenId (string) --

        The unique identifier of the token.

    • ownerIdentifier (dict) -- [REQUIRED]

      The container for the identifier of the owner.

      • address (string) -- [REQUIRED]

        The contract or wallet address for the owner.

    • atBlockchainInstant (dict) --

      The container for time.

      • time (datetime) --

        The container of the Timestamp of the blockchain instant.

rtype:

dict

returns:

Response Syntax

{
    'tokenBalances': [
        {
            'ownerIdentifier': {
                'address': 'string'
            },
            'tokenIdentifier': {
                'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
                'contractAddress': 'string',
                'tokenId': 'string'
            },
            'balance': 'string',
            'atBlockchainInstant': {
                'time': datetime(2015, 1, 1)
            },
            'lastUpdatedTime': {
                'time': datetime(2015, 1, 1)
            }
        },
    ],
    'errors': [
        {
            'tokenIdentifier': {
                'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
                'contractAddress': 'string',
                'tokenId': 'string'
            },
            'ownerIdentifier': {
                'address': 'string'
            },
            'atBlockchainInstant': {
                'time': datetime(2015, 1, 1)
            },
            'errorCode': 'string',
            'errorMessage': 'string',
            'errorType': 'VALIDATION_EXCEPTION'|'RESOURCE_NOT_FOUND_EXCEPTION'
        },
    ]
}

Response Structure

  • (dict) --

    • tokenBalances (list) --

      An array of BatchGetTokenBalanceOutputItem objects returned by the response.

      • (dict) --

        The container for the properties of a token balance output.

        • ownerIdentifier (dict) --

          The container for the identifier of the owner.

          • address (string) --

            The contract or wallet address for the owner.

        • tokenIdentifier (dict) --

          The container for the identifier for the token including the unique token ID and its blockchain network.

          • network (string) --

            The blockchain network of the token.

          • contractAddress (string) --

            This is the token's contract address.

          • tokenId (string) --

            The unique identifier of the token.

        • balance (string) --

          The container for the token balance.

        • atBlockchainInstant (dict) --

          The container for time.

          • time (datetime) --

            The container of the Timestamp of the blockchain instant.

        • lastUpdatedTime (dict) --

          The container for time.

          • time (datetime) --

            The container of the Timestamp of the blockchain instant.

    • errors (list) --

      An array of BatchGetTokenBalanceErrorItem objects returned from the request.

      • (dict) --

        Error generated from a failed BatchGetTokenBalance request.

        • tokenIdentifier (dict) --

          The container for the identifier for the token including the unique token ID and its blockchain network.

          • network (string) --

            The blockchain network of the token.

          • contractAddress (string) --

            This is the token's contract address.

          • tokenId (string) --

            The unique identifier of the token.

        • ownerIdentifier (dict) --

          The container for the identifier of the owner.

          • address (string) --

            The contract or wallet address for the owner.

        • atBlockchainInstant (dict) --

          The container for time.

          • time (datetime) --

            The container of the Timestamp of the blockchain instant.

        • errorCode (string) --

          The error code associated with the error.

        • errorMessage (string) --

          The message associated with the error.

        • errorType (string) --

          The type of error.

GetAssetContract (updated) Link ¶
Changes (both)
{'contractIdentifier': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}

Gets the information about a specific contract deployed on the blockchain.

See also: AWS API Documentation

Request Syntax

client.get_asset_contract(
    contractIdentifier={
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
        'contractAddress': 'string'
    }
)
type contractIdentifier:

dict

param contractIdentifier:

[REQUIRED]

Contains the blockchain address and network information about the contract.

  • network (string) -- [REQUIRED]

    The blockchain network of the contract.

  • contractAddress (string) -- [REQUIRED]

    Container for the blockchain address about a contract.

rtype:

dict

returns:

Response Syntax

{
    'contractIdentifier': {
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
        'contractAddress': 'string'
    },
    'tokenStandard': 'ERC20'|'ERC721'|'ERC1155',
    'deployerAddress': 'string',
    'metadata': {
        'name': 'string',
        'symbol': 'string',
        'decimals': 123
    }
}

Response Structure

  • (dict) --

    • contractIdentifier (dict) --

      Contains the blockchain address and network information about the contract.

      • network (string) --

        The blockchain network of the contract.

      • contractAddress (string) --

        Container for the blockchain address about a contract.

    • tokenStandard (string) --

      The token standard of the contract requested.

    • deployerAddress (string) --

      The address of the deployer of contract.

    • metadata (dict) --

      The metadata of the contract.

      • name (string) --

        The name of the token contract.

      • symbol (string) --

        The symbol of the token contract.

      • decimals (integer) --

        The decimals used by the token contract.

GetTokenBalance (updated) Link ¶
Changes (both)
{'tokenIdentifier': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}

Gets the balance of a specific token, including native tokens, for a given address (wallet or contract) on the blockchain.

See also: AWS API Documentation

Request Syntax

client.get_token_balance(
    tokenIdentifier={
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
        'contractAddress': 'string',
        'tokenId': 'string'
    },
    ownerIdentifier={
        'address': 'string'
    },
    atBlockchainInstant={
        'time': datetime(2015, 1, 1)
    }
)
type tokenIdentifier:

dict

param tokenIdentifier:

[REQUIRED]

The container for the identifier for the token, including the unique token ID and its blockchain network.

  • network (string) -- [REQUIRED]

    The blockchain network of the token.

  • contractAddress (string) --

    This is the token's contract address.

  • tokenId (string) --

    The unique identifier of the token.

type ownerIdentifier:

dict

param ownerIdentifier:

[REQUIRED]

The container for the identifier for the owner.

  • address (string) -- [REQUIRED]

    The contract or wallet address for the owner.

type atBlockchainInstant:

dict

param atBlockchainInstant:

The time for when the TokenBalance is requested or the current time if a time is not provided in the request.

  • time (datetime) --

    The container of the Timestamp of the blockchain instant.

rtype:

dict

returns:

Response Syntax

{
    'ownerIdentifier': {
        'address': 'string'
    },
    'tokenIdentifier': {
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
        'contractAddress': 'string',
        'tokenId': 'string'
    },
    'balance': 'string',
    'atBlockchainInstant': {
        'time': datetime(2015, 1, 1)
    },
    'lastUpdatedTime': {
        'time': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • ownerIdentifier (dict) --

      The container for the identifier of the owner.

      • address (string) --

        The contract or wallet address for the owner.

    • tokenIdentifier (dict) --

      The container for the identifier for the token including the unique token ID and its blockchain network.

      • network (string) --

        The blockchain network of the token.

      • contractAddress (string) --

        This is the token's contract address.

      • tokenId (string) --

        The unique identifier of the token.

    • balance (string) --

      The container for the token balance.

    • atBlockchainInstant (dict) --

      The container for time.

      • time (datetime) --

        The container of the Timestamp of the blockchain instant.

    • lastUpdatedTime (dict) --

      The container for time.

      • time (datetime) --

        The container of the Timestamp of the blockchain instant.

GetTransaction (updated) Link ¶
Changes (request, response)
Request
{'network': {'ETHEREUM_SEPOLIA_TESTNET'}}
Response
{'transaction': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}

Get the details of a transaction.

See also: AWS API Documentation

Request Syntax

client.get_transaction(
    transactionHash='string',
    network='ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET'
)
type transactionHash:

string

param transactionHash:

[REQUIRED]

The hash of the transaction. It is generated whenever a transaction is verified and added to the blockchain.

type network:

string

param network:

[REQUIRED]

The blockchain network where the transaction occurred.

rtype:

dict

returns:

Response Syntax

{
    'transaction': {
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
        'blockHash': 'string',
        'transactionHash': 'string',
        'blockNumber': 'string',
        'transactionTimestamp': datetime(2015, 1, 1),
        'transactionIndex': 123,
        'numberOfTransactions': 123,
        'status': 'FINAL'|'FAILED',
        'to': 'string',
        'from': 'string',
        'contractAddress': 'string',
        'gasUsed': 'string',
        'cumulativeGasUsed': 'string',
        'effectiveGasPrice': 'string',
        'signatureV': 123,
        'signatureR': 'string',
        'signatureS': 'string',
        'transactionFee': 'string',
        'transactionId': 'string'
    }
}

Response Structure

  • (dict) --

    • transaction (dict) --

      Contains the details of the transaction.

      • network (string) --

        The blockchain network where the transaction occurred.

      • blockHash (string) --

        The block hash is a unique identifier for a block. It is a fixed-size string that is calculated by using the information in the block. The block hash is used to verify the integrity of the data in the block.

      • transactionHash (string) --

        The hash of the transaction. It is generated whenever a transaction is verified and added to the blockchain.

      • blockNumber (string) --

        The block number in which the transaction is recorded.

      • transactionTimestamp (datetime) --

        The Timestamp of the transaction.

      • transactionIndex (integer) --

        The index of the transaction within a blockchain.

      • numberOfTransactions (integer) --

        The number of transactions in the block.

      • status (string) --

        The status of the transaction.

      • to (string) --

        The identifier of the transaction. It is generated whenever a transaction is verified and added to the blockchain.

      • from (string) --

        The initiator of the transaction. It is either in the form a public key or a contract address.

      • contractAddress (string) --

        The blockchain address for the contract.

      • gasUsed (string) --

        The amount of gas used for the transaction.

      • cumulativeGasUsed (string) --

        The amount of gas used up to the specified point in the block.

      • effectiveGasPrice (string) --

        The effective gas price.

      • signatureV (integer) --

        The signature of the transaction. The Z coordinate of a point V.

      • signatureR (string) --

        The signature of the transaction. The X coordinate of a point R.

      • signatureS (string) --

        The signature of the transaction. The Y coordinate of a point S.

      • transactionFee (string) --

        The transaction fee.

      • transactionId (string) --

        The unique identifier of the transaction. It is generated whenever a transaction is verified and added to the blockchain.

ListAssetContracts (updated) Link ¶
Changes (request, response)
Request
{'contractFilter': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}
Response
{'contracts': {'contractIdentifier': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}}

Lists all the contracts for a given contract type deployed by an address (either a contract address or a wallet address).

The Bitcoin blockchain networks do not support this operation.

See also: AWS API Documentation

Request Syntax

client.list_asset_contracts(
    contractFilter={
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
        'tokenStandard': 'ERC20'|'ERC721'|'ERC1155',
        'deployerAddress': 'string'
    },
    nextToken='string',
    maxResults=123
)
type contractFilter:

dict

param contractFilter:

[REQUIRED]

Contains the filter parameter for the request.

  • network (string) -- [REQUIRED]

    The blockchain network of the contract.

  • tokenStandard (string) -- [REQUIRED]

    The container for the token standard.

  • deployerAddress (string) -- [REQUIRED]

    The network address of the deployer.

type nextToken:

string

param nextToken:

The pagination token that indicates the next set of results to retrieve.

type maxResults:

integer

param maxResults:

The maximum number of contracts to list.

rtype:

dict

returns:

Response Syntax

{
    'contracts': [
        {
            'contractIdentifier': {
                'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
                'contractAddress': 'string'
            },
            'tokenStandard': 'ERC20'|'ERC721'|'ERC1155',
            'deployerAddress': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • contracts (list) --

      An array of contract objects that contain the properties for each contract.

      • (dict) --

        This container contains information about an contract.

        • contractIdentifier (dict) --

          The container for the contract identifier containing its blockchain network and address.

          • network (string) --

            The blockchain network of the contract.

          • contractAddress (string) --

            Container for the blockchain address about a contract.

        • tokenStandard (string) --

          The token standard of the contract.

        • deployerAddress (string) --

          The address of the contract deployer.

    • nextToken (string) --

      The pagination token that indicates the next set of results to retrieve.

ListTokenBalances (updated) Link ¶
Changes (request, response)
Request
{'tokenFilter': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}
Response
{'tokenBalances': {'tokenIdentifier': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}}

This action returns the following for a given blockchain network:

  • Lists all token balances owned by an address (either a contract address or a wallet address).

  • Lists all token balances for all tokens created by a contract.

  • Lists all token balances for a given token.

See also: AWS API Documentation

Request Syntax

client.list_token_balances(
    ownerFilter={
        'address': 'string'
    },
    tokenFilter={
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
        'contractAddress': 'string',
        'tokenId': 'string'
    },
    nextToken='string',
    maxResults=123
)
type ownerFilter:

dict

param ownerFilter:

The contract or wallet address on the blockchain network by which to filter the request. You must specify the address property of the ownerFilter when listing balances of tokens owned by the address.

  • address (string) -- [REQUIRED]

    The contract or wallet address.

type tokenFilter:

dict

param tokenFilter:

[REQUIRED]

The contract address or a token identifier on the blockchain network by which to filter the request. You must specify the contractAddress property of this container when listing tokens minted by a contract.

  • network (string) -- [REQUIRED]

    The blockchain network of the token.

  • contractAddress (string) --

    This is the address of the contract.

  • tokenId (string) --

    The unique identifier of the token.

type nextToken:

string

param nextToken:

The pagination token that indicates the next set of results to retrieve.

type maxResults:

integer

param maxResults:

The maximum number of token balances to return.

rtype:

dict

returns:

Response Syntax

{
    'tokenBalances': [
        {
            'ownerIdentifier': {
                'address': 'string'
            },
            'tokenIdentifier': {
                'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
                'contractAddress': 'string',
                'tokenId': 'string'
            },
            'balance': 'string',
            'atBlockchainInstant': {
                'time': datetime(2015, 1, 1)
            },
            'lastUpdatedTime': {
                'time': datetime(2015, 1, 1)
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • tokenBalances (list) --

      An array of TokenBalance objects. Each object contains details about the token balance.

      • (dict) --

        The balance of the token.

        • ownerIdentifier (dict) --

          The container for the identifier of the owner.

          • address (string) --

            The contract or wallet address for the owner.

        • tokenIdentifier (dict) --

          The identifier for the token, including the unique token ID and its blockchain network.

          • network (string) --

            The blockchain network of the token.

          • contractAddress (string) --

            This is the token's contract address.

          • tokenId (string) --

            The unique identifier of the token.

        • balance (string) --

          The container of the token balance.

        • atBlockchainInstant (dict) --

          The time for when the TokenBalance is requested or the current time if a time is not provided in the request.

          • time (datetime) --

            The container of the Timestamp of the blockchain instant.

        • lastUpdatedTime (dict) --

          The Timestamp of the last transaction at which the balance for the token in the wallet was updated.

          • time (datetime) --

            The container of the Timestamp of the blockchain instant.

    • nextToken (string) --

      The pagination token that indicates the next set of results to retrieve.

ListTransactionEvents (updated) Link ¶
Changes (request, response)
Request
{'network': {'ETHEREUM_SEPOLIA_TESTNET'}}
Response
{'events': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}

An array of TransactionEvent objects. Each object contains details about the transaction event.

See also: AWS API Documentation

Request Syntax

client.list_transaction_events(
    transactionHash='string',
    network='ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
    nextToken='string',
    maxResults=123
)
type transactionHash:

string

param transactionHash:

[REQUIRED]

The hash of the transaction. It is generated whenever a transaction is verified and added to the blockchain.

type network:

string

param network:

[REQUIRED]

The blockchain network where the transaction events occurred.

type nextToken:

string

param nextToken:

The pagination token that indicates the next set of results to retrieve.

type maxResults:

integer

param maxResults:

The maximum number of transaction events to list.

rtype:

dict

returns:

Response Syntax

{
    'events': [
        {
            'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
            'transactionHash': 'string',
            'eventType': 'ERC20_TRANSFER'|'ERC20_MINT'|'ERC20_BURN'|'ERC20_DEPOSIT'|'ERC20_WITHDRAWAL'|'ERC721_TRANSFER'|'ERC1155_TRANSFER'|'BITCOIN_VIN'|'BITCOIN_VOUT'|'INTERNAL_ETH_TRANSFER'|'ETH_TRANSFER',
            'from': 'string',
            'to': 'string',
            'value': 'string',
            'contractAddress': 'string',
            'tokenId': 'string',
            'transactionId': 'string',
            'voutIndex': 123
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • events (list) --

      An array of TransactionEvent objects. Each object contains details about the transaction events.

      • (dict) --

        The container for the properties of a transaction event.

        • network (string) --

          The blockchain network where the transaction occurred.

        • transactionHash (string) --

          The hash of the transaction. It is generated whenever a transaction is verified and added to the blockchain.

        • eventType (string) --

          The type of transaction event.

        • from (string) --

          The wallet address initiating the transaction. It can either be a public key or a contract.

        • to (string) --

          The wallet address receiving the transaction. It can either be a public key or a contract.

        • value (string) --

          The value that was transacted.

        • contractAddress (string) --

          The blockchain address. for the contract

        • tokenId (string) --

          The unique identifier for the token involved in the transaction.

        • transactionId (string) --

          The unique identifier of the transaction. It is generated whenever a transaction is verified and added to the blockchain.

        • voutIndex (integer) --

          The position of the vout in the transaction output list.

    • nextToken (string) --

      The pagination token that indicates the next set of results to retrieve.

ListTransactions (updated) Link ¶
Changes (request, response)
Request
{'network': {'ETHEREUM_SEPOLIA_TESTNET'}}
Response
{'transactions': {'network': {'ETHEREUM_SEPOLIA_TESTNET'}}}

Lists all of the transactions on a given wallet address or to a specific contract.

See also: AWS API Documentation

Request Syntax

client.list_transactions(
    address='string',
    network='ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
    fromBlockchainInstant={
        'time': datetime(2015, 1, 1)
    },
    toBlockchainInstant={
        'time': datetime(2015, 1, 1)
    },
    sort={
        'sortBy': 'TRANSACTION_TIMESTAMP',
        'sortOrder': 'ASCENDING'|'DESCENDING'
    },
    nextToken='string',
    maxResults=123
)
type address:

string

param address:

[REQUIRED]

The address (either a contract or wallet), whose transactions are being requested.

type network:

string

param network:

[REQUIRED]

The blockchain network where the transactions occurred.

type fromBlockchainInstant:

dict

param fromBlockchainInstant:

The container for time.

  • time (datetime) --

    The container of the Timestamp of the blockchain instant.

type toBlockchainInstant:

dict

param toBlockchainInstant:

The container for time.

  • time (datetime) --

    The container of the Timestamp of the blockchain instant.

type sort:

dict

param sort:

Sorts items in an ascending order if the first page starts at fromTime. Sorts items in a descending order if the first page starts at toTime.

  • sortBy (string) --

    Defaults to the value TRANSACTION_TIMESTAMP.

  • sortOrder (string) --

    The container for the sort order for ListTransactions. The SortOrder field only accepts the values ASCENDING and DESCENDING. Not providing SortOrder will default to ASCENDING.

type nextToken:

string

param nextToken:

The pagination token that indicates the next set of results to retrieve.

type maxResults:

integer

param maxResults:

The maximum number of transactions to list.

rtype:

dict

returns:

Response Syntax

{
    'transactions': [
        {
            'transactionHash': 'string',
            'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET'|'ETHEREUM_SEPOLIA_TESTNET',
            'transactionTimestamp': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • transactions (list) --

      The array of transactions returned by the request.

      • (dict) --

        The container of the transaction output.

        • transactionHash (string) --

          The hash of the transaction. It is generated whenever a transaction is verified and added to the blockchain.

        • network (string) --

          The blockchain network where the transaction occurred.

        • transactionTimestamp (datetime) --

          The time when the transaction occurred.

    • nextToken (string) --

      The pagination token that indicates the next set of results to retrieve.