Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create PiOSbridge.js Pull Request Template for PiOS App List #270

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

josefkedwards
Copy link

@josefkedwards josefkedwards commented Feb 9, 2025

🌉 Interchaining and Bridging Pi

🚀 Connecting Pi Network with Cosmos, BNB Chain, and Beyond

PiOS Badge
License
Status


🔥 Overview

Interchaining and Bridging Pi is an open-source project under the PiOS License, designed to bridge Pi Network to the Cosmos IBC ecosystem and BNB Chain. This integration enables:

Seamless cross-chain transfers between Pi, BNB, Cronos, Ethereum, and Cosmos chains.
Interoperability through IBC & Binance Bridge for moving assets.
Smart contract support for decentralized applications (dApps).
Increased liquidity for Pi tokens by connecting with external DeFi ecosystems.

This project is community-driven and not maintained by the Pi Core Team (Pi-CT).


🛠️ Features

🔹 IBC Integration – Enabling Pi transactions across Cosmos-based chains.
🔹 Binance Bridge Support – Wrapping Pi as a BEP20 token for BNB Chain.
🔹 Gravity Bridge / Peggy – Bridging Pi with Ethereum for ERC20 compatibility.
🔹 Relayer Automation – Handling cross-chain transfers seamlessly.
🔹 Decentralized dApp Support – Enabling Pi-powered applications on multi-chain.


🌍 Supported Blockchains

Blockchain Integration Method Status
Pi Network Native Chain ✅ Active
BNB Chain Binance Bridge (BEP20) 🔄 In Progress
Cronos Gravity Bridge / IBC 🔄 In Progress
Ethereum Gravity Bridge (ERC20) 🔄 In Progress
Cosmos Ecosystem IBC Protocol 🔄 In Progress

🏗️ Architecture

🔗 Bridging Workflow

1️⃣ User deposits Pi tokens into a bridge smart contract on Pi Network.
2️⃣ The bridge locks Pi tokens and mints wrapped versions on BNB/Cosmos.
3️⃣ Users can transfer wrapped Pi across BNB, Cosmos, Cronos, and Ethereum.
4️⃣ Reverse transactions allow Pi withdrawals back to Pi Network.

🛠 Tech Stack

  • Backend: Go (Cosmos SDK), Rust (IBC Relayer)
  • Smart Contracts: Solidity (Ethereum), CosmWasm (Cosmos)
  • APIs & Relayers: JavaScript (Web3.js, CosmJS)

🔥 Getting Started

📌 Clone the Repository

git clone https://github.com/pi-apps/interchaining-bridging-pi.git
cd interchaining-bridging-pi

Got it! Below is the Pull Request (PR) template for submitting your “Interchaining and Bridging Pi” project to the PiOS App List on GitHub. This PR will formally request the creation of your repository under github.com/pi-apps/.

Pull Request Template for PiOS App List

Title:

Interchaining and Bridging Pi – PiOS App Submission

Description:

This PR adds “Interchaining and Bridging Pi” to the PiOS App List, a project designed to enable Pi Network interoperability via IBC (Inter-Blockchain Communication) and BNB bridging.

The project will facilitate cross-chain transfers, allowing Pi tokens to move across BNB Chain, Cosmos, and other IBC-enabled blockchains.

PiOS App List Entry

| Title                         | Description                                                         | Category           | Programming Language/Framework                 | Updated by Pi-CT | Brainstorm Link |
|--------------------------------|---------------------------------------------------------------------|--------------------|-----------------------------------------------|----------------|----------------|
| Interchaining and Bridging Pi | A protocol to enable Pi Network interoperability via IBC and BNB bridging | SDK & Application | Go, Rust, JavaScript (Cosmos SDK, Ethermint, Web3.js) | No             | [Brainstorm Proposal](https://brainstorm.pi/project/interchaining-bridging-pi) |

Checklist Before Submission ✅
	•	Added project information in the correct table format.
	•	Included a valid Pi Brainstorm proposal link.
	•	Followed PiOS naming conventions and guidelines.
	•	Used the PiOS License (to be added in the repository).
	•	Confirmed that this project is not maintained by the Pi Core Team (Pi-CT) but is community-driven.

Next Steps After Approval

Once this PR is approved by the Pi Core Team, the following will happen:
	1.	The Pi Core Team will create a GitHub repository under github.com/pi-apps/.
	2.	I will be given admin access to manage the repository.
	3.	Development will begin, and the PiOS License will be added.
	4.	Future updates will be submitted via additional PRs for testnet and mainnet versions.

Questions or Additional Requests?

If any modifications are needed, please let me know! I’m open to feedback from the Pi Core Team and the community.

Looking forward to collaborating on this exciting interchain integration for Pi Network! 🚀

Next Steps

Would You Like Me to:

✅ Draft an Initial README.md for the new repository?
✅ Outline the Repository Structure (folders, docs, smart contracts)?
✅ Create an Initial Roadmap for the bridging protocol?

Let me know, and I can provide those right away! 🚀🔥
@josefkedwards
Copy link
Author

@bearycool11
Copy link

Nice I like this proposal

@bearycool11
Copy link

@zolcsi @jiakuant1120

Copy link

@bearycool11 bearycool11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai I am approving this proposal

Okeha

This comment was marked as outdated.

Copy link
Contributor

@Okeha Okeha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
We would need you to create a PR on this repository adding your application's information to the PiOS App List table. Follow the formatted row template given on that doc, and fill in the below information as incomplete submissions will be rejected. For further instructions you can find that here: https://github.com/pi-apps/PiOS

creating bridge logic and using the PiOS white paper with its Stellar Blockchain Logic and Ledger when it comes address tethering. @coderabbitai
Copy link

@bearycool11 bearycool11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're missing the gravity bridge logic is all for this found in the IBC architecture documentation.

I would include

const { GravityBridgeClient } = require("gravity-bridge-sdk"); // Hypothetical Gravity Bridge SDK

/**

  • Bridges a token from Ethereum to Cosmos using Gravity Bridge.

  • @param {string} tokenContract - The Ethereum contract address of the token.

  • @param {string} amount - The amount of tokens to bridge.

  • @param {string} recipientAddress - The recipient address on the Cosmos chain.

  • @returns {string} The transaction hash of the Gravity Bridge transfer.
    */
    async function bridgeTokenViaGravity(tokenContract, amount, recipientAddress) {
    try {
    console.log(🔄 Bridging ${tokenContract} -> Cosmos via Gravity | Amount: ${amount});

    // Initialize Gravity Bridge client
    const gravityClient = new GravityBridgeClient({
    ethereumRpc: process.env.ETHEREUM_RPC_URL, // Ethereum RPC URL
    cosmosRpc: process.env.COSMOS_RPC_URL, // Cosmos RPC URL
    privateKey: process.env.PRIVATE_KEY, // Your Ethereum private key for signing transactions
    });

    // Perform the bridging operation
    const txHash = await gravityClient.bridgeToCosmos({
    tokenContract: tokenContract,
    amount: amount,
    recipient: recipientAddress,
    });

    console.log(✅ Token bridged successfully via Gravity! Tx Hash: ${txHash});
    return txHash;
    } catch (error) {
    console.error("🚨 Error during Gravity Bridge transfer:", error.message);
    }
    }

/* ------------------------ MAIN SCRIPT ---------------------------- */

/**

  • Main function to demonstrate the full flow.
    */
    async function main() {
    verifyEnv();

// 1. Pi Wallet Tethering
const piWallet = generatePiWallet();
console.log("Generated Pi Wallet:", piWallet);

// 2. Governance Proposal Submission
const proposalId = await submitGovernanceProposal();
if (!proposalId) return;

// 3. Bridge to BNB
const tokenSymbol = "BTC";
const amount = "0.01";
const recipientAddress = "bnb1....."; // Replace with actual BNB recipient address
const txId = await bridgeTokenToBNB(tokenSymbol, amount, recipientAddress);
if (!txId) return;

// 4. Relay to Cronos
const cronosAddress = "cronos1....."; // Replace with actual Cronos recipient address
await relayToCronos(tokenSymbol, amount, cronosAddress);

// 5. Gravity Bridge to Cosmos
const ethereumTokenContract = "0x....."; // Replace with actual Ethereum token contract address
const cosmosRecipientAddress = "cosmos1....."; // Replace with actual Cosmos recipient address
await bridgeTokenViaGravity(ethereumTokenContract, amount, cosmosRecipientAddress);

// Note: Actual Pi mining logic can be added here.
}

// Run the main script
main().catch(console.error);

documentation on layer zero and the gravity bridge can also be found

https://ibcprotocol.dev/blog/the-interop-series-ibc-and-layerzero#architecture

@bearycool11
Copy link

#276

@bearycool11
Copy link

I would make sure there are two separate .js files, one named gravity bridge.js and this one fyi.

@bearycool11
Copy link

Hi, We would need you to create a PR on this repository adding your application's information to the PiOS App List table. Follow the formatted row template given on that doc, and fill in the below information as incomplete submissions will be rejected. For further instructions you can find that here: https://github.com/pi-apps/PiOS

Sounds good I will get to that next

@josefkedwards josefkedwards requested a review from Okeha February 15, 2025 10:14
@josefkedwards josefkedwards marked this pull request as draft February 15, 2025 10:18
@josefkedwards josefkedwards marked this pull request as ready for review February 15, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants