Ethereum
Integrate Ethereum in your Strapi application.
Strapi Plugin Eth
Integrate Ethereum in your Strapi application.
Table Of Content
Requirements
Strapi v4 is required.
Installation
npm install --save strapi-plugin-eth
Plugin Configuration
Add the plugin configuration to ./config/plugins.js
:
1module.exports = ({ env }) => ({
2 eth: {
3 enabled: true,
4 config: {
5 chains: [
6 // this enables ethereum network
7 {
8 network: {
9 name: 'ethereum',
10 chainId: 1,
11 ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
12 },
13 providers: [
14 {
15 url: `https://mainnet.infura.io/v3/${env('INFURA_PROJECT_ID')}`,
16 },
17 ],
18 },
19 // this enables matic network
20 {
21 network: {
22 name: 'matic',
23 chainId: 137,
24 },
25 providers: [
26 {
27 url: `https://polygon-mainnet.infura.io/v3/${env('INFURA_PROJECT_ID')}`,
28 },
29 {
30 url: 'https://polygon-rpc.com',
31 },
32 ],
33 },
34 ],
35 },
36 },
37})
Usage
This plugin exposes a service with the various blockchain providers:
1const ethProviderService = strapi.service('plugin::eth.provider');
2const ethereumProvider = ethProviderService.getProvider(1 /* or 'ethereum' */);
3const maticProvider = ethProviderService.getProvider(137 /* or 'matic' */);
Install now
npm install strapi-plugin-eth
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.