Amazon Managed Blockchain Query

2023/07/26 - Amazon Managed Blockchain Query - 6 new api methods

Changes  Amazon Managed Blockchain (AMB) Query provides serverless access to standardized, multi-blockchain datasets with developer-friendly APIs.

ListTransactionEvents (new) Link ¶

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',
    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.

Note

Even if additional results can be retrieved, the request can return less results than maxResults or an empty array of results.

To retrieve the next set of results, make another request with the returned nextToken value. The value of nextToken is null when there are no more results to return

rtype

dict

returns

Response Syntax

{
    'events': [
        {
            'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET',
            '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 (new) Link ¶

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',
    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.

    Note

    This timestamp will only be recorded up to the second.

type toBlockchainInstant

dict

param toBlockchainInstant

The container for time.

  • time (datetime) --

    The container of the Timestamp of the blockchain instant.

    Note

    This timestamp will only be recorded up to the second.

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.

Note

Even if additional results can be retrieved, the request can return less results than maxResults or an empty array of results.

To retrieve the next set of results, make another request with the returned nextToken value. The value of nextToken is null when there are no more results to return

rtype

dict

returns

Response Syntax

{
    'transactions': [
        {
            'transactionHash': 'string',
            'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET',
            '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.

BatchGetTokenBalance (new) Link ¶

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

Note

Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.

See also: AWS API Documentation

Request Syntax

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

list

param getTokenBalanceInputs

An array of GetTokenBalanceInput 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.

      Note

      Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.

      • 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.

        Note

        This timestamp will only be recorded up to the second.

rtype

dict

returns

Response Syntax

{
    'tokenBalances': [
        {
            'ownerIdentifier': {
                'address': 'string'
            },
            'tokenIdentifier': {
                'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET',
                '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',
                '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.

          Note

          Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.

          • 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.

            Note

            This timestamp will only be recorded up to the second.

        • lastUpdatedTime (dict) --

          The container for time.

          • time (datetime) --

            The container of the Timestamp of the blockchain instant.

            Note

            This timestamp will only be recorded up to the second.

    • 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.

          Note

          Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.

          • 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.

            Note

            This timestamp will only be recorded up to the second.

        • errorCode (string) --

          The error code associated with the error.

        • errorMessage (string) --

          The message associated with the error.

        • errorType (string) --

          The type of error.

ListTokenBalances (new) Link ¶

This action returns the following for a given a blockchain network:

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

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

  • Lists all token balances for a given token.

Note

You must always specify the network property of the tokenFilter when using this operation.

See also: AWS API Documentation

Request Syntax

client.list_token_balances(
    ownerFilter={
        'address': 'string'
    },
    tokenFilter={
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET',
        '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.

Note

You must always specify the network property of this container when using this operation.

  • 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',
                '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.

          Note

          This time will only be recorded up to the second.

          • time (datetime) --

            The container of the Timestamp of the blockchain instant.

            Note

            This timestamp will only be recorded up to the second.

        • 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.

            Note

            This timestamp will only be recorded up to the second.

    • nextToken (string) --

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

GetTransaction (new) Link ¶

Get the details of a transaction.

See also: AWS API Documentation

Request Syntax

client.get_transaction(
    transactionHash='string',
    network='ETHEREUM_MAINNET'|'BITCOIN_MAINNET'
)
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',
        '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 occured.

      • 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.

GetTokenBalance (new) Link ¶

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

Note

Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.

See also: AWS API Documentation

Request Syntax

client.get_token_balance(
    tokenIdentifier={
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET',
        '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.

Note

This time will only be recorded up to the second.

  • time (datetime) --

    The container of the Timestamp of the blockchain instant.

    Note

    This timestamp will only be recorded up to the second.

rtype

dict

returns

Response Syntax

{
    'ownerIdentifier': {
        'address': 'string'
    },
    'tokenIdentifier': {
        'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET',
        '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.

      Note

      Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.

      • 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.

        Note

        This timestamp will only be recorded up to the second.

    • lastUpdatedTime (dict) --

      The container for time.

      • time (datetime) --

        The container of the Timestamp of the blockchain instant.

        Note

        This timestamp will only be recorded up to the second.