Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
db-blockchain-privacy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gk1e17
db-blockchain-privacy
Commits
ecd68d42
Commit
ecd68d42
authored
6 years ago
by
mi3u17
Browse files
Options
Downloads
Patches
Plain Diff
changes to Application.java and to bin file
parent
c0ea7a31
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sample-project-gradle-master/bin/.gitignore
+0
-2
0 additions, 2 deletions
sample-project-gradle-master/bin/.gitignore
sample-project-gradle-master/src/main/java/org/web3j/sample/Application.java
+16
-6
16 additions, 6 deletions
...le-master/src/main/java/org/web3j/sample/Application.java
with
16 additions
and
8 deletions
sample-project-gradle-master/bin/.gitignore
+
0
−
2
View file @
ecd68d42
/logback.xml
/org/
/org/
/solidity/
This diff is collapsed.
Click to expand it.
sample-project-gradle-master/src/main/java/org/web3j/sample/Application.java
+
16
−
6
View file @
ecd68d42
...
@@ -109,6 +109,8 @@ public class Application {
...
@@ -109,6 +109,8 @@ public class Application {
//Check the contract on Etherscan website
//Check the contract on Etherscan website
log
.
info
(
"View contract at https://ropsten.etherscan.io/address/"
+
contractAddress
);
log
.
info
(
"View contract at https://ropsten.etherscan.io/address/"
+
contractAddress
);
// Test some method provided by web3j library
// String adro = contract.getDeployedAddress("1");
// String adro = contract.getDeployedAddress("1");
// String adrt = contract.getDeployedAddress("2");
// String adrt = contract.getDeployedAddress("2");
// String adrtr = contract.getDeployedAddress("3");
// String adrtr = contract.getDeployedAddress("3");
...
@@ -120,13 +122,18 @@ public class Application {
...
@@ -120,13 +122,18 @@ public class Application {
// log.info("Smart Contract deployed to address: " + contractAddress);
// log.info("Smart Contract deployed to address: " + contractAddress);
// log.info("View contract at https://ropsten.etherscan.io/address/" + contractAddress);
// log.info("View contract at https://ropsten.etherscan.io/address/" + contractAddress);
//Add user to the access control list
//Add
authorized
user
s
to the access control list
TransactionReceipt
userone
=
contract
.
addUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
();
TransactionReceipt
userone
=
contract
.
addUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
();
//TransactionReceipt userthree = contract.addUser("0xcdA6722bCf8a428129007e6d3DabfDdC233a0070").send();
TransactionReceipt
usertwo
=
contract
.
addUser
(
"0xbA719536EEDeA5F0eE74469160E03CA709CD7309"
).
send
();
TransactionReceipt
usertwo
=
contract
.
addUser
(
"0xbA719536EEDeA5F0eE74469160E03CA709CD7309"
).
send
();
//TransactionReceipt userthree = contract.addUser("0xcdA6722bCf8a428129007e6d3DabfDdC233a0070").send();
//Get the owners address
log
.
info
(
"Owner: "
+
contract
.
owner
().
send
());
log
.
info
(
"Owner: "
+
contract
.
owner
().
send
());
log
.
info
(
"Access:"
+
contract
.
isUser
(
"0xbA719536EEDeA5F0eE74469160E03CA709CD7309"
).
send
());
//See if a user address is authorized to gain access
log
.
info
(
"Access:"
+
contract
.
isUser
(
"0xcdA6722bCf8a428129007e6d3DabfDdC233a0070"
).
send
());
log
.
info
(
"Is this user authorised to gain access: "
+
contract
.
isUser
(
"0xbA719536EEDeA5F0eE74469160E03CA709CD7309"
).
send
());
log
.
info
(
"Is this user authorised to gain access: "
+
contract
.
isUser
(
"0xcdA6722bCf8a428129007e6d3DabfDdC233a0070"
).
send
());
//Check how many users are now included in the baseData! At the moment must be no user in the baseData storage
log
.
info
(
"Number of Users in the baseData: "
+
contract
.
getUserCount
().
send
());
log
.
info
(
"Number of Users in the baseData: "
+
contract
.
getUserCount
().
send
());
//System.out.println(contract.owner().send());
//System.out.println(contract.owner().send());
...
@@ -135,7 +142,8 @@ public class Application {
...
@@ -135,7 +142,8 @@ public class Application {
// log.info("New User added to the baseData!" + "The number of users now is: " + contract.getUserCount().send()
// log.info("New User added to the baseData!" + "The number of users now is: " + contract.getUserCount().send()
// + " The new user's id is: " + event.userId); }
// + " The new user's id is: " + event.userId); }
//Get and Set User details
//Insert data to the baseData contract storage
//Get and Insert User details
//User #1
//User #1
TransactionReceipt
transactionReceipt
=
contract
.
insertUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
,
"thesis@uos.ac.uk"
,
BigInteger
.
valueOf
(
20
),
"me"
,
BigInteger
.
valueOf
(
1
),
BigInteger
.
valueOf
(
200000
)).
send
();
TransactionReceipt
transactionReceipt
=
contract
.
insertUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
,
"thesis@uos.ac.uk"
,
BigInteger
.
valueOf
(
20
),
"me"
,
BigInteger
.
valueOf
(
1
),
BigInteger
.
valueOf
(
200000
)).
send
();
//User #2
//User #2
...
@@ -151,10 +159,12 @@ public class Application {
...
@@ -151,10 +159,12 @@ public class Application {
//Send the results and print them
//Send the results and print them
//log.info("User Info: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send());
//log.info("User Info: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send());
//Retrieve Data if you are authorised user!
log
.
info
(
"User #:"
+
contract
.
getUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
().
getValue3
()
+
" Info: "
+
contract
.
getUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
());
log
.
info
(
"User #:"
+
contract
.
getUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
().
getValue3
()
+
" Info: "
+
contract
.
getUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
());
//Retrieve single field
log
.
info
(
"User Email: "
+
contract
.
getUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
().
getValue1
());
log
.
info
(
"User Email: "
+
contract
.
getUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
().
getValue1
());
log
.
info
(
"User #:"
+
contract
.
getUser
(
"0xbA719536EEDeA5F0eE74469160E03CA709CD7309"
).
send
().
getValue3
()
+
" Info: "
+
contract
.
getUser
(
"0xbA719536EEDeA5F0eE74469160E03CA709CD7309"
).
send
());
log
.
info
(
"User #:"
+
contract
.
getUser
(
"0xbA719536EEDeA5F0eE74469160E03CA709CD7309"
).
send
().
getValue3
()
+
" Info: "
+
contract
.
getUser
(
"0xbA719536EEDeA5F0eE74469160E03CA709CD7309"
).
send
());
//String name = contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send().getValue0();
log
.
info
(
"User Name: "
+
contract
.
getUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
().
getValue2
());
log
.
info
(
"User Name: "
+
contract
.
getUser
(
"0xFC87F1c9459A4e15731d004EbD923821f89AA007"
).
send
().
getValue2
());
//Get number of users and print it
//Get number of users and print it
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment