ethereum

calling smart contracts methods using web3 ethereum

时光总嘲笑我的痴心妄想 提交于 2019-11-30 09:20:30
Trying to work around the blockchain using Ethereum, I'm facing problems when trying to interface with a deployed contract. What I would try to achieve is to call a method to display information added to a private blockchain deployed locally using Geth. I can't call any function from my smart contract and I've been wondering if I'm doing something wrong... Could someone tell me how to achieve a simple call to one of the method from this contract? let say display the existing agencies, or the agency name from which the user is part of. My contract: agency.sol pragma solidity ^0.4.18; // We have

How to authenticate and send contract method using web3.js 1.0

馋奶兔 提交于 2019-11-30 05:26:27
I am confused about how I should be executing a contract's method using the web3 1.0 library. This code works (so long as I manually unlock the account first): var contract = new web3.eth.Contract(contractJson, contractAddress); contract.methods .transfer("0x0e0479bC23a96F6d701D003c5F004Bb0f28e773C", 1000) .send({ from: "0x2EBd0A4729129b45b23aAd4656b98026cf67650A" }) .on('confirmation', (confirmationNumber, receipt) => { io.emit('confirmation', confirmationNumber); }); I get this error (if I don't unlock manually first): Returned error: authentication needed: password or unlock The above code

Where do smart contracts reside in blockchain (Ethereum or Hyperledger)

你离开我真会死。 提交于 2019-11-30 02:07:16
So, let us consider a typical trade finance process flow. Exporter deploys a contract that has conditions of the shipment and a hash is generated once the deployment is finished. Questions: 1) Where is the contract stored? 2) How other participants such as customs and importer can access this contract? 3) Can we activate participant level access to the contract on the blockchain? There are several aspects to Ethereum and Hyperledger which make them quite different. Let me give a somewhat simplified answer to not get into too much details and a too long answer. First of all, Ethereum is

Best practice to save files in blockchain

扶醉桌前 提交于 2019-11-29 10:28:49
问题 What is the best practice to save files as part of a blockchain's data? I have tremendously large files to be saved. Can't we save these file on cloud storage (centralized solution like dropbox), and link them with blockchain data using a file hash? Or is it better to use a distributed file storage like IPFS? Or is there any better solution in term of security, volume, performance, and fault tolerance. 回答1: You do not want to directly use a traditional blockchain. Blockchains are good for

How to authenticate and send contract method using web3.js 1.0

白昼怎懂夜的黑 提交于 2019-11-29 03:56:24
问题 I am confused about how I should be executing a contract's method using the web3 1.0 library. This code works (so long as I manually unlock the account first): var contract = new web3.eth.Contract(contractJson, contractAddress); contract.methods .transfer("0x0e0479bC23a96F6d701D003c5F004Bb0f28e773C", 1000) .send({ from: "0x2EBd0A4729129b45b23aAd4656b98026cf67650A" }) .on('confirmation', (confirmationNumber, receipt) => { io.emit('confirmation', confirmationNumber); }); I get this error (if I

Where do smart contracts reside in blockchain (Ethereum or Hyperledger)

China☆狼群 提交于 2019-11-28 22:17:40
问题 So, let us consider a typical trade finance process flow. Exporter deploys a contract that has conditions of the shipment and a hash is generated once the deployment is finished. Questions: 1) Where is the contract stored? 2) How other participants such as customs and importer can access this contract? 3) Can we activate participant level access to the contract on the blockchain? 回答1: There are several aspects to Ethereum and Hyperledger which make them quite different. Let me give a somewhat

Ethereum 笔记

匆匆过客 提交于 2019-11-28 19:19:08
Ethereum notes 以太坊 1.账户 以太坊有两种账户类型: 外部账户之间可以相互转账,进行价值转移;外部账户到合约账户的消息会触发合约代码的执行。 账户结构: nonce: 若是外部账户,nonce表示交易序号;若是合约账户,nonce表示合约序号 balance:账户余额 storageRoot:外部账户此项为空;对合约账户,为MPT树根节点Hash,MPT树中保存合约中的相关变量 codeHash:外部账户此项为空字符串Hash;合约账户此项为合约代码Hash值 2.区块结构 以太坊区块头包含了以下这些字段: 以太坊区块链数据的存取涉及到四棵树: 状态树:保存以太坊网络中所有账户的状态,全局唯一 交易树:包含了一个区块中所有的交易信息,每个区块都有一个交易树 收据树:记录此区块中所有交易完成后生成的收据列表,每个区块都有一个收据树 存储树:保存智能合约中涉及到的数据,是状态树的一个子树,仅智能合约账户下跟有存储树 以太坊区块链数据持久化保存在levelDB中,区块中只保存Header中的内容,三个树存在于内存中,账户状态的改变首先会在树上更新,之后再将树的内容写入数据库。 3. MPT树 (1) Merkle tree ​ 将数据分块,每块分别计算Hash,得到数据块Hash后将Hash两两组合,计算组合字符串的Hash(落单的Hash值直接对其再进行一次Hash)

ethereum入门-简介

戏子无情 提交于 2019-11-26 00:34:11
ethereum 一个区块链应用平台,可以构建不会宕机的应用程序 以太坊是一个去中心平台,可以运行智能合约:应用程序按照既定程序运行,不会出现停机,审查,欺诈或第三方干扰的可能性。这些应用运行在定制的区块链上,这是一个功能强大的共享全球基础设施,可以转移价值并代表财产的所有权。 这使开发商能够创建市场,存储债务或承诺的档案册,根据过去很长时间的指示(如遗嘱或期货合同)以及还没有发明的许多其他事物来转移资金,所有这些都没有中间人或 交易对手风险。 在传统的服务器体系结构中,每个应用程序都必须设置自己的服务器,这些服务器在独立的空间内运行自己的代码,从而难以共享数据。 如果单个应用程序遭到***或掉线,许多用户和其他应用程序都会受到影响 在区块链中,任何人都可以设置一个节点,复制所有节点的必要数据以达成协议,并由用户和应用程序开发人员进行补偿。 这允许用户数据保持私密性,应用程序可以像互联网应用那样分散。 智能钱包 以太坊钱包是在以太坊区块链上分散应用的门户。 它使您能够保存和保护以太坊以及其他以Ethereum为基础的加密资产,以及编写,部署和使用智能合约。 以太坊客户端,其实我们可以把它理解为一个开发者工具,它提供账户管理、挖矿、转账、智能合约的部署和执行等等功能。 智能合约 可以理解为在区块链上可以自动执行的(由消息驱动的)、以代码形式编写的合同(特殊的交易)。 在比特币脚本中

【区块链】以太坊(Ethereum )高级进阶实战视频教程

老子叫甜甜 提交于 2019-11-26 00:33:52
【区块链】以太坊(Ethereum )高级进阶实战视频教程 视频教程地址: http://edu.51cto.com/course/14785.html 课程大纲: 课程概要介绍 使用bootnode搭建以太坊私有链 web3j介绍及基本使用 使用web3j管理账户 default block parameter 以太坊交易详解 ERC20代币介绍 使用web3j部署ERC20代币合约 账户解锁 web3j调用代币合约方法(一) web3j调用代币合约方法(二) web3j调用代币合约方法(三) 深入sendTransaction之gasPrice(一) 深入sendTransaction之gasPrice(二) 深入sendTransaction之gas 深入sendTransaction之nonce 深入sendTransaction之data(一) 深入sendTransaction之data(二) personal.sendTransaction详解 [签名交易]sendRawTransaction详解(一) [签名交易]sendRawTransaction详解(二) web3j实用方法介绍(一) web3j实用方法介绍(二) web3j console-账户管理 web3j console-生成Java代码 web3j maven plugin web3.js账户管理

搭建以太坊私有链完整版

风格不统一 提交于 2019-11-25 23:48:21
可以直接下载程序进行安装,也可以下载源码自己进行编译安装,本文介绍源码编译方式。 源码编译 环境需求 正确安装Go语言环境 正确安装GCC: 安装GCC方法 从github下载源码 go get github.com/ethereum/go-ethereum 编译 Ubuntu和Mac下编译 cd go-ethereum make geth 或者 make all Windows下编译 按以下目录结构才能正确编译,需要下载的包请自行下载 $GOPATH$/src ├── github.com │ └── ethereum │ └── go-ethereum └── golang.org └── x └── net 在CMD命令行下,执行以下命令进行编译: go install -v github.com/ethereum/go-ethereum/cmd/geth go install -v github.com/ethereum/go-ethereum/cmd/evm 编译成功,在$GOPATH$/bin下会出现:geth.exe和evm.exe 配置环境变量 将 geth 添加到环境变量中 # ubuntu下 vi ~/.bashrc # mac下 vi ~/.bash_profile # 打开配置文件后,把以下内容添加到文件中 export GETH="$GOPATH/src