Bartering

Bartering is an action the player can perform with piglins.

Java Edition
Bartering is controlled by loot table. To barter with a piglin, a player either throws a gold ingot near the piglin or the gold ingot on it. The piglin takes the gold ingot and appears to examine it for six seconds, after which the piglin tosses a random item to the player, based on the table below.

Note that while piglins will pick up many other items that are made of gold, ingots are the only item that will result in a trade. Any other gold item-nuggets, blocks, etc.-will simply be added to the Piglin's inventory (Or in the case of armor and weapons, equipped), with the only way to regain them being to kill the piglin. Additionally, baby piglins will not barter at all, and will treat gold ingots like other gold items (As in, steal them).

The item the piglin throws may be one of the following:

If multiple gold ingots are on the ground, piglins pick them up one at a time and toss a new item once every six seconds. Once there are no ingots remaining to pick up, they return to their normal behavior.

Hitting a piglin causes it to put the ingot into its inventory and it cannot be bartered with again unless it puts another item in its inventory. This stored ingot is dropped upon death. Piglins who are killed in one hit before they finish examining drop the ingot with the same chances as any other held item.

Bedrock Edition
$1/424$, interacting with a piglin while holding a gold ingot prompts the piglin to drop either a block of obsidian or flint and steel. Unlike $5/424$, the piglin immediately drops the item and does not inspect the ingot. If the piglin picks up an ingot from the ground, it drops a nether wart block.