Skip to content

Latest commit

History

History
325 lines (228 loc) · 10.2 KB

File metadata and controls

325 lines (228 loc) · 10.2 KB
titleGitbank Plugin
version1.0.0
descriptionManage your Web3 vault on Base via GitHub identity. No wallet required. All transactions executed by the Gitbank relayer -- Gitbank pays all gas.
api_basehttps://gitbank.io/api/public
mcp_serverhttps://gitbank.io/api/mcp
chainBase Mainnet (chainId 8453)

Gitbank Plugin

Gitbank is an IssueOps platform for Web3 teams. Every GitHub account gets a soul-bound vault on Base Mainnet, anchored to the account's permanent GitHub user ID.

This plugin uses relayer mode. No wallet connection required. All transactions are signed and submitted by the Gitbank relayer. Gitbank pays all gas fees. The user only needs to confirm their identity by posting one comment on GitHub.

Supported tokens: USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913), WETH (0x4200000000000000000000000000000000000006)

Chain: Base Mainnet (8453)

API base URL:https://gitbank.io/api/public


How It Works

User: "Swap 50 USDC to WETH, my GitHub is alice"
1. AI calls GET /vault/by-github/alice
-> vault_address, USDC: 250.00, WETH: 0.00
2. AI calls GET /prepare/swap?username=alice&amount=50&from_token=USDC&to_token=WETH&mode=relayer
-> { confirm_code: "mcp1a2b3c4d", confirm_url: "...", instructions: "..." }
3. AI shows the user the instructions field verbatim:
"Swap 50 USDC to WETH queued.
To authorize, open: https://github.com/gitbankio/playground/discussions/4
Post this comment: @gitbankbot confirm mcp1a2b3c4d
(Expires in 10 minutes. Only @alice can confirm.)"
4. User opens the GitHub link and posts the comment as @alice.
5. Gitbank bot verifies @alice posted (via HMAC-signed webhook).
Identity check: if commenter is NOT @alice, bot rejects.
6. Bot executes the swap via relayer. Gitbank pays gas.
Bot posts in the GitHub thread:
"Swap confirmed. Tx: https://basescan.org/tx/0x..."
7. Done. No wallet. No gas.

Identity guarantee: GitHub webhook payloads are HMAC-signed by GitHub. The bot reads sender identity from the signed payload only. It cannot be spoofed.


Read Endpoints

GET /api/public/vault/by-github/:github_username

Returns vault address and current USDC + WETH balances. Always call this first.

GET https://gitbank.io/api/public/vault/by-github/alice

Response (vault deployed):

{
"github_username": "alice",
"vault_address": "0x...",
"vault_deployed": true,
"balances": {
"USDC": "250.00",
"WETH": "0.050000"
},
"chain": "base",
"chain_id": 8453
}

Response (vault not deployed):

{
"github_username": "alice",
"vault_deployed": false,
"balances": {}
}

If vault_deployed is false, proceed normally. Vault auto-deploys on first prepare request -- free, Gitbank pays deployment gas.

GET /api/public/vault/:vault_address

Returns balances for a known vault address.

GET /api/public/transactions/:github_username

Returns the 20 most recent vault transactions.

GET https://gitbank.io/api/public/transactions/alice

Prepare Endpoints (Relayer Mode)

All prepare endpoints queue a pending vault operation and return a confirm code. The operation executes only after the correct GitHub account confirms it. Always use mode=relayer.

All prepare endpoints return the same shape:

{
"ok": true,
"command": "swap",
"username": "alice",
"confirm_code": "mcp1a2b3c4d",
"instructions": "Swap 50 USDC to WETH in @alice's vault queued.\n\nTo authorize, open:\nhttps://github.com/gitbankio/playground/discussions/4\n\nPost this comment:\n@gitbankbot confirm mcp1a2b3c4d\n\n(Expires in 10 minutes. Only @alice can confirm it.)",
"confirm_url": "https://github.com/gitbankio/playground/discussions/4",
"expires_in_seconds": 600
}

Always show the instructions field verbatim to the user.


GET /api/public/prepare/deposit

GET https://gitbank.io/api/public/prepare/deposit?username=alice&amount=50&token=USDC&mode=relayer
ParamRequiredDescription
usernameyesGitHub username
amountyesHuman-decimal amount (e.g. 50 for 50 USDC, 0.001 for 0.001 WETH)
tokenyesUSDC or WETH
modeyesAlways relayer

GET /api/public/prepare/withdraw

GET https://gitbank.io/api/public/prepare/withdraw?username=alice&amount=50&token=USDC&to=0x1234...&mode=relayer
ParamRequiredDescription
usernameyesGitHub username
amountyesHuman-decimal amount
tokenyesUSDC or WETH
toyesDestination wallet address (EVM)
modeyesAlways relayer

A 0.1% protocol fee applies.


GET /api/public/prepare/swap

GET https://gitbank.io/api/public/prepare/swap?username=alice&amount=50&from_token=USDC&to_token=WETH&mode=relayer
ParamRequiredDescription
usernameyesGitHub username
amountyesHuman-decimal amount of from_token
from_tokenyesUSDC or WETH
to_tokenyesUSDC or WETH (must differ)
modeyesAlways relayer

A 0.3% protocol fee applies.


GET /api/public/prepare/transfer

Send USDC or WETH from one Gitbank vault to another (GitHub-to-GitHub transfer).

GET https://gitbank.io/api/public/prepare/transfer?username=alice&to_username=bob&amount=50&token=USDC&mode=relayer
ParamRequiredDescription
usernameyesSender GitHub username
to_usernameyesRecipient GitHub username
amountyesHuman-decimal amount
tokenyesUSDC or WETH
modeyesAlways relayer

Uses 2-step commit-reveal to prevent front-running. Relayer handles both steps.


Operation Summary

OperationEndpointGas paid byWallet needed
Check balanceGET /vault/by-github/:usernamen/aNo
Deposit USDC/WETHGET /prepare/deposit?...&mode=relayerGitbank relayerNo
Withdraw USDC/WETHGET /prepare/withdraw?...&mode=relayerGitbank relayerNo
Swap USDC <-> WETHGET /prepare/swap?...&mode=relayerGitbank relayerNo
Transfer to another userGET /prepare/transfer?...&mode=relayerGitbank relayerNo
View transactionsGET /transactions/:usernamen/aNo

Orchestration Pattern

1. GET /vault/by-github/:username
-> note vault_address and balances
2. GET /prepare/<operation>?username=<username>&...&mode=relayer
-> confirm_code, instructions, confirm_url
3. Show the user the instructions field verbatim.
Remind them: only their GitHub account can confirm this.
4. User opens confirm_url and posts the comment on GitHub.
5. Gitbank bot verifies identity. If commenter is wrong GitHub user, bot rejects.
6. Bot executes via relayer, posts Basescan tx link in the GitHub thread.
7. Tell the user: "Transaction confirmed. Check the GitHub thread for the Basescan link."

Example Sessions

Check vault balance

What's in my Gitbank vault? GitHub: alice
  1. GET /vault/by-github/alice -> show USDC and WETH balances.

Deposit 100 USDC

Deposit 100 USDC into my Gitbank vault. GitHub: alice.
  1. GET /vault/by-github/alice -> vault_address.
  2. GET /prepare/deposit?username=alice&amount=100&token=USDC&mode=relayer -> instructions.
  3. Show instructions. User confirms on GitHub. Relayer executes. Bot posts Basescan link.

Swap 50 USDC to WETH

Swap 50 USDC to WETH. GitHub: alice.
  1. GET /vault/by-github/alice -> confirm USDC balance >= 50.
  2. GET /prepare/swap?username=alice&amount=50&from_token=USDC&to_token=WETH&mode=relayer.
  3. Show instructions. User confirms on GitHub. Relayer executes Uniswap v3 swap.

Withdraw 50 USDC to wallet

Withdraw 50 USDC from my vault to 0x1234... GitHub: alice.
  1. GET /vault/by-github/alice -> confirm USDC balance >= 50.
  2. GET /prepare/withdraw?username=alice&amount=50&token=USDC&to=0x1234...&mode=relayer.
  3. Show instructions. User confirms. Relayer executes. Done.

Send 10 USDC to another user

Send 10 USDC from my vault to @bob. GitHub: alice.
  1. GET /vault/by-github/alice -> confirm USDC >= 10.
  2. GET /vault/by-github/bob -> confirm bob has a vault.
  3. GET /prepare/transfer?username=alice&to_username=bob&amount=10&token=USDC&mode=relayer.
  4. Alice confirms on GitHub. Relayer executes 2-step transfer. Bob receives 10 USDC.

Security Model

  • GitHub identity is mandatory. Confirm code is bound to a specific GitHub username. Only that account can authorize the operation.
  • No execution before identity check. Prepare endpoint returns only a confirm code. Nothing is signed or executed until the bot verifies via HMAC-signed GitHub webhook.
  • Relayer is the signer. Gitbank relayer holds the execution keypair server-side (AES-256-GCM encrypted). User never holds a private key.
  • Destination locked at prepare time. For withdrawals and transfers, destination is embedded in the prepared transaction and cannot be changed after the confirm code is generated.
  • Soul-bound vaults. gitTokens are non-transferable ERC-20. Cannot be phished or drained via wallet approvals.

Error Handling

HTTPerror fieldAction
400"username and amount are required"Re-prompt user for missing info
400"Invalid destination address"Ask for a valid EVM address
400"Unsupported token. Use USDC or WETH"Clarify token symbol
400"Insufficient balance"Show current balance, ask for lower amount
404"User not found"User needs to sign up at gitbank.io first
429"Rate limit exceeded"Wait 1 hour, inform user

Notes

  • GitHub username lookup is case-insensitive.
  • Vaults auto-deploy on first prepare request. No prior setup required.
  • Confirm codes expire in 10 minutes. If expired, call prepare again for a fresh code.
  • GitVaultFactory on Base Mainnet: 0xAA0a4ff46733EBaE8E658642A1314f18980fc77B
  • For MCP-capable clients (Claude Desktop, Cursor, Windsurf), use https://gitbank.io/api/mcp for richer tool support.