Skip to content

Commit

Permalink
added Java sendAndRecieve
Browse files Browse the repository at this point in the history
  • Loading branch information
parisyup committed Jul 3, 2024
1 parent db38f41 commit d13dddc
Show file tree
Hide file tree
Showing 43 changed files with 2,867 additions and 0 deletions.
10 changes: 10 additions & 0 deletions java-samples/sendAndRecieveTransaction/.ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@Library('[email protected]') _

cordaPipeline(
nexusAppId: 'com.corda.CSDE-Java.5.0',
publishRepoPrefix: '',
slimBuild: true,
runUnitTests: false,
dedicatedJobForSnykDelta: false,
slackChannel: '#corda-corda5-dev-ex-build-notifications'
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@Library('[email protected]') _

cordaSnykScanPipeline (
snykTokenId: 'r3-snyk-corda5',
snykAdditionalCommands: "--all-sub-projects -d"
)
86 changes: 86 additions & 0 deletions java-samples/sendAndRecieveTransaction/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

# Eclipse, ctags, Mac metadata, log files
.classpath
.project
.settings
tags
.DS_Store
*.log
*.orig

# Created by .ignore support plugin (hsz.mobi)

.gradle
local.properties
.gradletasknamecache

# General build files
**/build/*

lib/quasar.jar

**/logs/*

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio

*.iml

## Directory-based project format:
.idea/*.xml
.idea/.name
.idea/copyright
.idea/inspectionProfiles
.idea/libraries
.idea/shelf
.idea/dataSources
.idea/markdown-navigator
.idea/runConfigurations
.idea/dictionaries


# Include the -parameters compiler option by default in IntelliJ required for serialization.
!.idea/codeStyleSettings.xml


## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
**/out/
/classes/



# vim
*.swp
*.swn
*.swo



# Directory generated during Resolve and TestOSGi gradle tasks
bnd/

# Ignore Gradle build output directory
build
/.idea/codeStyles/codeStyleConfig.xml
/.idea/codeStyles/Project.xml



# Ignore Visual studio directory
bin/



*.cpi
*.cpb
*.cpk
workspace/**

# ingore temporary data files
*.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="DebugCorDapp" type="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="5005" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />
</configuration>
</component>
14 changes: 14 additions & 0 deletions java-samples/sendAndRecieveTransaction/.snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
SNYK-JAVA-ORGJETBRAINSKOTLIN-2393744:
- '*':
reason: >-
This vulnerability relates to information exposure via creation of
temporary files (via Kotlin functions) with insecure permissions.
Corda does not use any of the vulnerable functions so it is not
susceptible to this vulnerability
expires: 2023-10-19T17:15:26.836Z
created: 2023-02-02T17:15:26.839Z
patch: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
CMD ["python3", "app.py"]
84 changes: 84 additions & 0 deletions java-samples/sendAndRecieveTransaction/FlowManagementUI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Corda 5 CorDapp Flow Management Tool


This user guide provides step-by-step instructions on using the Corda 5 flow management tool. This article will help you learn how to connect the running corDapp, make flow calls, configure flow queries, and retrieve results.

## Prerequisites
* Install and run Python and Flask framework. link.

* Prepare your local Corda 5 environment. (By default, the Flow Management Tool is looking to connect to https://localhost:8888/api/v5_2/swagger#/ with Login: Admin and Password: Admin.)

* Clong the Flow Management Tool repository. FlowManagementUI: main

## Set Up

1. Assuming your local Corda 5 environment is populated and the swagger endpoint is at: https://localhost:8888/api/v5_2/swagger#/

2. Navigate to where you downloaded the Corda 5 Flow Management Tool

3. To run the framework
* Navigate to the file name using cd command.
* use the python app.py command to run it.
![image](https://github.com/parisyup/FlowManagementUI/assets/51169685/f0c3bf59-8180-48a0-91cc-80f2d260e530)

* Later on, click on the IP Address which will open the Interface:

![image(4)](https://github.com/parisyup/FlowManagementUI/assets/66366646/8d88e37c-edbb-4d6d-8bcd-d773e818a106)


The Flow Management Tool should be automatically connected with the CorDapp running locally from your CSDE. You can test the connection by click on the dropdown list at the Flow Initiator section. You should be able to see the vNodes of your started CorDapp from CSDE.

![image](https://github.com/parisyup/FlowManagementUI/assets/51169685/5a2356f2-cd14-489c-abd0-4afe0bf0d251)

## Set Up With Docker

1- Open up Command Prompt

2- Navigate to the application folder using the CD commands

3- Ensure that Docker application is open and build the image using the following command:
`docker build -t your-image-name .`

Make sure to include the dot at the end of the command

the `your-image-name` at the end of the command can be whatever you like but make sure to use the same name in the next step

4- Run the docker image using the following command:
`docker run --rm -it --expose 8888 -p 5000:5000 your-image-name`

5- You can access the website by using https://localhost:5000 or https://127.0.0.1:5000

## Using the Flow Management Tool

### Selecting the Flow Initiator

As the first step of using the Flow Management Tool, you would need to select the Flow Initiator. The Flow Initiator indicates which vNode will be triggering the flow. If you wish to have Alice to run a transaction to Bob, select the X500Name of Alice. The selected vNode’s shortHash (Corda 5 Network participant identifier) will also be shown below the dropdown list to signify your selection.

### Function 1: To Make a Flow Call

1. Click on "Flow Call" tab in the application.
2. Paste the your JSON format request body into the request input box.
3. Click Post button to trigger the call.

![image(5)](https://github.com/parisyup/FlowManagementUI/assets/66366646/c65195a6-0a70-4354-804e-37884f657746)


### Function 2: To Configure Flow Query

1. Click on the “Flow Query” tab.
2. Choose whether to query a single flow or all flows at the selected Flow Initiator.
3. If you choose to query all of the flows, select “Query All Flows“ then click “Get“.

![image](https://github.com/parisyup/FlowManagementUI/assets/51169685/0482cfa4-7ee1-42f2-8786-2d8ad80b2936)
4. If you choose to query a single flow, select “Query Single Flow“, please add the ClientID in specified filed.
5. Click on “Get” to retrieve the result.

![image(6)](https://github.com/parisyup/FlowManagementUI/assets/66366646/13e979b0-f76e-4f2c-9d55-81be8880890b)

If you have any suggestions or questions, feel free to give us your feedback through Github for a better experience in the future!

## Conclusion
In summary, our project introduces a specialized flow management layer on top of Swagger for Corda developers. We understand the challenges developers face in testing Corda applications due to the complexity of commands, our solution focuses on simplifying the process.

Our all-in-one flow management system provides developers with a unified platform, streamlining development and enhancing efficiency. A key feature allows developers to run flows directly from an externally developed website and monitor their status in real-time, offering a user-friendly and practical solution for Corda developers. Overall, our project aims to make Corda development more accessible and tailored to the specific needs of flow management.

12 changes: 12 additions & 0 deletions java-samples/sendAndRecieveTransaction/FlowManagementUI/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from flask import Flask
from flask import render_template
app = Flask(__name__)


@app.route('/')
def home(): # put application's code here
return render_template("index.html")

if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flask
Loading

0 comments on commit d13dddc

Please sign in to comment.