Transaction
트랜잭션 - Gas Limit 추정
EVM 트랜잭션의 가스 한도 추정
POST
/
v2
/
transaction
/
{chain}
/
estimate-gas-limit
트랜잭션 - 가스 한도 추정
curl --request POST \
--url https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
"to": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
"data": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000",
"value": "0x0"
}
'import requests
url = "https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit"
payload = {
"from": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
"to": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
"data": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000",
"value": "0x0"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: '0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8',
to: '0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8',
data: '0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000',
value: '0x0'
})
};
fetch('https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => '0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8',
'to' => '0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8',
'data' => '0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000',
'value' => '0x0'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit"
payload := strings.NewReader("{\n \"from\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"to\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"data\": \"0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000\",\n \"value\": \"0x0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"to\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"data\": \"0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000\",\n \"value\": \"0x0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"to\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"data\": \"0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000\",\n \"value\": \"0x0\"\n}"
response = http.request(request)
puts response.read_body{
"gasLimit": "0x5208",
"chain": "ethereum"
}인증
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
경로 매개변수
지원되는 네트워크에 나열된 체인 이름
사용 가능한 옵션:
bsc, eth 본문
application/json
가스 추정 파라미터
From address
예시:
"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8"
To address
예시:
"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8"
Transaction data (hex)
예시:
"0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000"
Value to send (in wei, hex string)
예시:
"0x0"
이 페이지가 도움이 되었나요?
⌘I
트랜잭션 - 가스 한도 추정
curl --request POST \
--url https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
"to": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
"data": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000",
"value": "0x0"
}
'import requests
url = "https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit"
payload = {
"from": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
"to": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
"data": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000",
"value": "0x0"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: '0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8',
to: '0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8',
data: '0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000',
value: '0x0'
})
};
fetch('https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => '0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8',
'to' => '0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8',
'data' => '0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000',
'value' => '0x0'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit"
payload := strings.NewReader("{\n \"from\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"to\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"data\": \"0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000\",\n \"value\": \"0x0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"to\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"data\": \"0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000\",\n \"value\": \"0x0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chainstream.io/v2/transaction/{chain}/estimate-gas-limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"to\": \"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8\",\n \"data\": \"0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000\",\n \"value\": \"0x0\"\n}"
response = http.request(request)
puts response.read_body{
"gasLimit": "0x5208",
"chain": "ethereum"
}
