Introduction
You can use Web3j-OpenAPI to generate API endpoints based on your Solidity smart contract.
You can then run the generated API server with and send requests to your deployed smart contract.
Step-by-step
Deploy an Ethereum or Quorum node with Chainstack
Deploy an Ethereum node as described in Join a public network.
Deploy a Quorum network as described in Deploy a Quorum network.
Run Web3j-OpenAPI based on your smart contract
Refer to the Web3j-OpenAPI documentation.
Sample walkthrough
Install Epirus CLI:
curl -L get.epirus.io | sh
Import your smart contract into the Epirus project:
epirus openapi import
Provide a path to your smart contract:
Please enter the path to your Solidity file/folder [Required Field]:
/user/project/contract/
Get your RPC endpoint. See View node access and credentials.
Provide the variables to interact with the contract and the network:
export WEB3J_ENDPOINT=RPC_ENDPOINT
export WEB3J_PRIVATE_KEY=PRIVATE_KEY
export WEB3J_OPENAPI_HOST=localhost
export WEB3J_OPENAPI_PORT=9090
where
- RPC_ENDPOINT — the link to your node's RPC endpoint.
- PRIVATE_KEY — the private key of an account through which you interact with the contract, including contract deployment.
Run the API server:
./gradlew run
Access the server at http://localhost:9090/swagger-ui
If you have any questions, feel free to contact Chainstack support by emailing support@chainstack.com or by submitting this form.
Comments
0 comments
Please sign in to leave a comment.