IRYS 101
Funding & withdrawing

Funding / withdrawing

Users fund nodes to pay for uploads. Funds can be withdrawn at any time.

Tracking Deposits

Each Irys node has a collection of per-token wallets and an internal ledger system.

The per-token wallets collect user deposits. All deposits for a given token are consolidated into a single designated wallet address.

An internal ledger maintains a list of user wallet addresses, and records the amount deposited by each user into the node's corresponding wallet. This enables the system to accurately track each user's deposit history.

To see the list of wallets for a given node, append /info to the network address.

Example:

{
	"version": "0.2.0",
	"addresses": {
		"arweave": "ZE0N-8P9gXkhtK-07PQu9d8me5tGDxa_i4Mee5RzVYg",
		"ethereum": "0x474E7A206bd6186B0C51ad9b1D406c12c4fed9c1",
		"matic": "0x474E7A206bd6186B0C51ad9b1D406c12c4fed9c1",
		"bnb": "0x474E7A206bd6186B0C51ad9b1D406c12c4fed9c1",
		"avalanche": "0x474E7A206bd6186B0C51ad9b1D406c12c4fed9c1",
		"solana": "AFxXJjdXd4i4pvdFbYAd2TmJqQFu9aYCysAFRmPZ4jTo",
		"arbitrum": "0x474E7A206bd6186B0C51ad9b1D406c12c4fed9c1",
		"boba-eth": "0x474E7A206bd6186B0C51ad9b1D406c12c4fed9c1",
		"boba": "0x474E7A206bd6186B0C51ad9b1D406c12c4fed9c1",
		"chainlink": "0x474E7A206bd6186B0C51ad9b1D406c12c4fed9c1",
		"near": "bundlr2.near",
		"aptos": "0xed50b11ce7f4402bee43f357e593ca46515f530ecca991d1460dc0557617d033"
	},
	"gateway": "gateway.irys.xyz"
}

How funding works

The funding process is as follows:

  1. Tokens are transferred from the user's wallet to the node's wallet address associated with the relevant token.
  2. The transaction ID from the first step is forwarded to the selected Irys node.
  3. The Irys node verifies that the transaction was directed to one of its designated wallets.
  4. Once verified, the node proceeds to update an internal ledger that tracks the sender's wallet and the number of tokens transferred.

How withdrawing works

The withdrawing process is as follows:

  1. The node performs a validation of the request's field order and format, creates a deep hash of the supplied data, and subsequently verifies it using the provided signature.
  2. The node checks if the request comes from a wallet listed on its internal ledger.
  3. The node confirms if the requested withdrawal amount does not exceed the user's balance.
  4. The requested funds are transferred back to the user from the node's wallet, with the user responsible for paying the associated gas fees for the transfer.
  5. The internal ledger is updated with the user's new balance.

The request for withdrawal is sent as a JSON object with the following fields:

const data = {
	nonce,
	publicKey,
	token,
	amount,
	signature,
	sigType,
};
FieldDescription
nonceA counter tracking the total number of withdrawals performed by this wallet (used to prevent man-in-the-middle attacks (opens in a new tab))
publicKeyThe user's public key
tokenThe token being withdrawn
amountThe amount being withdrawn
signatureSignature generated by hashing and then signing the token, amount, and nonce
sigTypeUsed internally
ℹ️

For implementation and usage details, see the SDK documentation for fund() and withdrawBalance()).