Skip to content

Instantly share code, notes, and snippets.

View eum602's full-sized avatar
🎯
Focusing

Erick Pacheco Pedraza eum602

🎯
Focusing
View GitHub Profile
INTRO TO DHT =====> https://medium.com/unitychain/intro-to-dht-e98425fc05f1
uWebsockets =====> https://github.com/uNetworking/uWebSockets.js
WebService architecture - Golang =====> https://medium.com/@boobo94/web-service-architecture-for-golang-developers-a4147b8141ff
Blockchain reference architecture =====> https://medium.com/@naveenbalani/blockchain-reference-architecture-a3df6643532c
multiblockchain : https://ieeexplore.ieee.org/document/8327114
packaging new software: http://packaging.ubuntu.com/html/packaging-new-software.html
Raft consensus algorithm : https://www.google.com/amp/s/www.geeksforgeeks.org/raft-consensus-algorithm/amp/
BOOK ethereum2.0 ==> https://lighthouse-book.sigmaprime.io/
eth 2.0 specs ==> https://github.com/ethereum/eth2.0-specs
internet whitepaper: https://web.stanford.edu/class/msande91si/www-spr04/readings/week1/InternetWhitepaper.htm
@eum602
eum602 / etherSending.js
Created November 26, 2020 21:02
Example of how to send ethers in ethereum
web3 = new Web3...
privKey=...
txObject = {
nonce: web3.utils.toHex(txnCount),
gasPrice: web3.utils.toHex(0),
gasLimit: web3.utils.toHex(parseInt(MAX_GAS_PER_TX)),
to: addressTo,
value: web3.utils.toHex(web3.utils.toWei(valueInEther, 'ether')),
data
};
@eum602
eum602 / set.sol
Created November 26, 2020 21:09
Example of solidity function to set a value
function setValue(uint _amount) public {
emit stored(msg.sender, _amount);
_value = _amount;
_sender = msg.sender;
}
@eum602
eum602 / createStruct.sol
Last active November 28, 2020 18:53
A method to add a struct in a smart contract - solidity
function addNewUser(bytes32 hash, bytes32 id, uint startDate, uint exp, uint sex, uint8 age, bytes6 user_hash, StatusCode code, Hobbies hbobbies) external returns(bool) {
CustomDataType storage user = registry[hash][msg.sender];
require(user.id==0,"User already exists");
//******This is only an example ******
user.id = id;
user.startDate = startDate;
user.iat = now*1000;
user.exp = exp;
user.sex = sex;
user.age = age;
@eum602
eum602 / genesis.json
Last active November 26, 2020 21:55
A genesis block compliant with IBFT2 consensus protocol
{
"config" : {
"chainId" : 2018,
"constantinoplefixblock" : 0,
"ibft2" : {
"blockperiodseconds" : 2,
"epochlength" : 30000,
"requesttimeoutseconds" : 4
}
},
@eum602
eum602 / genesis.json
Created November 28, 2020 16:56
genesis file - ibft - 16
{
"config" : {
"chainId" : 2018,
"constantinoplefixblock" : 0,
"ibft2" : {
"blockperiodseconds" : 2,
"epochlength" : 30000,
"requesttimeoutseconds" : 4
}
},
@eum602
eum602 / main.js
Created January 2, 2022 00:43
Listen events
const Web3 = require('web3');
let web3 = new Web3('ws://localhost:8546');
//console.log(web3);
var subscription = web3.eth.subscribe('logs', {
address: '0x77Db09300A503F5b4828dC12b57659c6ba945Cff',
topics: ['0x9ec8254969d1974eac8c74afb0c03595b4ffe0a1d7ad8a7f82ed31b9c8542591']
}, function(error, result){
if (!error)
classDiagram
http_service_runner o-- AppDependencies
http_service_runner o-- getDefaultAppDependenciesAsync
http_swap_service_runner o-- getDefaultAppDependenciesAsync
http_swap_service_runner o-- AppDependencies
http_service_runner o-- SwapRouter
http_swap_service_runner o-- SwapRouter
SwapRouter o-- SwapHandlers
SwapHandlers o-- SwapService
SwapService o-- SwapQuoter
@eum602
eum602 / gist:2083ee109fc8f558f3e69eceaa934701
Created February 24, 2024 18:30
Proxy Pattern Openzeppelin 2024
classDiagram
Proxy <|-- ERC1967Proxy
ERC1967Utils --o ERC1967Proxy
ERC1967Proxy <|-- TransparentUpgradeableProxy
Ownable <|-- ProxyAdmin
TransparentUpgradeableProxy o-- ProxyAdmin
Proxy <|-- BeaconProxy
BeaconProxy o-- IBeacon
https://www.w3.org/TR/vc-data-integrity/#relationship-to-verifiable-credentials
created, expires, validFrorm and validUntil