Skip to content

Commit

Permalink
re-org contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuafernandes committed Aug 29, 2023
1 parent 967321c commit e4cfc5a
Show file tree
Hide file tree
Showing 25 changed files with 66 additions and 2,082 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,22 @@ the container's user 1000 to your local user id so permissions will work like so
image: some:img
user: $(id -u):$(id -g)
```


# TODO

1. Besu _ concurrent_tx
```
jfernandes@xps:~/workspace/protocols/quorum-dev-quickstart/besu-test-network/smart_contracts(master)$ node scripts/privacy/concurrent_private_txs.js
TypeError: Tx is not a constructor
at sendPMT (/home/jfernandes/workspace/protocols/quorum-dev-quickstart/besu-test-network/smart_contracts/scripts/privacy/concurrent_private_txs.js:60:14)
at /home/jfernandes/workspace/protocols/quorum-dev-quickstart/besu-test-network/smart_contracts/scripts/privacy/concurrent_private_txs.js:114:18
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
This example requires ONCHAIN privacy to be DISABLED.
Check config for ONCHAIN privacy groups.
```

2, Besu _ grafana dash broken

3. Goq Grafana _ dash broken as well?
24 changes: 0 additions & 24 deletions files/besu/dapps/pet-shop/custom_config/truffle-config.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ module.exports = {
publicKey: "1iTZde/ndBHvzhcl7V68x44Vx7pl8nwx9LqnM/AfJUg=",
},
},
besu: {
quorum: {
rpcnode: {
name: "rpcnode",
url: "http://127.0.0.1:8545",
wsUrl: "ws://127.0.0.1:8546",
nodekey:
"0e93a540518eeb673d94fb496b746008ab56605463cb9212493997f5755124d1",
accountAddress: "c9c913c8c3c1cd416d80a0abf475db2062f161f6",
accountPrivateKey:
"0x60bbe10a196a4e71451c0f6e9ec9beab454c2a5ac0542aa5b8b733ff5719fec3",
},
member1: {
name: "member1",
url: "http://127.0.0.1:20000",
Expand Down Expand Up @@ -46,10 +56,6 @@ module.exports = {
accountPrivateKey:
"61dced5af778942996880120b303fc11ee28cc8e5036d2fdff619b5675ded3f0",
},
ethsignerProxy: {
url: "http://127.0.0.1:18545",
accountAddress: "9b790656b9ec0db1936ed84b3bea605873558198",
},
},
accounts: {
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Web3 = require("web3");
const Web3Quorum = require("web3js-quorum");
const Tx = require("ethereumjs-tx");
const PromisePool = require("async-promise-pool");
const { tessera, besu } = require("./keys.js");
const { tessera, besu } = require("../keys.js");

const chainId = 1337;
const web3 = new Web3Quorum(new Web3(besu.member1.url), chainId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const Web3 = require("web3");
const Web3Quorum = require("web3js-quorum");

// WARNING: the keys here are demo purposes ONLY. Please use a tool like EthSigner for production, rather than hard coding private keys
const { tessera, besu } = require("./keys.js");
const { tessera, besu } = require("../keys.js");
const chainId = 1337;
// abi and bytecode generated from simplestorage.sol:
// > solcjs --bin --abi simplestorage.sol
const contractJsonPath = path.resolve(
__dirname,
"../",
"../../",
"contracts",
"SimpleStorage.json"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const Web3 = require("web3");
const Web3Quorum = require("web3js-quorum");

// WARNING: the keys here are demo purposes ONLY. Please use a tool like EthSigner for production, rather than hard coding private keys
const { tessera, besu } = require("./keys.js");
const { tessera, besu } = require("../keys.js");
const chainId = 1337;
// abi and bytecode generated from simplestorage.sol:
// > solcjs --bin --abi simplestorage.sol
const contractJsonPath = path.resolve(
__dirname,
"../",
"../../",
"contracts",
"SimpleStorage.json"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const fs = require('fs-extra');
const Web3 = require('web3');

// member1 details
const { tessera, besu, accounts } = require("./keys.js");
const host = besu.member1.url;
const { tessera, quorum, accounts } = require("../keys.js");
const host = quorum.rpcnode.url;

async function main(){
const web3 = new Web3(host);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ const fs = require("fs-extra");
const Web3 = require("web3");

// member1 details
const { tessera, besu } = require("./keys.js");
const host = besu.member1.url;
const accountAddress = besu.member1.accountAddress;
const { tessera, quorum } = require("../keys.js");
const host = quorum.rpcnode.url;
const accountAddress = quorum.rpcnode.accountAddress;

// abi and bytecode generated from simplestorage.sol:
// > solcjs --bin --abi simplestorage.sol
const contractJsonPath = path.resolve(
__dirname,
"../",
"../../",
"contracts",
"SimpleStorage.json"
);
Expand Down Expand Up @@ -48,9 +48,11 @@ async function getAllPastEvents(
fromBlock: 0,
toBlock: "latest",
});

const amounts = res.map((x) => {
return x.returnValues._amount;
});

console.log(
"Obtained all value events from deployed contract : [" + amounts + "]"
);
Expand All @@ -66,32 +68,18 @@ async function setValueAtAddress(
deployedContractAddress
) {
const web3 = new Web3(host);
const account = web3.eth.accounts.create();
// console.log(account);
const contract = new web3.eth.Contract(deployedContractAbi);
// eslint-disable-next-line no-underscore-dangle
const functionAbi = contract._jsonInterface.find((e) => {
return e.name === "set";
});
const functionArgs = web3.eth.abi
.encodeParameters(functionAbi.inputs, [value])
.slice(2);
const functionParams = {
to: deployedContractAddress,
data: functionAbi.signature + functionArgs,
gas: "0x2CA51", //max number of gas units the tx is allowed to use
};
const signedTx = await web3.eth.accounts.signTransaction(
functionParams,
account.privateKey
);
console.log("sending the txn");
const txReceipt = await web3.eth.sendSignedTransaction(
signedTx.rawTransaction
const contractInstance = new web3.eth.Contract(
deployedContractAbi,
deployedContractAddress
);
console.log("tx transactionHash: " + txReceipt.transactionHash);
console.log("tx contractAddress: " + txReceipt.contractAddress);
return txReceipt;
const res = await contractInstance.methods
.set(value)
.send({ from: accountAddress, gasPrice: "0x0", gasLimit: "0x24A22" });
console.log("Set value on contract at : " + res.transactionHash);
// verify the updated value
// const readRes = await contractInstance.methods.get().call();
// console.log("Obtained value at deployed contract is: "+ readRes);
return res;
}

async function createContract(host) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ const fs = require('fs-extra');
var ethers = require('ethers');

// member1 details
const { tessera, besu } = require("./keys.js");
const host = besu.member1.url;
const accountAddress = besu.member1.accountAddress;
const { tessera, quorum } = require("../keys.js");
const host = quorum.rpcnode.url;
const accountAddress = quorum.rpcnode.accountAddress;

// abi and bytecode generated from simplestorage.sol:
// > solcjs --bin --abi simplestorage.sol
const contractJsonPath = path.resolve(__dirname, '../','contracts','SimpleStorage.json');
const contractJsonPath = path.resolve(__dirname, '../../','contracts','SimpleStorage.json');
const contractJson = JSON.parse(fs.readFileSync(contractJsonPath));
const contractAbi = contractJson.abi;
const contractBytecode = contractJson.evm.bytecode.object
Expand Down
File renamed without changes.
27 changes: 0 additions & 27 deletions files/goquorum/dapps/pet-shop/custom_config/truffle-config.js

This file was deleted.

Loading

0 comments on commit e4cfc5a

Please sign in to comment.