Skip to content

Instantly share code, notes, and snippets.

View Aniket-Engg's full-sized avatar
:octocat:
Doing my bit for Blockchain

Aniket Aniket-Engg

:octocat:
Doing my bit for Blockchain
View GitHub Profile
@Aniket-Engg
Aniket-Engg / calculateHash.js
Created May 27, 2018 08:32
Block Hash calculation
var calculateHashForBlock = (block) => {
return calculateHash(block.index, block.previousHash, block.timestamp, block.data);
};
var calculateHash = (index, previousHash, timestamp, data) => {
return CryptoJS.SHA256(index + previousHash + timestamp + data).toString();
};
@Aniket-Engg
Aniket-Engg / socket.js
Created May 27, 2018 08:34
Exporting Block without ExtraData
export var write = (ws, message) =>
{
if(message.hasOwnProperty('data')){
var temp = JSON.parse(message.data);
if(temp.length == 1)
delete temp[0]['extraData'];
else{
for(var i=1;i<temp.length;i++)
delete temp[i]['extraData'];
}
@Aniket-Engg
Aniket-Engg / EthereumClaimsRegistry.sol
Created June 2, 2018 06:18
Standard Ethereum Claims Registry
contract EthereumClaimsRegistry {
mapping(address => mapping(address => mapping(bytes32 => bytes32))) public registry;
event ClaimSet(
address indexed issuer,
address indexed subject,
bytes32 indexed key,
bytes32 value,
uint updatedAt);
{
"payload": {
"data": {
"config_update": {
"channel_id": "firstchannel",
"isolated_data": {},
"read_set": {
"groups": {
"Application": {
"groups": {
pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol"; // this import is automatically injected by Remix
import "remix_accounts.sol";
import "./Sender.sol";
// Inherit 'Sender' contract
contract SenderTest is Sender {
address account0;
address account1;
address account2;
@Aniket-Engg
Aniket-Engg / File.sol
Created December 9, 2020 12:06
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.4+commit.3f05b770.js&optimize=false&runs=200&gist=
// this line is added to create a gist. Empty file is not allowed.
@Aniket-Engg
Aniket-Engg / File.sol
Created December 9, 2020 13:28
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.4+commit.3f05b770.js&optimize=false&runs=200&gist=
// this line is added to create a gist. Empty file is not allowed.
@Aniket-Engg
Aniket-Engg / File.sol
Created December 9, 2020 13:30
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.4+commit.3f05b770.js&optimize=false&runs=200&gist=
// this line is added to create a gist. Empty file is not allowed.
@Aniket-Engg
Aniket-Engg / README.txt
Created March 15, 2021 06:52
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.1+commit.df193b15.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@Aniket-Engg
Aniket-Engg / README.txt
Created November 28, 2022 07:08
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
REMIX DEFAULT WORKSPACE
Remix default workspace is present when:
i. Remix loads for the very first time
ii. A new workspace is created with 'Default' template
iii. There are no files existing in the File Explorer
This workspace contains 3 directories:
1. 'contracts': Holds three contracts with increasing levels of complexity.