입력 필드
정책 결정에서 사용 가능한 모든 데이터에 대한 완전한 참조
모든 정책 결정은 input 객체를 통해 요청 데이터에 액세스할 수 있습니다. 이 페이지는 정책에서 사용할 수 있는 모든 사용 가능한 필드를 문서화합니다.
네트워크
이 필드들은 호출되는 블록체인 네트워크와 RPC 메서드를 식별하여 체인별 정책을 생성하거나 특정 작업을 제한할 수 있습니다.
input.chain
| Type | Example Values |
|---|---|
| string | "ethereum", "polygon", "arbitrum", "optimism", "base" |
요청의 블록체인 네트워크 식별자입니다. 이 필드를 사용하여 특정 체인에 대한 액세스를 제한하거나, 네트워크별로 다른 정책을 적용하거나, 특정 체인을 완전히 차단할 수 있습니다.
예제
# Only allow transactions on Polygon and Base
allowed_chains := {"polygon", "base"}
deny if {
not input.chain in allowed_chains
}
# Apply stricter limits on Ethereum mainnet
deny if {
input.chain == "ethereum"
input.usd_value > 1000
}input.rpc_method
| Type | Example Values |
|---|---|
| string | "eth_sendTransaction", "eth_call", "eth_getBalance" |
요청의 JSON-RPC 메서드 이름입니다. 이를 사용하여 특정 작업을 허용하거나 차단할 수 있습니다. 예를 들어, 읽기 작업(eth_call, eth_getBalance)은 허용하면서 쓰기 작업(eth_sendTransaction)은 제한할 수 있습니다.
일부 메서드는 플랫폼 수준에서 제한되며 정책을 통해 활성화할 수 없습니다.
예제
# Only allow read-only methods
allowed_methods := {
"eth_call",
"eth_getBalance",
"eth_getTransactionCount",
"eth_getCode",
"eth_getLogs"
}
deny if {
not input.rpc_method in allowed_methods
}
# Block signing methods
deny if {
input.rpc_method in {"eth_sign", "personal_sign", "eth_signTypedData"}
}요청 출처
이 필드들은 요청 출처에 대한 위치 정보를 제공하여 지리 기반 액세스 제어 및 지역 규정 준수를 가능하게 합니다.
input.source_ip
| Type | Example Values |
|---|---|
| string | "192.168.1.1", "2001:db8::1" |
요청을 하는 클라이언트의 IP 주소입니다. IP 기반 허용 목록/차단 목록 또는 소스 기반 속도 제한을 구현하는 데 사용합니다.
IP 해석
기본적으로 256 Blocks는 연결하는 클라이언트의 IP 주소를 사용합니다. 요청이 자체 인프라를 통해 프록시되는 경우 X-Forwarded-For 헤더를 통해 원본 클라이언트 IP를 전달할 수 있으며, 256 Blocks는 해당 헤더의 첫 번째 IP 주소를 사용합니다.
다음과 같은 경우에 유용합니다:
- 요청이 백엔드 서버를 통해 프록시되는 경우
- 최종 사용자의 실제 IP 주소를 전달해야 하는 경우
- 개발 환경에서 다른 IP 주소로 정책을 테스트하는 경우
예제
# Block specific IP addresses
blocked_ips := {"192.168.1.100", "10.0.0.50"}
deny if {
input.source_ip in blocked_ips
}
# Only allow requests from known infrastructure
allowed_ips := {"203.0.113.10", "203.0.113.11"}
deny if {
not input.source_ip in allowed_ips
}input.source_country
| Type | Example Values |
|---|---|
| string | "US", "GB", "DE", "UNKNOWN", "PRIVATE", "LOCALHOST" |
source_ip에서 파생된 2자 ISO 3166-1 alpha-2 국가 코드입니다. 지리적 제한, 규제 준수 또는 지역별 정책에 사용합니다.
국가 매핑은 매일 새로 고쳐집니다. 공용 IP 주소의 정확도는 일반적으로 95% 이상입니다.
특수 값
비공개 IP 주소의 경우 국가 코드 대신 다음 값이 반환됩니다:
| Value | Description |
|---|---|
"PRIVATE" | 사설 IP 범위 (10.x.x.x, 172.16-31.x.x, 192.168.x.x) |
"LOCALHOST" | 루프백 주소 (127.x.x.x) |
"LINK_LOCAL" | 링크 로컬 주소 (169.254.x.x) |
"MULTICAST" | 멀티캐스트 주소 (224.x.x.x - 239.x.x.x) |
"RESERVED" | 예약된 주소 (240.x.x.x+) |
"UNKNOWN" | 조회 실패 또는 지원되지 않는 주소 유형 |
예제
# Block sanctioned countries
blocked_countries := {"KP", "IR", "CU", "SY", "RU"}
deny if {
input.source_country in blocked_countries
}
# Only allow requests from specific regions
allowed_countries := {"US", "CA", "GB", "DE", "FR"}
deny if {
not input.source_country in allowed_countries
input.source_country != "PRIVATE" # Allow internal/development traffic
}트랜잭션 매개변수
이 필드들은 JSON-RPC 요청 매개변수에서 추출됩니다. 모든 주소는 일관된 비교를 위해 0x 접두사가 있는 소문자로 정규화됩니다.
input.from_address
| Type | Example Value |
|---|---|
| string (nullable) | "0x742d35cc6634c0532925a3b844bc9e7595f..." |
발신자의 지갑 주소입니다. 트랜잭션 또는 서명 요청을 시작하는 사람을 식별합니다. 이 필드를 사용하여 특정 지갑에 대한 허용 목록/차단 목록을 구현하거나 발신자에 따라 다른 정책 규칙을 적용합니다.
RPC 메서드별 소스
| Method | Parameter Location |
|---|---|
eth_sendTransaction | params[0].from |
eth_call | params[0].from |
eth_sign | params[0] |
personal_sign | params[1] |
eth_signTypedData | params[0] |
예제
# Only allow transactions from approved wallets
allowed_senders := {
"0x742d35cc6634c0532925a3b844bc9e7595f...",
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606..."
}
deny if {
not input.from_address in allowed_senders
}input.to_address
| Type | Example Value |
|---|---|
| string (nullable) | "0x742d35cc6634c0532925a3b844bc9e7595f..." |
트랜잭션의 수신자 또는 대상 주소입니다. 간단한 전송의 경우 지갑 주소이거나 컨트랙트 상호 작용의 경우 컨트랙트 주소일 수 있습니다. 새 컨트랙트를 배포할 때 값은 null입니다(컨트랙트 생성 트랜잭션에는 수신자가 없습니다).
RPC 메서드별 소스
| Method | Parameter Location |
|---|---|
eth_sendTransaction | params[0].to |
eth_call | params[0].to |
eth_getBalance | params[0] |
eth_getTransactionCount | params[0] |
예제
# Block transactions to known malicious addresses
blocked_addresses := {
"0x000000000000000000000000000000000000dead",
"0x1234567890abcdef..."
}
deny if {
input.to_address in blocked_addresses
}input.contract_addresses
| Type | Example Value |
|---|---|
| array of strings | ["0x742d35cc...", "0xa0b86991..."] |
요청에 관련된 스마트 컨트랙트 주소의 배열입니다. 사용자가 상호 작용할 수 있는 컨트랙트를 제어하는 데 특히 유용합니다. eth_getLogs와 같이 여러 컨트랙트를 쿼리할 수 있는 메서드의 경우 배열에 여러 주소가 포함될 수 있습니다.
RPC 메서드별 소스
| Method | Parameter Location | Notes |
|---|---|---|
eth_sendTransaction | params[0].to | data 또는 input 필드가 있는 경우에만 |
eth_call | params[0].to | 컨트랙트 호출 시 |
eth_getCode | params[0] | 대상 컨트랙트 주소 |
eth_getStorageAt | params[0] | 대상 컨트랙트 주소 |
eth_getLogs | params[0].address | 단일 주소 또는 배열일 수 있음 |
예제
# Only allow interactions with approved contracts (e.g., USDT and USDC)
approved_contracts := {
"0xdac17f958d2ee523a2206206994597c13d831ec7",
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}
deny if {
some addr in input.contract_addresses
not addr in approved_contracts
}input.value_wei
| Type | Example Value |
|---|---|
| string (nullable) | "0xde0b6b3a7640000" (1 ETH in hex) |
전송되는 네이티브 토큰 값으로, 16진수 문자열로 wei로 표현됩니다. Wei는 ETH의 가장 작은 단위입니다(1 ETH = 10^18 wei). 이것은 원시 온체인 값입니다 - USD 기반 정책의 경우 대신 input.usd_value를 사용하십시오.
RPC 메서드별 소스
| Method | Parameter Location |
|---|---|
eth_sendTransaction | params[0].value |
eth_call | params[0].value |
예제
# Block transactions transferring more than 10 ETH (in wei)
# 10 ETH = 10 * 10^18 wei = 0x8ac7230489e80000
deny if {
input.value_wei != null
to_number(input.value_wei) > 10000000000000000000
}
# Block zero-value transactions to specific contracts
deny if {
input.value_wei == "0x0"
some addr in input.contract_addresses
addr == "0x..."
}input.gas_limit
| Type | Example Value |
|---|---|
| string (nullable) | "0x5208" (21000 in hex) |
트랜잭션이 소비할 수 있는 최대 가스 단위 수로, 16진수 문자열로 표현됩니다. 간단한 ETH 전송은 21,000 가스를 사용하며, 컨트랙트 상호 작용은 일반적으로 더 많이 필요합니다.
RPC 메서드별 소스
| Method | Parameter Location |
|---|---|
eth_sendTransaction | params[0].gas |
eth_call | params[0].gas |
예제
# Block transactions with excessive gas limits (potential spam/abuse)
# 1,000,000 gas = 0xf4240
deny if {
input.gas_limit != null
to_number(input.gas_limit) > 1000000
}
# Don't sponsor high-gas transactions
denyGasSponsor if {
input.gas_limit != null
to_number(input.gas_limit) > 500000
}input.gas_price
| Type | Example Value |
|---|---|
| string (nullable) | "0x3b9aca00" (1 gwei in hex) |
레거시(EIP-1559 이전) 트랜잭션의 가스 가격으로, 16진수 문자열로 wei로 표현됩니다. 대신 max_fee_per_gas를 사용하는 EIP-1559 트랜잭션의 경우 이 필드는 null입니다.
RPC 메서드별 소스
| Method | Parameter Location |
|---|---|
eth_sendTransaction | params[0].gasPrice |
eth_call | params[0].gasPrice |
예제
# Block legacy transactions with extremely high gas prices
# 500 gwei = 500 * 10^9 = 0x746a528800
deny if {
input.gas_price != null
to_number(input.gas_price) > 500000000000
}
# Don't sponsor legacy transactions (prefer EIP-1559)
denyGasSponsor if {
input.gas_price != null
input.max_fee_per_gas == null
}input.max_fee_per_gas
| Type | Example Value |
|---|---|
| string (nullable) | "0x77359400" (2 gwei in hex) |
EIP-1559 트랜잭션의 가스 단위당 최대 총 수수료로, 16진수 문자열로 표현됩니다. 발신자가 기꺼이 지불하려는 절대 최대값입니다(기본 수수료 + 우선 수수료). EIP-1559 트랜잭션 유형에만 존재합니다.
RPC 메서드별 소스
| Method | Parameter Location |
|---|---|
eth_sendTransaction | params[0].maxFeePerGas |
예제
# Block transactions willing to pay excessive gas fees
# 1000 gwei = 1000 * 10^9 = 0xe8d4a51000
deny if {
input.max_fee_per_gas != null
to_number(input.max_fee_per_gas) > 1000000000000
}
# Only sponsor transactions with reasonable max fees
# 50 gwei = 50 * 10^9 = 0xba43b7400
denyGasSponsor if {
input.max_fee_per_gas != null
to_number(input.max_fee_per_gas) > 50000000000
}input.max_priority_fee_per_gas
| Type | Example Value |
|---|---|
| string (nullable) | "0x3b9aca00" (1 gwei in hex) |
EIP-1559 트랜잭션의 가스 단위당 최대 우선 수수료(팁)로, 16진수 문자열로 표현됩니다. 인센티브로 블록 생산자에게 전달되는 부분입니다. EIP-1559 트랜잭션 유형에만 존재합니다.
RPC 메서드별 소스
| Method | Parameter Location |
|---|---|
eth_sendTransaction | params[0].maxPriorityFeePerGas |
예제
# Block transactions with excessive priority fees (potential MEV manipulation)
# 10 gwei = 10 * 10^9 = 0x2540be400
deny if {
input.max_priority_fee_per_gas != null
to_number(input.max_priority_fee_per_gas) > 10000000000
}
# Require reasonable priority fees for sponsored transactions
# 2 gwei = 2 * 10^9 = 0x77359400
denyGasSponsor if {
input.max_priority_fee_per_gas != null
to_number(input.max_priority_fee_per_gas) > 2000000000
}보강된 데이터
이 필드들은 원시 요청에 있는 것 이상의 추가 컨텍스트를 제공하기 위해 256 Blocks에 의해 계산됩니다.
input.usd_value
| Type | Example Value |
|---|---|
| number (nullable) | 1500.50 |
현재 시장 가격을 사용하여 계산된 트랜잭션의 네이티브 토큰 값(value_wei)의 USD 상응액입니다. 지출 한도 및 후원 제어를 구현하는 데 가장 일반적으로 사용되는 필드입니다.
가격은 신뢰할 수 있는 가격 피드(예: Chainlink)에서 매분 가져옵니다. 트랜잭션에 값이 없는 경우(예: 순수 컨트랙트 호출) 값은 null일 수 있습니다.
예제
# Block transactions over $10,000
deny if {
input.usd_value > 10000
}
# Don't sponsor transactions over $100
denyGasSponsor if {
input.usd_value > 100
}
# Handle null values safely
deny if {
input.usd_value != null
input.usd_value > 50000
}원시 데이터
위의 구조화된 필드가 필요한 것을 제공하지 않는 고급 사용 사례용입니다.
input.raw_params
| Type | Example Value |
|---|---|
| array | [{"from": "0x...", "to": "0x...", "value": "0x...", "data": "0x..."}] |
원본 요청의 완전하고 수정되지 않은 JSON-RPC params 배열입니다. 구조화된 입력 속성을 통해 노출되지 않은 필드에 액세스해야 할 때 사용합니다. 예를 들면:
- 함수 서명 감지를 위한 컨트랙트 호출 데이터(
data필드) - EIP-2930 트랜잭션의 액세스 목록
- 사용자 정의 또는 비표준 필드
예제
# Block ERC-20 transfer function calls
# Function signature: transfer(address,uint256) = 0xa9059cbb
deny if {
params := input.raw_params[0]
params.data != null
startswith(params.data, "0xa9059cbb")
}
# Block ERC-20 approve function (0x095ea7b3)
deny if {
params := input.raw_params[0]
params.data != null
startswith(params.data, "0x095ea7b3")
}