Skip to content

Azure WebJobs Extension providing trigger bindings to interact with web3-compatible blockchain event.

Notifications You must be signed in to change notification settings

0xys/WebJobs.Extensions.Web3

Repository files navigation

Web3 Extension for Azure Functions

This extension provides trigger bindings in Microsoft Azure Functions, allowing you to interact with web3-compatible blockchain event frictionlessly, powered by Web3 Provider of Nethereum project. Currently, following trigger is actively developed.

  • BlockTrigger: triggered by ethereum block event.

Usage

BlockTrigger

// Set endpoint URL inline
[FunctionName("Function1")]
public static async Task Run([Web3BlockTrigger("https://mainnet.infura.io/v3/<YOUR_PROJECT_ID>")] BlockWithTransactions block, ILogger log)
{
    log.LogInformation($"Block[{block.Number}, {block.BlockHash}], tx: {block.Transactions.Length}");
}

// Set endpoint from config file
[FunctionName("Function2")]
public static async Task Run([Web3BlockTrigger("%EthereumEndpoint%")] BlockWithTransactions block, ILogger log)
{
    log.LogInformation($"Block[{block.Number}, {block.BlockHash}], tx: {block.Transactions.Length}");
}

// Set required number of blocks to confirm. default to 12 if unset.
[FunctionName("Function3")]
public static async Task Run([Web3BlockTrigger("%EthereumEndpoint%", 30)] BlockWithTransactions block, ILogger log)
{
    log.LogInformation($"Block[{block.Number}, {block.BlockHash}], tx: {block.Transactions.Length}");
}

About

Azure WebJobs Extension providing trigger bindings to interact with web3-compatible blockchain event.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages