BNB Smart Chain
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
BNB Smart Chain
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Because BNB Smart Chain runs a geth-equivalent EVM and charges gas in BNB, the same compiled bytecode you would deploy on Ethereum lives on-chain here too. eth_getCode hands you that deployed bytecode for any address, captured as of the block you name. You get back a hex string of EVM opcodes, or 0x when nothing is there. Aim the call at https://bsc.therpc.io/YOUR_API_KEY on chain ID 56 to read a contract's runtime code straight from state. Worth doing before you trust an address with a BEP-20 approval or a router swap.
0x.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | address | string (hex) | Sim | The address to read code from. |
| 2 | blockTag | string | Não | Block at which to read the code.Padrão: latest |
| Tipo | Descrição |
|---|---|
| string (hex) | Hex-encoded EVM bytecode, or "0x" if the address is an EOA, the contract was self-destructed, or no code existed at that block. |
Try it live in the BNB Smart Chain playground.
| Código | Mensagem | Causa |
|---|---|---|
-32602 | Invalid params | Address is malformed or block tag is unrecognised. |
-32000 | Missing trie node | Historical block has been pruned on a non-archive node. |
0x result covers two different situations: a wallet that never held code, and a contract destroyed earlier. Absence alone cannot tell the two apart.Parâmetros
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"