This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // My First Smart Contract | |
| pragma solidity >0.5.0; | |
| contract HelloWorld { | |
| function get()public pure returns (string memory){ | |
| return 'Hello Contracts'; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity ^0.5.8; | |
| contract ChocoLavaBank { | |
| uint8 private clientCount; | |
| mapping (address => uint) private balances; | |
| address public owner; | |
| // Log the event about a deposit being made by an address and its amount | |
| event LogDepositMade(address indexed accountAddress, uint amount); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express') | |
| const app = express() | |
| app.get('/', (req, res) => { | |
| res.send('Hello World!') | |
| }) | |
| app.listen(8000, () => { | |
| console.log(`Example app listening at http://localhost:${8000}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SMART CONTRACT CONFIG | |
| let fs = require("fs"); | |
| let Web3 = require('web3'); // https://www.npmjs.com/package/web3 | |
| // Create a web3 connection to a running geth node over JSON-RPC running at | |
| // http://localhost:7545 | |
| let web3 = new Web3(); | |
| web3.setProvider(new web3.providers.HttpProvider('http://localhost:7545')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.get('/getBalance', (req, res) => { // new | |
| var myContract = new web3.eth.Contract(contracts.abi, process.env.CONTRACTS_ADDRESS, { | |
| from: req.query.account_id, // default from address | |
| gasPrice: '3000000' // default gas price in wei, 20 gwei in this case | |
| }); | |
| myContract.methods.balance().call({from: req.query.account_id,gasPrice: '3000000'}) | |
| .then(function(result){ | |
| console.log(result+' wei') | |
| res.header('Access-Control-Allow-Origin', "*"); | |
| res.header('Access-Control-Allow-Headers', "*"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| admin: | |
| address: | |
| socket_address: | |
| address: 0.0.0.0 | |
| port_value: 9901 | |
| static_resources: | |
| listeners: | |
| - name: listener_0 | |
| address: | |
| socket_address: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const bodyParser= require('body-parser') | |
| const express = require('express') | |
| const app = express() | |
| const port = 80 | |
| var PROTO_PATH = __dirname + '/../../protos/helloworld.proto'; | |
| const protobuf = require('protobufjs'); | |
| app.use(bodyParser.json({ | |
| verify: (req, res, buf) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var PROTO_PATH = __dirname + '/../../protos/helloworld.proto'; | |
| var parseArgs = require('minimist'); | |
| var grpc = require('@grpc/grpc-js'); | |
| var protoLoader = require('@grpc/proto-loader'); | |
| var packageDefinition = protoLoader.loadSync( | |
| PROTO_PATH, | |
| {keepCase: true, | |
| longs: String, | |
| enums: String, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax = "proto3"; | |
| option java_multiple_files = true; | |
| option java_package = "io.grpc.examples.helloworld"; | |
| option java_outer_classname = "HelloWorldProto"; | |
| option objc_class_prefix = "HLW"; | |
| package helloworld; | |
| // The greeting service definition. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.shedlockdemo; | |
| import com.authzed.api.v1.Core; | |
| import com.authzed.api.v1.PermissionService; | |
| import com.authzed.api.v1.PermissionsServiceGrpc; | |
| import com.authzed.grpcutil.BearerToken; | |
| import io.grpc.ManagedChannel; | |
| import io.grpc.ManagedChannelBuilder; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; |
OlderNewer