Pollinate: A New Approach to Smart Contract Execution
Flowers need to exchange pollen to fruit, but they are unable to do so on their own, so they use nectar to incentivize bees to do it for them. Pollinate solves two problems with smart contract development.
The Problems with Smart Contract Fees and Execution
- Fees are a major problem for privacy technology because the coins that fund the fee can always be traced.
- Smart contract development is unnecessarily difficult because contracts can only perform computation when someone is transacting with them.
- EVM-based blockchains require everyone to hold some of the base token on every address they use.
- EVM-based blockchains are like a bank that charges an entry fee—it doesn’t matter what you have in the bank (ERC20, NFTs, etc.), you can’t access it if you can’t get in.
The Pollinate Frameworks: Periodic & PayAfter
Pollinate presents two frameworks:
- Periodic: Allows your contract to be invoked on a periodic basis.
- PayAfter: Enables structuring transactions where costs are paid with the proceeds of the transaction (e.g., by selling ERC20 tokens).
How Periodic Works
Periodic uses a difficulty-like retargeting algorithm to decide how much pay to offer the pollinators who run your contract’s periodic function.
To use Periodic, extend the Periodic contract and pass three parameters to its constructor:
- The time between cycles
- The number of cycles per retarget
- The initial cost estimation
Then, implement your periodic() function. After deployment, use PeriodicDispatcher.addNectar() to fund your contract.
For advanced use, your contract can even fund itself by calling Periodic.nectarShortfall() and sending that amount of base token to the PeriodicDispatcher.
How PayAfter Works
To use PayAfter, import the PayAfter TypeScript library and use the provided tools to create a sequence of smart contract calls.
- The UniswapV2Helper contract helps cover the cost of your transaction by selling ERC20 tokens.
- You can use any contract that calls
PayAfterDispatcher.getRequiredFee()and sends that amount of base token to the PayAfterDispatcher contract.
Once you have created your calls:
- Create a fee policy consisting of an offer that increases over time.
- The pollinator that accepts the lowest fee will be the one to land your transaction.
- Sign your transaction package and send it to the pollinators.
Pollinate Technology Stack
- Pollinate Daemon: Written in Rust, runs comfortably on small devices requiring only tens of megabytes of memory.
- Pollinate TypeScript Library: Built with webpack, can be imported in Node.js or used in the browser.
- Pollinate Contracts: Tested and deployed with HardHat.
Availability
The contracts and TypeScript library are available on npm:
🔗 Pollinate Framework on npm
Log in or sign up for Devpost to join the conversation.