To verify the contract functionality, follow these steps:
-
Generate a wallet on Citrea and store the private key for later use in Hardhat.
-
Modify the following file to include your wallet address:
citrea/resources/genesis/bitcoin-regtest/evm.json
-
Add your wallet address along with balance and code fields as shown below:
Example:
{ "address": "0x8DcEe565A537b71594f754e42B7E863F5Ff7761B", "balance": "0xffffffffffffffff", "code": "0x" }
After ensuring that Bitcoin Regtest and the Citrea Sequencer are running without issues, set up Hardhat (or any other deployment tool of your choice) and deploy the Briber Brother contract using the following commands:
npm install
npx hardhat compile
npx hardhat ignition deploy ./ignition/modules/BasicDeploymentsModule.js --network citrea
- Once the contract is deployed, the previously created Citrea wallet address can be indexed.
- Any transaction to be included in a block can be recorded in the contract along with:
- The bribe amount
- An IPFS link
- This recording action triggers an event, which miners can monitor to track incentivized transactions.
Once the incentivized transaction is successfully included in a Bitcoin block:
- The coinbase transaction should contain an OP_RETURN output that includes the index of the wallet address.
- The
bribeMe
function should then be called with the correct parameters to transfer the bribe amount to the indexed address.
Helper scripts written in Python can be used to generate the required parameters for the bribeMe
function of the contract. These scripts provide the following functionalities:
- Merkle proof generation and verification
- Raw transaction parsing
- Block header creation
Using these scripts, you can verify the parameters before submitting them to the contract.
- If any parameter is incorrect or modified, the
bribeMe
function should fail, ensuring the integrity of the process.