Prerequisites
Before you begin, make sure you have:
- A GitHub repository where you want to integrate BACON
- Node.js 16+ or Python 3.8+ installed
- A wallet on your chosen blockchain (Bitcoin or Solana)
- Basic understanding of blockchain concepts
Installation
Option 1: Node.js / JavaScript
npm install @blt-bacon/sdk
Or with Yarn:
yarn add @blt-bacon/sdk
Option 2: Python
pip install blt-bacon
Option 3: GitHub Action
Add to your .github/workflows/bacon-rewards.yml:
name: BACON Rewards
on:
issues:
types: [opened, closed]
pull_request:
types: [opened, merged]
jobs:
reward:
runs-on: ubuntu-latest
steps:
- uses: OWASP-BLT/bacon-action@v1
with:
blockchain: 'bitcoin'
github-token: ${{ secrets.GITHUB_TOKEN }}
bacon-key: ${{ secrets.BACON_PRIVATE_KEY }}
Quick Start Guide
1
Initialize BACON SDK
Create a configuration file for your blockchain of choice:
// bacon.config.js
module.exports = {
blockchain: 'bitcoin', // or 'solana'
network: 'mainnet',
rewards: {
issueOpened: 10,
pullRequestMerged: 50,
issueResolved: 100,
codeReview: 25
},
wallet: {
address: process.env.BACON_WALLET_ADDRESS
}
};
2
Set Up Webhook Handler
Create a webhook endpoint to receive GitHub events:
const BaconSDK = require('@blt-bacon/sdk');
const config = require('./bacon.config');
const bacon = new BaconSDK(config);
// Initialize and start listening
bacon.initialize().then(() => {
bacon.on('issue.opened', async (event) => {
await bacon.reward(event.user, config.rewards.issueOpened);
});
bacon.on('pull_request.merged', async (event) => {
await bacon.reward(event.user, config.rewards.pullRequestMerged);
});
bacon.start({ port: 3000 });
});
3
Configure GitHub Webhook
In your GitHub repository settings:
- Go to Settings → Webhooks → Add webhook
-
Set Payload URL to your server endpoint (e.g.,
https://your-domain.com/webhook) -
Set Content type to
application/json - Select individual events: Issues, Pull requests
- Add webhook
4
Test Your Integration
Create a test issue in your repository to verify rewards are working:
# Check reward distribution bacon-cli status # View transaction history bacon-cli transactions --limit 10 # Check user balance bacon-cli balance --user username
Configuration Options
Reward Rules
Customize reward amounts for different actions:
rewards: {
// Issue-related
issueOpened: 10,
issueResolved: 100,
// Pull requests
pullRequestMerged: 50,
pullRequestReviewed: 25,
// Contributions
commitPushed: 5,
releasePublished: 200
}
Blockchain Configuration
Choose between Bitcoin and Solana:
// Bitcoin
{
blockchain: 'bitcoin',
network: 'mainnet'
}
// Solana
{
blockchain: 'solana',
network: 'mainnet-beta'
}