๐Ÿช™
Web3API.native
You can get the content of any block in past, or address events based on block number.

runContractFunction

Runs a given function of a contract ABI and returns read-only data (asynchronous).

Options:

  • chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
  • function_name (required): The function name
  • address (required): A smart contract address
  • abi (required): contract or function ABI(should be provided as an array)
  • params (optional): Parameters needed for your specific function
JS
React
curl
Unity
1
const ABI = []; // Add ABI of 0xdAC17F958D2ee523a2206206994597C13D831ec7
2
โ€‹
3
const options = {
4
chain: "eth",
5
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
6
function_name: "balanceOf",
7
abi: ABI,
8
params: { who: "0x3355d6E71585d4e619f4dB4C7c5Bfe549b278299" },
9
};
10
const allowance = await Moralis.Web3API.native.runContractFunction(options);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const GetAddressBalanceOfUSDT = () => {
5
// 0xdAC17F958D2ee523a2206206994597C13D831ec7 = contract address of USDT
6
const { native } = useMoralisWeb3Api();
7
โ€‹
8
const ABI = []; // Add ABI of 0xdAC17F958D2ee523a2206206994597C13D831ec7
9
โ€‹
10
const options = {
11
chain: "eth",
12
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
13
function_name: "balanceOf",
14
abi: ABI,
15
params: { who: "0x3355d6E71585d4e619f4dB4C7c5Bfe549b278299" },
16
};
17
โ€‹
18
const { fetch, data, error, isLoading } = useMoralisWeb3ApiCall(
19
native.runContractFunction,
20
{ ...options }
21
);
22
โ€‹
23
return (
24
// Use your custom error component to show errors
25
<div style={{ height: "100vh", overflow: "auto" }}>
26
<div>
27
{error && <ErrorMessage error={error} />}
28
<button
29
onClick={() => {
30
fetch({ params: options });
31
}}
32
>
33
Fetch data
34
</button>
35
{data && <pre>{JSON.stringify(data)}</pre>}
36
</div>
37
</div>
38
);
39
};
Copied!
1
curl -X 'POST' \
2
'https://deep-index.moralis.io/api/v2/0xdAC17F958D2ee523a2206206994597C13D831ec7/function?chain=eth&function_name=balanceOf' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY' \
5
-H 'Content-Type: application/json' \
6
-d '{
7
"abi": MY-CONTRACT-ABI ,
8
"params": {"who": "0x3355d6E71585d4e619f4dB4C7c5Bfe549b278299" }
9
}'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
public async void ReadFunction()
8
{
9
// Function ABI input parameters
10
object[] inputParams = new object[1];
11
inputParams[0] = new { internalType = "address", name = "account", type = "address" };
12
// Function ABI Output parameters
13
object[] outputParams = new object[1];
14
outputParams[0] = new { internalType = "uint256", name = "", type = "uint256" };
15
// Function ABI
16
object[] abi = new object[1];
17
abi[0] = new { inputs = inputParams, name = "balanceOf", outputs = outputParams, stateMutability = "view", type = "function" };
18
// Define request object
19
RunContractDto rcd = new RunContractDto()
20
{
21
Abi = abi,
22
Params = new { account = "0x3355d6E71585d4e619f4dB4C7c5Bfe549b278299" }
23
};
24
string resp = await Moralis.Web3Api.Native.RunContractFunction("0xdAC17F958D2ee523a2206206994597C13D831ec7", "balanceOf", rcd, ChainList.eth);
25
Debug.Log(resp);
26
}
27
}
Copied!

Example result:

1
{"result":"5691150038"}
Copied!

getBlock

Retrieve the contents of a block by block hash. Returns a block object (asynchronous).

Options:

  • chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
  • block_number_or_hash (required): The block hash or block number.
JS
React
curl
Unity
1
const options = { chain: "bsc", block_number_or_hash: "2" };
2
โ€‹
3
// get block content on BSC
4
const transactions = await Moralis.Web3API.native.getBlock(options);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const Web3Api = useMoralisWeb3Api();
5
// get block content on BSC
6
const fetchBlock = async () => {
7
const options = { chain: "bsc", block_number_or_hash: "2" };
8
const result = await Web3Api.native.getBlock(options);
9
console.log(result);
10
};
Copied!
1
curl -X 'GET' \
2
'https://deep-index.moralis.io/api/v2/block/2?chain=bsc' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
public async void fetchBlock()
8
{
9
Block block = await Moralis.Web3Api.Native.GetBlock(blockNumberOrHash: "2", ChainList.bsc);
10
Debug.Log(block.ToJson());
11
}
12
}
Copied!

Example result:

1
{
2
"timestamp": "2021-05-07T11:08:35.000Z",
3
"number": "12386788",
4
"hash": "0x9b559aef7ea858608c2e554246fe4a24287e7aeeb976848df2b9a2531f4b9171",
5
"parent_hash": "0x011d1fc45839de975cc55d758943f9f1d204f80a90eb631f3bf064b80d53e045",
6
"nonce": "0xedeb2d8fd2b2bdec",
7
"sha3_uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
8
"logs_bloom": "0xdde5fc46c5d8bcbd58207bc9f267bf43298e23791a326ff02661e99790da9996b3e0dd912c0b8202d389d282c56e4d11eb2dec4898a32b6b165f1f4cae6aa0079498eab50293f3b8defbf6af11bb75f0408a563ddfc26a3323d1ff5f9849e95d5f034d88a757ddea032c75c00708c9ff34d2207f997cc7d93fd1fa160a6bfaf62a54e31f9fe67ab95752106ba9d185bfdc9b6dc3e17427f844ee74e5c09b17b83ad6e8fc7360f5c7c3e4e1939e77a6374bee57d1fa6b2322b11ad56ad0398302de9b26d6fbfe414aa416bff141fad9d4af6aea19322e47595e342cd377403f417dfd396ab5f151095a5535f51cbc34a40ce9648927b7d1d72ab9daf253e31daf",
9
"transactions_root": "0xe4c7bf3aff7ad07f9e80d57f7189f0252592fee6321c2a9bd9b09b6ce0690d27",
10
"state_root": "0x49e3bfe7b618e27fde8fa08884803a8458b502c6534af69873a3cc926a7c724b",
11
"receipts_root": "0x7cf43d7e837284f036cf92c56973f5e27bdd253ca46168fa195a6b07fa719f23",
12
"miner": "0xea674fdde714fd979de3edf0f56aa9716b898ec8",
13
"difficulty": "7253857437305950",
14
"total_difficulty": "24325637817906576196890",
15
"size": "61271",
16
"extra_data": "0x65746865726d696e652d6575726f70652d7765737433",
17
"gas_limit": "14977947",
18
"gas_used": "14964688",
19
"transaction_count": "252",
20
"transactions": [
21
{
22
"hash": "0x1ed85b3757a6d31d01a4d6677fc52fd3911d649a0af21fe5ca3f886b153773ed",
23
"nonce": "1848059",
24
"transaction_index": "108",
25
"from_address": "0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0",
26
"to_address": "0x003dde3494f30d861d063232c6a8c04394b686ff",
27
"value": "115580000000000000",
28
"gas": "30000",
29
"gas_price": "52500000000",
30
"input": "0x",
31
"receipt_cumulative_gas_used": "4923073",
32
"receipt_gas_used": "21000",
33
"receipt_contract_address": null,
34
"receipt_root": null,
35
"receipt_status": "1",
36
"block_timestamp": "2021-05-07T11:08:35.000Z",
37
"block_number": "12386788",
38
"block_hash": "0x9b559aef7ea858608c2e554246fe4a24287e7aeeb976848df2b9a2531f4b9171",
39
"logs": [
40
{
41
"log_index": "273",
42
"transaction_hash": "0xdd9006489e46670e0e85d1fb88823099e7f596b08aeaac023e9da0851f26fdd5",
43
"transaction_index": "204",
44
"address": "0x3105d328c66d8d55092358cf595d54608178e9b5",
45
"data": "0x00000000000000000000000000000000000000000000000de05239bccd4d537400000000000000000000000000024dbc80a9f80e3d5fc0a0ee30e2693781a443",
46
"topic0": "0x2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a",
47
"topic1": "0x000000000000000000000000031002d15b0d0cd7c9129d6f644446368deae391",
48
"topic2": "0x000000000000000000000000d25943be09f968ba740e0782a34e710100defae9",
49
"topic3": null,
50
"block_timestamp": "2021-05-07T11:08:35.000Z",
51
"block_number": "12386788",
52
"block_hash": "0x9b559aef7ea858608c2e554246fe4a24287e7aeeb976848df2b9a2531f4b9171"
53
}
54
]
55
}
56
]
57
}
Copied!

getDateToBlock

Retrieve the closest block of the provided date (asynchronous).

Options:

  • chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
  • date (required): Unix date in miliseconds or a datestring (any format that is accepted by momentjs)
JS
React
curl
Unity
1
const options = {
2
chain: "bsc",
3
date: "2021-09-29T13:09:15+00:00",
4
};
5
const date = await Moralis.Web3API.native.getDateToBlock(options);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const Web3Api = useMoralisWeb3Api();
5
โ€‹
6
const fetchDateToBlock = async () => {
7
const options = { chain: "bsc", date: "2021-09-29T13:09:15+00:00" };
8
const date = await Web3Api.native.getDateToBlock(options);
9
console.log(date);
10
};
Copied!
1
curl -X 'GET' \
2
'https://deep-index.moralis.io/api/v2/dateToBlock?chain=bsc&date=2021-09-29T13%3A09%3A15%2B00%3A00' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
public async void fetchDateToBlock()
8
{
9
BlockDate blockDate = await Moralis.Web3Api.Native.GetDateToBlock(date: "2021-09-29T13:09:15+00:00", ChainList.eth);
10
Debug.Log(blockDate.ToJson());
11
}
12
}
Copied!

Example result:

1
{
2
"date": "2020-01-01T00:00:00+00:00",
3
"block": 9193266,
4
"timestamp": 1577836811
5
}
Copied!

๐Ÿ”ฅ getLogsByAddress (new)

Retrieve the logs from an address (asynchronous).

Options:

  • chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
  • from_date (optional): The date from where to get the transactions (any format that is accepted by momentjs). Provide the param 'from_block' or 'from_date' If 'from_date' and 'from_block' are provided, 'from_block' will be used.
  • to_date (optional): Get the transactions to this date (any format that is accepted by momentjs). Provide the param 'to_block' or 'to_date' If 'to_date' and 'to_block' are provided, 'to_block' will be used.
  • from_block (optional): The minimum block number from where to get the transactions Provide the param 'from_block' or 'from_date' If 'from_date' and 'from_block' are provided, 'from_block' will be used.
  • to_block (optional): The maximum block number from where to get the transactions. Provide the param 'to_block' or 'to_date' If 'to_date' and 'to_block' are provided, 'to_block' will be used.
  • address (required): A smart contract address
  • topic0 (optional): Event topic
  • topic1 (optional): Event topic
  • topic2 (optional): Event topic
  • topic3 (optional): Event topic
JS
React
curl
Unity
1
const options = {
2
address: "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
3
chain: "bsc",
4
topic0: "0x2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a",
5
topic1: "0x000000000000000000000000031002d15b0d0cd7c9129d6f644446368deae391",
6
topic2: "0x000000000000000000000000d25943be09f968ba740e0782a34e710100defae9",
7
};
8
โ€‹
9
const logs = await Moralis.Web3API.native.getLogsByAddress(options);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const Web3Api = useMoralisWeb3Api();
5
โ€‹
6
const fetchLogsByAddress = async () => {
7
const options = {
8
address: "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
9
chain: "bsc",
10
topic0:
11
"0x2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a",
12
topic1:
13
"0x000000000000000000000000031002d15b0d0cd7c9129d6f644446368deae391",
14
topic2:
15
"0x000000000000000000000000d25943be09f968ba740e0782a34e710100defae9",
16
};
17
const logs = await Web3Api.native.getLogsByAddress(options);
18
console.log(logs);
19
};
Copied!
1
curl -X 'GET' \
2
'https://deep-index.moralis.io/api/v2/0x057Ec652A4F150f7FF94f089A38008f49a0DF88e/logs?chain=bsc&topic0=0x2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a&topic1=0x000000000000000000000000031002d15b0d0cd7c9129d6f644446368deae391&topic2=0x000000000000000000000000d25943be09f968ba740e0782a34e710100defae9' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
public async void fetchLogsByAddress()
8
{
9
LogEventByAddress logEvents = await Moralis.Web3Api.Native.GetLogsByAddress(address: "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e", ChainList.bsc, topic0: "0x2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a", topic1: "0x000000000000000000000000031002d15b0d0cd7c9129d6f644446368deae391", topic2: "0x000000000000000000000000d25943be09f968ba740e0782a34e710100defae9");
10
Debug.Log(logEvents.ToJson());
11
}
12
}
Copied!

Example result:

1
{
2
"transaction_hash": "0x2d30ca6f024dbc1307ac8a1a44ca27de6f797ec22ef20627a1307243b0ab7d09",
3
"address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
4
"block_timestamp": "2021-04-02T10:07:54.000Z",
5
"block_number": "12526958",
6
"block_hash": "0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86",
7
"data": "0x00000000000000000000000000000000000000000000000de05239bccd4d537400000000000000000000000000024dbc80a9f80e3d5fc0a0ee30e2693781a443",
8
"topic0": "0x2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a",
9
"topic1": "0x000000000000000000000000031002d15b0d0cd7c9129d6f644446368deae391",
10
"topic2": "0x000000000000000000000000d25943be09f968ba740e0782a34e710100defae9",
11
"topic3": null
12
}
Copied!

getContractEvents

Get the events in descending order based on block number. Returns an object with the number of Contract events and the array of Contract events (asynchronous).

Options:

  • chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
  • offset(optional): Offset.
  • limit(optional): Limit.
  • from_block (optional): To get contract events starting from this block
  • to_block (optional): To get contract events up to this block
  • topic (required): The topic of the event
  • address (required): A smart contract address
  • abi (required): Event ABI (do not insert the ABI of the whole smart contract). ABI has a JSON format.
JS
React
curl
Unity
1
const ABI = {
2
anonymous: false,
3
inputs: [
4
{ indexed: true, name: "from", type: "address" },
5
{ indexed: true, name: "to", type: "address" },
6
{ indexed: false, name: "value", type: "uint256" },
7
],
8
name: "Transfer",
9
type: "event",
10
};
11
โ€‹
12
const options = {
13
chain: "eth",
14
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
15
topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
16
limit: "3",
17
abi: ABI,
18
};
19
const events = await Moralis.Web3API.native.getContractEvents(options);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const Web3Api = useMoralisWeb3Api();
5
โ€‹
6
const ABI = {
7
anonymous: false,
8
inputs: [
9
{ indexed: true, name: "from", type: "address" },
10
{ indexed: true, name: "to", type: "address" },
11
{ indexed: false, name: "value", type: "uint256" },
12
],
13
name: "Transfer",
14
type: "event",
15
};
16
โ€‹
17
const fetchContractEvents = async () => {
18
const options = {
19
chain: "eth",
20
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
21
topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
22
limit: "3",
23
abi: ABI,
24
};
25
const events = await Web3Api.native.getContractEvents(options);
26
console.log(events);
27
};
Copied!
1
curl -X 'POST' \
2
'https://deep-index.moralis.io/api/v2/0xdAC17F958D2ee523a2206206994597C13D831ec7/events?chain=eth&topic=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&limit=3' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY' \
5
-H 'Content-Type: application/json' \
6
-d '{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using System.Collections.Generic;
4
using UnityEngine;
5
โ€‹
6
public class Example
7
{
8
public async void fetchContractEvents()
9
{
10
string abi = "{anonymous: false, inputs:[{ indexed: true, name: \"from\", type: \"address\" },{ indexed: true, name: \"to\", type: \"address\" },{ indexed: false, name: \"value\", type: \"uint256\" },],name: \"Transfer\", type: \"event\" }";
11
List<LogEvent> logEvents = await Moralis.Web3Api.Native.GetContractEvents(address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", abi: abi, ChainList.eth);
12
foreach (LogEvent eventlog in logEvents)
13
{
14
Debug.Log(eventlog.ToJson());
15
}
16
}
17
}
Copied!
Example result:

getNFTTransfersByBlock

Retrieve NFT transfers by block number or block hash. Returns an array of NFT transfers (asynchronous).

Options:

  • chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
  • block_number_or_hash (required): The block hash or block number.
JS
React
curl
Unity
1
const options = { chain: "bsc", block_number_or_hash: "11284830" };
2
โ€‹
3
// get NFT transfers by block number or block hash
4
const NFTTransfers = await Moralis.Web3API.native.getNFTTransfersByBlock(
5
options
6
);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const Web3Api = useMoralisWeb3Api();
5
โ€‹
6
const fetchNFTTransfersByBlock = async () => {
7
// get NFT transfers by block number or block hash
8
const options = { chain: "bsc", block_number_or_hash: "11284830" };
9
โ€‹
10
const NFTTransfers = await Web3Api.native.getNFTTransfersByBlock(options);
11
console.log(NFTTransfers);
12
};
Copied!
1
curl -X 'GET' \
2
'https://deep-index.moralis.io/api/v2/block/11284830/nft/transfers?chain=bsc&limit=500' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
public async void fetchNFTTransfersByBlock()
8
{
9
NftTransferCollection nftTransfers = await Moralis.Web3Api.Native.GetNFTTransfersByBlock(blockNumberOrHash: "11284830", ChainList.bsc);
10
Debug.Log(nftTransfers.ToJson());
11
}
12
}
Copied!

Example result:

1
[
2
{
3
amount: "1",
4
block_hash:
5
"0x4c00bcee8900e5fc4f6a5d11dff6edca3b97470da290986940da1d2f0ef221fb",
6
block_number: "11284830",
7
block_timestamp: "2021-09-27T17:07:54.000Z",
8
contract_type: "ERC721",
9
from_address: "0x6102f780a5c51dee8ce46c5db5b62d88119d559d",
10
log_index: 130,
11
to_address: "0xd95f7419ce0debf3a991ef9944808010928db319",
12
token_address: "0xcf58705e2ff8642c4276c2dd2747ec8af5bafc1d",
13
token_id: "281",
14
transaction_hash:
15
"0x19721cf6855f412f82de87f8c6050e6de3cc77a81388002bc24efea53bd36a0f",
16
transaction_index: 35,
17
transaction_type: "Single",
18
},
19
];
Copied!

๐Ÿ”ฅ getTransaction (new)

Get the transaction by transaction hash. Returns a transaction object (asynchronous).

Options:

  • chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
  • transaction_hash (required): The transaction hash.
JS
React
curl
Unity
1
const options = {
2
chain: "eth",
3
transaction_hash:
4
"0x5e519cd5117aea6ed9d51d4f235b4badb2e3f69377a4e2f945e13feb20af4db3",
5
};
6
const transaction = await Moralis.Web3API.native.getTransaction(options);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const Web3Api = useMoralisWeb3Api();
5
โ€‹
6
const fetchTransaction = async () => {
7
const options = {
8
chain: "eth",
9
transaction_hash:
10
"0x5e519cd5117aea6ed9d51d4f235b4badb2e3f69377a4e2f945e13feb20af4db3",
11
};
12
const transaction = await Web3Api.native.getTransaction(options);
13
console.log(transaction);
14
};
Copied!
1
curl -X 'GET' \
2
'https://deep-index.moralis.io/api/v2/transaction/0x5e519cd5117aea6ed9d51d4f235b4badb2e3f69377a4e2f945e13feb20af4db3?chain=eth' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
public async void fetchTransaction()
8
{
9
BlockTransaction blockTransaction = await Moralis.Web3Api.Native.GetTransaction(transactionHash: "0x5e519cd5117aea6ed9d51d4f235b4badb2e3f69377a4e2f945e13feb20af4db3", ChainList.eth);
10
Debug.Log(blockTransaction.ToJson());
11
}
12
}
Copied!

Example result:

1
{
2
"hash": "0x1ed85b3757a6d31d01a4d6677fc52fd3911d649a0af21fe5ca3f886b153773ed",
3
"nonce": "1848059",
4
"transaction_index": "108",
5
"from_address": "0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0",
6
"to_address": "0x003dde3494f30d861d063232c6a8c04394b686ff",
7
"value": "115580000000000000",
8
"gas": "30000",
9
"gas_price": "52500000000",
10
"input": "0x",
11
"receipt_cumulative_gas_used": "4923073",
12
"receipt_gas_used": "21000",
13
"receipt_contract_address": null,
14
"receipt_root": null,
15
"receipt_status": "1",
16
"block_timestamp": "2021-05-07T11:08:35.000Z",
17
"block_number": "12386788",
18
"block_hash": "0x9b559aef7ea858608c2e554246fe4a24287e7aeeb976848df2b9a2531f4b9171",
19
"logs": [
20
{
21
"log_index": "273",
22
"transaction_hash": "0xdd9006489e46670e0e85d1fb88823099e7f596b08aeaac023e9da0851f26fdd5",
23
"transaction_index": "204",
24
"address": "0x3105d328c66d8d55092358cf595d54608178e9b5",
25
"data": "0x00000000000000000000000000000000000000000000000de05239bccd4d537400000000000000000000000000024dbc80a9f80e3d5fc0a0ee30e2693781a443",
26
"topic0": "0x2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a",
27
"topic1": "0x000000000000000000000000031002d15b0d0cd7c9129d6f644446368deae391",
28
"topic2": "0x000000000000000000000000d25943be09f968ba740e0782a34e710100defae9",
29
"topic3": null,
30
"block_timestamp": "2021-05-07T11:08:35.000Z",
31
"block_number": "12386788",
32
"block_hash": "0x9b559aef7ea858608c2e554246fe4a24287e7aeeb976848df2b9a2531f4b9171"
33
}
34
]
35
}
Copied!