HTTP API
An overview of the Arweave HTTP API.
Last updated
Was this helpful?
An overview of the Arweave HTTP API.
Last updated
Was this helpful?
The Arweave protocol is based on HTTP, so any existing http clients/libraries can be used to interface with the network, for example Axios or Fetch for JavaScript, Guzzle for PHP, etc.
The default port is 1984.
Requests and queries can be sent to any Arweave node directly using their IP address, for example . Hostnames can also be used if configured with DNS, for example .
Arweave specific wrappers and clients are currently in development to simplify common operations and API interactions, there are currently integrations for , , (which can also be used with Java and C#) and .
Common data structures, formats, and processes explained.
Nodes and gateways accept transactions through the POST /tx
endpoint. The body must be a JSON encoding of a transaction. Amounts are specified in winstons.
Transaction and block identifiers and wallet addresses, among some other fields, are encoded as Base64URL strings when sent over HTTP or put in the URLs or displayed in the block explorers.
A transaction may be used for uploading data, transferring tokens, or both.
format
Yes
integer
Currently supported formats are `1` and `2` (often referred to as v1 and v2 respectively). The v1 format is deprecated.
id
Yes
Base64URL string
A SHA-256 hash of the transaction signature.
last_tx
Yes
Base64URL string
An anchor - a protection against replay attacks. It may be either a hash of one of the last 50 blocks or the last outgoing transaction ID from the sending wallet. If this is the first transaction from the wallet then an empty string may be used. The recommended way is to use the value returned by GET /tx_anchor
. Two different transactions can have the same last_tx if a block hash is used.
owner
Yes
Base64URL string
The full RSA modulus value of the sending wallet. The modulus is the n value from the JWK. The RSA public key.
tags
No
array of objects
A list of name-value pairs, each pair is serialized as {"name": "a BaseURL string", "value":" a Base64URL string"}
. If no tags are being used then use an empty array []. The total size of the names and values may not exceed 2048 bytes. Tags might be useful for attaching a message to a transaction sent to another wallet, for example a reference number or identifier to help account for the transaction.
target
No
Base64URL string
The target address to send tokens to (if required). If no tokens are being transferred to another wallet then use an empty string. Note that sending tokens to the owner address is not supported. The address is the SHA-256 hash of the RSA public key.
quantity
No
Numerical string (winstons)
The amount to transfer from the owner wallet to the target wallet address (if required).
data_root
No
Base64URL string
Only use with v2
transactions. The merkle root of the transaction data. If there is no data then use an empty string.
data_size
No
Numerical string (bytes)
Only use with v2
transactions. The size in bytes of the transactin data. Use "0" if there is no data. The string representation of the number must not exceed 21 bytes.
data
No
Base64URL string
The data to be submitted. If no data is being submitted then use an empty string. For v2
transactions there is no need, although it is possible, to use this field even if there is data (means, data_size
> 0 and data_root
is not empty). In v1
transactions, data cannot be bigger than 10 MiB. In v2
transactions, the limit is decided by the nodes. At the time this was written, all nodes in the network accept up to 12 MiB of data via this field.
reward
Yes
Numerical string (winstons)
The transaction fee. See the price endpoint docs for more info.
signature
Yes
Base64URL string
An RSA signature of a merkle root of the SHA-384 hashes of transaction fields (except for id, which is the hash of the signature). See Transaction Signing for more.
Transaction signatures are generated by computing a merkle root of the SHA-384 hashes of transaction fields: format
, owner
, target
, data_root
, data_size
, quantity
, reward
, last_tx
, tags
, then signing the hash. Signatures are RSA-PSS with SHA-256 as the hashing function.
The n
value is the public modulus and is used as the transaction owner field, and the address of a wallet is a Base64URL encoded SHA-256 hash of the n
value from the JWK.
The address for this wallet is GRQ7swQO1AMyFgnuAPI7AvGQlW3lzuQuwlJbIpWV7xk
.
1 AR = 1000000000000 Winston (12 zeros) and 1 Winston = 0.000000000001 AR.
The HTTP API will return all amounts as winston strings, this is to allow for easy interoperability between environments that do not accommodate arbitrary-precision arithmetic.
JavaScript for example stores all numbers as double precision floating point values and as such cannot natively express the integer number of winston. Providing these values as strings allows them to be directly loaded into most 'bignum' libraries.
Endpoints for interacting with transactions and related resources.
GET
https://arweave.net/tx/{id}
Get a transaction by its ID.
id*
String
Transaction ID
Accept
String
application/json
The quantity and reward values are always represented as winston strings.
GET
https://arweave.net/tx/{id}/status
Gets the status of a transaction
id*
String
Transaction ID
Accept
String
application/json
GET
https://arweave.net/tx/{id}/{field}
Get a single field from a transaction.
id*
String
Transaction ID
id*
String
Field name, acceptable values: id, last_tx, owner, tags, target, quantity, data, data_root, data_size, reward, signature.
Accept
String
application/json
GET
https://arweave.net/{id}
Get the decoded data from a transaction.
The Content-Type
will default to the one specified in a tag with tag-name Content-Type
.
You can also get the data with a different Content-Type
response, by doing:
GET
https://arweave.net/tx/{id}/data.{extension}
Get the decoded data from a transaction with specific mime extension.
id*
String
Transaction ID
extension*
String
Mime extension (example: ".html", ".txt", ".jpg")
Any extension can be specified depending on the clients use case. Web pages can be requested with data.html
GET
https://arweave.net/price/{bytes}/{target}
This endpoint is used to calculate the minimum fee (reward) for a transaction of a specific size, and possibly to a specific address.This endpoint should always be used to calculate transaction fees as closely to the submission time as possible. Pricing is dynamic and determined by the network, so it's not always possible to accurately calculate prices offline or ahead of time. Transactions with a fee that's too low will simply be rejected.
bytes*
String
The number of bytes to go into the transaction data field. If sending AR to another wallet with no data attached, then 0 should be used.
target
String
The target wallet address if sending AR to another wallet.
Accept
String
application/json
To get a fee for sending 10 AR to a wallet with address abc
consult /price/0/abc
.
To upload 123 bytes without transferring tokens consult /price/123
.
To send some AR to the "abc" wallet and upload 123 bytes of data query /price/123/abc
.
POST
https://arweave.net/tx
Submit a new transaction to the network.The request body should be a JSON object with the attributes described in Transaction Format.
Accept
String
application/json
Content-Type
String
application/json
Endpoints for getting information about a wallet.
GET
https://arweave.net/wallet/{address}/balance
Get the balance for a given wallet. Unknown wallet addresses will simply return 0.
address
String
Wallet address
GET
https://arweave.net/wallet/{address}/last_tx
Get the last outgoing transaction for the given wallet address.
address
String
Wallet address
Endpoints for getting blocks and block data.
GET
https://arweave.net/block/hash/{id}
Get a block by its id/hash (idep_hash).
id
String
The block hash (indep_hash).
Accept
String
application/json
X-Block-Format
String
2
GET
https://arweave.net/block/height/{height}
Get a block by its height.
height*
String
The block height.
Accept
String
application/json
X-Block-Format
String
2
Endpoints for getting information about the current network and node state.
GET
https://arweave.net/info
Get the current network information including height, current block, and other properties.
Accept
String
application/json
GET
https://arweave.net/peers
Get the list of peers from the node. Nodes can only respond with peers they currently know about, so this will not be an exhaustive or complete list of nodes on the network.
Accept
String
application/json
POST
https://arweave.net/chunk
Upload Data Chunks.
Example json-data payload:
Accept
String
application/json
Content-Type
String
application/json
GET
https://arweave.net/tx/{id}/data
The endpoint serves data regardless of how it was uploaded
id
String
Transaction ID
GET
https://arweave.net/tx/{id}/offset
Get the absolute end offset and size of the transaction
Note that the client may use this information to collect transaction chunks. Start with the end offset and fetch a chunk via GET /chunk/<offset>
. Subtract its size from the transaction size, if there are more chunks to fetch, subtract the size of the chunk from the offset and fetch the next chunk.
id
String
Transaction ID
See the below for full examples.
Arweave uses the JSON Web Key (JWK) format () with 4096 length RSA-PSS keys. This JWK format allows for cryptographic keys to be represented as a JSON object where each property represents a property of the underlying cryptographic key. It's widely supported with libraries for most popular languages. It's possible to convert a JWK to a PEM file or other crypto key file format, support for this this will vary from language to language. If you're generating your own keys manually the public exponent (e) must be 65537. If any other value is used the transactions signed by these keys will be invalid and rejected.
Winston is the smallest possible unit of AR, similar to a in Bitcoin, or in Ethereum.
See the section for details about transaction structure and contents, with examples.
Find more information about these fields and examples in the section.