Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
org.web3j.corda:web3j-corda-api
Advanced tools
Web3j Corda RPC and Network Map APIs for the Corda blockchain platform.
web3j-corda is a lightweight client library for working with CorDapps and interacting with different nodes on Corda networks.
There is a web3j-corda binary that allows you to easily:
You can install web3j-corda by running the following command in your terminal:
curl -L https://getcorda.web3j.io | bash
To generate a template CorDapp project with the client wrappers:
web3j-corda new --name=<corDappName> --output-dir=<output-dir> --package-name=<packageName>
To generate a web3j-corda client wrappers to existing CorDapps:
web3j-corda generate (--url=<openApiUrl> | --cordapps-dir=<corDapps-dir>) --output-dir=<output-dir> --package-name=<packageName>
For further instructions, head to the Examples section in the docs.
Add the relevant dependency to your project:
<dependency>
<groupId>org.web3j.corda</groupId>
<artifactId>web3j-corda-core</artifactId>
<version>0.2.8</version>
</dependency>
dependencies {
implementation 'org.web3j.corda:web3j-corda-core:0.2.8'
}
Initialise a connection, and create our Corda client service:
val service = CordaService("http://localhost:9000/") // URL exposed by Corda OpenAPI connector
val corda = Corda.build(service)
Obtain all the nodes connected to the current node:
val nodes = corda.api.network.nodes.findAll()
To query the list of all running CorDapps:
val corDapps = corda.api.corDapps.findAll()
To start a flow there are two option depending on whether you want to use a generated CorDapp wrapper or just the Corda API directly:
This way works but is not type-safe, so can lead to runtime exceptions:
// Initialise the parameters of the flow
val params = InitiatorParameters("$1", "O=PartyA, L=London, C=GB", false)
val issue = corda.api
.corDapps.findById("obligation-cordapp")
.flows.findById("issue-obligation")
// Type-conversions with potential runtime exception!
var signedTx = issue.start(parameters).convert<SignedTransaction>()
By using a wrapper generated by the web3j-corda
Command-Line Tool,
you can interact with your CorDapp in a type-safe way:
// Initialise the parameters of the flow
val params = InitiatorParameters("$1", "O=PartyA, L=London, C=GB", false)
// Start the flow with typed parameters and response
val signedTx = Obligation.load(corda.service).flows.issue.start(parameters)
The project documentation portal is available here.
To build and serve the docs locally, you will need to have Pipenv installed. Then simply run:
pipenv install
pipenv run mkdocs serve
Web3 Labs maintain web3j-corda. If you'd like to get in touch, please email us.
FAQs
Web3j Corda RPC and Network Map APIs for the Corda blockchain platform.
We found that org.web3j.corda:web3j-corda-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.