Bartering is a new feature in Minecraft 1.16 which allows you to give/use a gold ingot on a piglin in exchange for a random item, which can include soul sand, ender pearls, soul speed, fire resistance, crying obsidian, and fire charges.
The main mechanic of the farm is that a gold ingot is given to the piglin once an item leaves the hopper beneath it, so make sure you have plenty of storage cause if the items are stuck in the hopper, the farm stops working. All you need are some building blocks, a redstone torch, a redstone comparator, a dropper, chests, a nametag, a minecart(with rails)/boat and a lot of gold.
How to build the farm
1. First, mine one block down in your workspace, and make sure it is in the nether. Place the redstone torch in the hole, and place a chest right in front of it. The torch will lock the hopper so no unwanted items fall in while building.
2. Place a hopper funneling into the chest above the torch, and build two blocks high around it, with the second block in the middle being a dropper. Place a block as a ceiling block three blocks above the hopper.
3. Next, if you are in survival, use a boat or minecart to get a piglin on the hopper, you could use gold ingot to lure it there, then seal it in and nametag it so it won’t despawn.
4. Finally, retrieve the redstone torch and place a comparator facing out of the hopper. Place a block behind it and place a redstone torch on top of that block. Place another block above the torch behind the dropper, and load it up with gold. To start it up place a button next to the torch and press it, in case the system ever gets stuck, all you need to do is restart the redstone circuit. Voila! Now you have an easy, compact, automatic bartering system. For infinite gold, you could hook it up to a gold farm. For more storage, use large chests linked to each other via hoppers.
Finally, you should end up with something like this.