2019-01-10工作日志

工作日志 2019-01-10

1. 工作计划

  1. 封装函数
  2. 修改bug

2. 遇到问题

  1. web3连接repson测试网络
  2. 思路错误

3. 编写代码

    const Web3 = require("web3");
const solc = require('solc');
const fs = require("fs");
const Koa = require('koa');
const router = require('koa-router')();
const bodyParser = require('koa-bodyparser');
const render = require('koa-art-template');
const path = require('path');
const views = require('koa-views');
const HDWalletProvider = require('truffle-hdwallet-provider');
const walletConfig = require('./walletConfig.json');
const Tx = require('ethereumjs-tx');
//init
const app = new Koa();
var web3 = new Web3();
//
var Contract_Token;
/**Read me
* 1.简称(Token=>T,Drop=>D,TokenMgr=>M)
* 2.Actions_data=>参数初始化(各种初始化参数)
  3.Actions_Koa=>Koa框架以及Koa插件初始化和启动配置(Koa相关)
* 4.Actions_Router=>router路由的get方法,post方法配置
* 5.Actions_initWeb3Provider=>web3js相关初始化参数(web3,合约实例等)
* 6.Actions_Web3jsCommonMethod=>webjs常用的方法(获取各种参数)
* 7.Actions_Web3jsUtils=>web3js相关的工具方法(转换,校验等)
* 8.Actions_Contrant_Token=>skt测试代币的相关方法的实现(Token)
* 9.Actions_Contrant_Drop=> 空投合约的相关方法的实现(Drop)
*10.Actions_Contrant_TokenMgr=>项目之前空投合约的相关方法的实现(TokenMgr)
*11.Actions_Configure=>项目相关配置信息()
*12.Json_list=>常量信息的相关管理(abi,合约地址,gas参数,等)
*13.Json_Bz=>其它备注信息(追加,扩展)
*/
var Actions_data  = {
  Type_init:()=>{

  }
}
var Actions_Koa = {
  render: () => {
    render(app, {
      root: path.join(__dirname, '../views'), // 视图的位置
      extname: '.html', // 后缀名
      debug: process.env.NODE_ENV !== 'production' //是否开启调试模式
    })
  },
  user: () => {
    app.use(views('../views', {
      extension: 'ejs'
    }));
    app.use(bodyParser());
    app.use(router.routes());
    app.use(router.allowedMethods());
    app.use(bodyParser());
    app.listen(3003, () => {
      console.log("start at port 3003");
    });
  }

}
var Actions_Router = {
  router_get: () => {

    router.get('/', (ctx, next) => {
      // TODO:
      ctx.body = "测试路由111";
    });
    //
    router.get('/Token/T_transferFrom', (ctx, next) => {
        // TODO:
      ctx.body = "T_transferFrom";
      console.log('ctx=>11112222');
            // TODO:校验数据
            // let data =  ctx.params;
            // let from =  data.from;
            // let to   =  data.to;
            // let value=  data.value;
            let sFrom = Json_list.ADDRESS_TOKEN;
            console.log("sFrom=>",sFrom);
            let sTo = Json_list.USE_ADDRESS.User_2;
            console.log("sTo=>",sTo);
            let sValue =7;
            console.log("sValue=>",sValue);
      // if (qs.hash) {
      //   console.log('/withdraw info: ', qs.hash);
      //   qs = JSON.parse(qs.hash);
      // }
      // if (lastWid && qs.wid === lastWid) return;
      // lastWid = qs.wid;

      // T_transferFrom: (from, to, value)
      // 查询方法
      let  result = Actions_Contrant_Token.T_transferFrom({
        from: sFrom,
        to: sTo,
        value:sValue
        });
      //return
      return result;
      });

    router.get('/Token/T_transfer', (ctx, next) => {
      // TODO:
      ctx.body = "T_transfer";
    });

    router.get('/Token/T_approve', (ctx, next) => {
      // TODO:
      ctx.body = "T_approve";
    });

    router.get('/Token/T_allowance', (ctx, next) => {
      // TODO:
      ctx.body = "T_allowance";
    });

    router.get('/Drop/D_setToken', (ctx, next) => {
      // TODO:
      ctx.body = "D_setToken";
    });

    router.get('/Drop/D_multiSendandself', (ctx, next) => {
      // TODO:
      ctx.body = "D_multiSendandself";
    });

    router.get('/Drop/D_multiSend', (ctx, next) => {
      // TODO:
      ctx.body = "D_multiSend";
    });

    router.get('/Drop/D_multiSend2', (ctx, next) => {
      // TODO:
      ctx.body = "D_multiSend2";
    });

    router.get('/Drop/D_multiself', (ctx, next) => {
      // TODO:
      ctx.body = "D_multiself";
    });

    router.get('/Drop/D_settrustOwner', (ctx, next) => {
      // TODO:
      ctx.body = "D_settrustOwner";
    });

    router.get('/Drop/D_seterctypeName', (ctx, next) => {
      // TODO:
      ctx.body = "D_seterctypeName";
    });

    router.get('/Drop/D_sethistoricalOwner', (ctx, next) => {
      // TODO:
      ctx.body = "D_sethistoricalOwner";
    });

    router.get('/Drop/D_transfer', (ctx, next) => {
      // TODO:
      ctx.body = "D_transfer";
    });

    router.get('/Drop/D_approve', (ctx, next) => {
      // TODO:
      ctx.body = "D_approve";
    });

    router.get('/Drop/D_transferFrom', (ctx, next) => {
      // TODO:
      ctx.body = "D_transferFrom";
    });

    router.get('/Drop/D_balanceOf', (ctx, next) => {
      // TODO:
      ctx.body = "D_balanceOf";
    });

    //
    router.get('/Drop/M_prepare', (ctx, next) => {
      // TODO:
      ctx.body = "M_prepare";
    });

    router.get('/Drop/M_flyDrop', (ctx, next) => {
      // TODO:
      ctx.body = "M_flyDrop";
    });

  },
  router_post: () => {

    router.post('/', (ctx, next) => {
      // TODO:
      ctx.body = "测试路由111";
    });
    //
    router.post('/Token/T_transferFrom', (ctx, next) => {
      // TODO:
      ctx.body = "T_transferFrom";
    });

    router.post('/Token/T_transfer', (ctx, next) => {
      // TODO:
      ctx.body = "T_transfer";
    });

    router.post('/Token/T_approve', (ctx, next) => {
      // TODO:
      ctx.body = "T_approve";
    });

    router.post('/Token/T_allowance', (ctx, next) => {
      // TODO:
      ctx.body = "T_allowance";
    });

    router.post('/Drop/D_setToken', (ctx, next) => {
      // TODO:
      ctx.body = "D_setToken";
    });

    router.post('/Drop/D_multiSendandself', (ctx, next) => {
      // TODO:
      ctx.body = "D_multiSendandself";
    });

    router.post('/Drop/D_multiSend', (ctx, next) => {
      // TODO:
      ctx.body = "D_multiSend";
    });

    router.post('/Drop/D_multiSend2', (ctx, next) => {
      // TODO:
      ctx.body = "D_multiSend2";
    });

    router.post('/Drop/D_multiself', (ctx, next) => {
      // TODO:
      ctx.body = "D_multiself";
    });

    router.post('/Drop/D_settrustOwner', (ctx, next) => {
      // TODO:
      ctx.body = "D_settrustOwner";
    });

    router.post('/Drop/D_seterctypeName', (ctx, next) => {
      // TODO:
      ctx.body = "D_seterctypeName";
    });

    router.post('/Drop/D_sethistoricalOwner', (ctx, next) => {
      // TODO:
      ctx.body = "D_sethistoricalOwner";
    });

    router.post('/Drop/D_transfer', (ctx, next) => {
      // TODO:
      ctx.body = "D_transfer";
    });

    router.post('/Drop/D_approve', (ctx, next) => {
      // TODO:
      ctx.body = "D_approve";
    });

    router.post('/Drop/D_transferFrom', (ctx, next) => {
      // TODO:
      ctx.body = "D_transferFrom";
    });

    router.post('/Drop/D_balanceOf', (ctx, next) => {
      // TODO:
      ctx.body = "D_balanceOf";
    });

    //
    router.post('/Drop/M_prepare', (ctx, next) => {
      // TODO:
      ctx.body = "M_prepare";
    });

    router.post('/Drop/M_flyDrop', (ctx, next) => {
      // TODO:
      ctx.body = "M_flyDrop";
    });

  }
}
var Actions_initWeb3Provider = {
  initWeb3: () => {
    //创建一个web3实例,设置一个provider,成功引入后,就可以用web3的api
    if (typeof web3 == 'undefined') {
      web3 = new Web3(web3.currentProvider); //新建web3对象
      console.log("web  undefined");
    } else {
      // TODO:
      web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/ee23e77aa14846d88eb5cad3d59e37f2"));
    } //设置一个provider
    // TODO:
    console.log("web3实例化完成=>");
    console.log("web3.currentProvider=>",web3.currentProvider);
    console.log("web3是否连接成功=>",web3.isConnected());
    console.log("默认账户",web3.eth.defaultAccount);
    console.log("默认区块",web3.eth.defaultBlock);
    // web3.eth.defaultAccount = "";
    web3.eth.defaultAccount='0x38a8DC14edE1DEf9C437bB3647445eEec06fF105';
      console.log("默认账户",web3.eth.defaultAccount);

  },
  initContract_Token: () => {
    // TODO:
    let Abi_Token = Json_list.ABI_TOKEN;
    let Address_Token = Json_list.ADDRESS_TOKEN;
    //Token  实例化
     Contract_Token = web3.eth.contract(Abi_Token).at(Address_Token);
    // TODO:
    console.log("Token合约实例完成=>");
  },
  initContract_drop: () => {
    // TODO:
    let Abi_drop = "";
    let Address_drop = "";
    //drop  实例化
    var Contract_drop = web_TokenMgr.eth.constant(Abi_drop).at(Address_drop);
  },
  initContract_TokenMgr: () => {
    // TODO:
    let Abi_TokenMgr = "";
    let Address_TokenMgr = "";
    //TokenMgr  实例化
    var Contract_drop = web3.eth.constant(Abi_TokenMgr).at(Address_TokenMgr);
  }
}
var Actions_Web3jsCommonMethod = {
  web_api: () => {
    // TODO:
  },
  web_node: () => {
    // TODO:

  },
  web3_isConnected: () => {
    // TODO:
  },
  web3_currentProvider: () => {
    // TODO:
  }
}
var Actions_Web3jsUtils = {
  web_api: () => {
    // TODO:
  },
  web_node: () => {
    // TODO:

  },
  web3_isConnected: () => {
    // TODO:
  },

  //工具函数@预估gas
  web3_estimateGas: (address,data) => {
    // TODO:
  let  estimateGas = web3.eth.estimateGas({
        to: address,
        data: data
    });
  estimateGas = this.web3.toHex(estimateGas);
    return estimateGas;
  },
  // 工具函数@预估区块高度
  web3_getNonce: (address) => {
    // TODO:
    let nonce  = web3.eth.getTransactionCount(address);
    return nonce;
  },
  //工具函数@序列化私钥
  web3_bufferPrivateKey: (value) => {
    // TODO:
    const privateKey = new Buffer(value,'hex');
    return privateKey;
  },
  web3_currentProvider: () => {
    // TODO:
  }
}
var Actions_Contrant_Token = {
  T_transferFrom: (ctx,next) => {
    // TODO:
      let Tx_gasPrice =web3.toHex('0x3B9ACA00'*1000);// TODO:
      // let Tx_value = "0x00";// TODO:
      let Tx_address = ctx.from;// TODO:
      let Tx_to =ctx.to;
      let Tx_value =ctx.value;
      let Tx_v = "0x00";
      //函数的二进制(函数名+函数参数+合约)
      console.log("T_transferFrom => ",ctx);
      // let Tx_data_Token = Contract_Token.transferFrom.getData(Tx_address,Tx_to,Tx_value);
      Contract_Token.methods.transfer(Tx_address,Tx_value).send({from:'0x38a8DC14edE1DEf9C437bB3647445eEec06fF105'},(err,data)=>{
          if(!err){
              console.log("methds____________",data);

          }

        });

      //
      // console.log("-----",Contract_Token.transferFrom());
//       Contract_Token.methods.transferFrom(Tx_address,Tx_to,Tx_value).send({from:'0xaA3A01dBa149B109d5e9090f1ad1f2cEbA1C272a'}, function(error, transactionHash){
//         console.log("rs======>",transactionHash);
// });
      // Contract_Token.transferFrom(Tx_address,Tx_to,Tx_value).send({from:'0xaA3A01dBa149B109d5e9090f1ad1f2cEbA1C272a'})
// .on('transactionHash', function(hash){
// console.log(hash);
// })
// .on('receipt', function(receipt){
// console.log(receipt);
// })
// .on('confirmation', function(confirmationNumber, receipt){
// console.log(confirmationNumber);
// })
// .on('error', console.error);

      //预估gas
      // let Tx_estimateGas = Actions_Web3jsUtils.web3_estimateGas(Tx_address,Tx_data_Token);
      // var estimateGas = web3.eth.estimateGas({
      //     to: Tx_address,
      //     data: Tx_data_Token
      // })
      // .then(console.log);
      let   Tx_estimateGas = web3.toHex(6000000);// TODO:
      console.log("T_transferFrom预估gas是=>",Tx_estimateGas);
      //获取高度
      // let Tx_nonce = Actions_Web3jsUtils.web3_getNonce(Tx_to);// TODO:
      let Tx_nonce =web3.eth.getTransactionCount(Tx_address);
      let Tx_nonce1= web3.toHex(Tx_nonce+1);
      console.log("区块高度是:",Tx_nonce1);
      //
      // let encodeData_param = web3.eth.abi.encodeParameters(
      //   ['address', 'address', 'address'], [DRCToken_contractAT,
      //     DRCWalletMgrParams_contractAT.slice(2),
      //     DRCWalletStorage_contractAT.slice(2)
      //   ]
      // );
      // console.log(encodeData_param);
      // let encodeData_function = web3.eth.abi.encodeFunctionSignature('initialize(address,address,address)');
      // console.log(encodeData_function);
      // let encodeData = encodeData_function + encodeData_param.slice(2);
      // console.log(encodeData);
      //


      //拼接rawTx
      var rawTx = {
          nonce:Tx_nonce1,
          gasPrice: Tx_gasPrice,// TODO:
          gasLimit: Tx_estimateGas,
          to: Tx_address,
          value: Tx_v,// TODO:
          data: Tx_data_Token
      }
      //Tx对象
      console.log("rawTx=>",rawTx);
      let tx = new Tx(rawTx);
      //序列化私钥
      const privateKey  = Actions_Web3jsUtils.web3_bufferPrivateKey(Json_list.PRIVATEKEY.Token_privateKey);
      //用私钥给数据签名
      tx.sign(privateKey);
      //对数据编码
      let serializeTx = tx.serialize();
      //调用合约函数
      let result = web3.eth.sendRawTransaction('0x' + serializeTx.toString('hex'),(err,hash)=>{
        if(!err){
            console.log(hash);
        }else{
          console.log("err:1111",err);
        }

      });
      //返回结果
      console.log("调用交易返回结果=>",result);
      return result;
  },
  T_transfer: (from, value) => {
    // TODO:
      var transferData = this.contract.transferFrom.getData(from,to,value);
  },
  T_balanceOf: (from) => {
    // TODO:
  },
  T_approve: (from, value) => {
    // TODO:
  },
  T_allowance: (owner, spender) => {
    // TODO:
  }
}
var Actions_Contrant_Drop = {
  //设置代币
  D_setToken: (address) => {
    // TODO:
  },
  D_multiSendandself: (arr_address, arr_values) => {
    // TODO:
  },
  D_multiSend: (arr_address, arr_values) => {
    // TODO:
  },
  D_multiSend2: (arr_address, arr_values, value) => {
    // TODO:
  },
  //给自己
  D_multiself: (owner, value) => {
    // TODO:
  },
  D_settrustOwner: (address, owntext) => {
    // TODO:
  },
  D_seterctypeName: (address, tokenName) => {
    // TODO:
  },
  D_sethistoricalOwner: (address, histext) => {
    // TODO:
  },
  //**********
  D_transfer: (address, value) => {
    // TODO:
  },
  D_approve: (address, value) => {
    // TODO:
  },
  D_transferFrom: (from, to, value) => {
    // TODO:
  },
  D_totalSupply: () => {
    // TODO:
  },
  D_balanceOf: (address) => {
    // TODO:
  }
}
var Actions_Contrant_TokenMgr = {
  //
  M_prepare: (rand, form, token, value) => {
    // TODO:
  },
  M_flyDrop: (arr_address, arr_values) => {
    // TODO:
  }

}
var Actions_Configure = {
     Abi_Token:{

     },
     Abi_drop:{

     },
     Abi_TokenMgr:{

     }

}
//二级启动
var Actions_Starting  = {
  //init  web3, 合约对象
  init:()=>{
    //
    Actions_initWeb3Provider.initWeb3();
    Actions_initWeb3Provider.initContract_Token();
  },
  //test 启动
  test:()=>{
      console.log("log........");
  },
  log:()=>{
      console.log("-");
  }
}
//一级启动
var Actions = {
  //Action 启动其它函数
  init:(data)=>{
    Actions_Koa.render();
    Actions_Koa.user();
    //
    Actions_Router.router_get();
    Actions_Router.router_post();
    //
    Actions_Starting.init();
    // Actions_Starting.test;

    // Actions_initWeb3Provider.initWeb3();
    // Actions_initWeb3Provider.initContract_Token();
    console.log(data);
  }
}
//json文件配置参数
const Json_list = {
  ABI_TOKEN:[
    {
      "constant": false,
      "inputs": [
        {
          "name": "_spender",
          "type": "address"
        },
        {
          "name": "_value",
          "type": "uint256"
        }
      ],
      "name": "approve",
      "outputs": [
        {
          "name": "success",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "totalSupply",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": false,
      "inputs": [
        {
          "name": "_from",
          "type": "address"
        },
        {
          "name": "_to",
          "type": "address"
        },
        {
          "name": "_value",
          "type": "uint256"
        }
      ],
      "name": "transferFrom",
      "outputs": [
        {
          "name": "success",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [
        {
          "name": "_owner",
          "type": "address"
        }
      ],
      "name": "balanceOf",
      "outputs": [
        {
          "name": "balance",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": false,
      "inputs": [
        {
          "name": "_to",
          "type": "address"
        },
        {
          "name": "_value",
          "type": "uint256"
        }
      ],
      "name": "transfer",
      "outputs": [
        {
          "name": "success",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [
        {
          "name": "_owner",
          "type": "address"
        },
        {
          "name": "_spender",
          "type": "address"
        }
      ],
      "name": "allowance",
      "outputs": [
        {
          "name": "remaining",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "_from",
          "type": "address"
        },
        {
          "indexed": true,
          "name": "_to",
          "type": "address"
        },
        {
          "indexed": false,
          "name": "_value",
          "type": "uint256"
        }
      ],
      "name": "Transfer",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "_owner",
          "type": "address"
        },
        {
          "indexed": true,
          "name": "_spender",
          "type": "address"
        },
        {
          "indexed": false,
          "name": "_value",
          "type": "uint256"
        }
      ],
      "name": "Approval",
      "type": "event"
    }
  ],
  ADDRESS_TOKEN: '0xaA3A01dBa149B109d5e9090f1ad1f2cEbA1C272a',
  ABI_DROP: [
	{
		"constant": false,
		"inputs": [
			{
				"name": "spender",
				"type": "address"
			},
			{
				"name": "value",
				"type": "uint256"
			}
		],
		"name": "approve",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_destAddrs",
				"type": "address[]"
			},
			{
				"name": "_values",
				"type": "uint256[]"
			},
			{
				"name": "_valuesmyself",
				"type": "uint256"
			}
		],
		"name": "multiSendandself",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_token",
				"type": "address"
			}
		],
		"name": "setToken",
		"outputs": [],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [],
		"name": "totalSupply",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "",
				"type": "address"
			}
		],
		"name": "historicalOwner",
		"outputs": [
			{
				"name": "",
				"type": "string"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "from",
				"type": "address"
			},
			{
				"name": "to",
				"type": "address"
			},
			{
				"name": "value",
				"type": "uint256"
			}
		],
		"name": "transferFrom",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "",
				"type": "address"
			}
		],
		"name": "snList",
		"outputs": [
			{
				"name": "",
				"type": "string"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "spender",
				"type": "address"
			},
			{
				"name": "addedValue",
				"type": "uint256"
			}
		],
		"name": "increaseAllowance",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "",
				"type": "address"
			}
		],
		"name": "erctypeName",
		"outputs": [
			{
				"name": "",
				"type": "string"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_owneraddress",
				"type": "address"
			}
		],
		"name": "deltrustOwner",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "",
				"type": "address"
			}
		],
		"name": "trustOwner",
		"outputs": [
			{
				"name": "",
				"type": "string"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_destAddrs",
				"type": "address[]"
			},
			{
				"name": "_values",
				"type": "uint256[]"
			}
		],
		"name": "multiSend2",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_ownaddress",
				"type": "address"
			},
			{
				"name": "_owntext",
				"type": "string"
			}
		],
		"name": "settrustOwner",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "owner",
				"type": "address"
			}
		],
		"name": "balanceOf",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "a",
				"type": "string"
			}
		],
		"name": "myself",
		"outputs": [
			{
				"name": "",
				"type": "string"
			}
		],
		"payable": false,
		"stateMutability": "pure",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "a",
				"type": "uint256"
			},
			{
				"name": "b",
				"type": "uint256"
			}
		],
		"name": "add",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "pure",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [],
		"name": "owner",
		"outputs": [
			{
				"name": "",
				"type": "address"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_tokentype",
				"type": "address"
			},
			{
				"name": "_tokenName",
				"type": "string"
			}
		],
		"name": "seterctypeName",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "spender",
				"type": "address"
			},
			{
				"name": "subtractedValue",
				"type": "uint256"
			}
		],
		"name": "decreaseAllowance",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "to",
				"type": "address"
			},
			{
				"name": "value",
				"type": "uint256"
			}
		],
		"name": "transfer",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_destAddrs",
				"type": "address[]"
			},
			{
				"name": "_values",
				"type": "uint256[]"
			}
		],
		"name": "multiSend",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_values",
				"type": "uint256"
			},
			{
				"name": "addres_owner",
				"type": "address"
			}
		],
		"name": "multiself",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "owner",
				"type": "address"
			},
			{
				"name": "spender",
				"type": "address"
			}
		],
		"name": "allowance",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_hisaddress",
				"type": "address"
			},
			{
				"name": "_histext",
				"type": "string"
			}
		],
		"name": "sethistoricalOwner",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "constructor"
	},
	{
		"anonymous": false,
		"inputs": [
			{
				"indexed": true,
				"name": "from",
				"type": "address"
			},
			{
				"indexed": true,
				"name": "to",
				"type": "address"
			},
			{
				"indexed": false,
				"name": "value",
				"type": "uint256"
			}
		],
		"name": "Transfer",
		"type": "event"
	},
	{
		"anonymous": false,
		"inputs": [
			{
				"indexed": true,
				"name": "owner",
				"type": "address"
			},
			{
				"indexed": true,
				"name": "spender",
				"type": "address"
			},
			{
				"indexed": false,
				"name": "value",
				"type": "uint256"
			}
		],
		"name": "Approval",
		"type": "event"
	}
],
  ADDRESS_DROP: '0x7Dc6Dc91178a6fEF2Fa5Bd1de32c5642e6Ae421b',
  ABI_TOKENMGR:[],
  ADDRESS_TOKENMGR:"",
  PRIVATEKEY:{
    Token_privateKey:"F9B224ECF9161EEA3A815338FA70EF11F82AC1C5CAB145D264ADC1E110FA0907",
    TEST:"123"
  },
  USE_ADDRESS:{
    User_1:"0x38a8DC14edE1DEf9C437bB3647445eEec06fF105",
    User_2:"0xd2580AB2EB3313B0972e9e47b05eE4c15320A6D1",
    User_3:"0xA9af645Ce31AF413b24a3b913f1a5Bf57A7a1C50",
    User_4:"0x3846a0e5e3a93900B5c0F8BA1504e0B55Ca201e5"
  }
};
//追加配置
const Json_Bz ={};
//启动
Actions.init("starting........");


4. 明日计划

  1. 调试bug
  2. 数据校验

5. 备注

  1. 今天主要连接测试网络测试
智慧旅游解决方案利用云计算、物联网和移动互联网技术,通过便携终端设备,实现对旅游资源、经济、活动和旅游者信息的智能感知和发布。这种技术的应用旨在提升游客在旅游各个环节的体验,使他们能够轻松获取信息、规划行程、预订票务和安排食宿。智慧旅游平台为旅游管理部门、企业和游客提供服务,包括政策发布、行政管理、景区安全、游客流量统计分析、投诉反馈等。此外,平台还提供广告促销、库存信息、景点介绍、电子门票、社交互动等功能。 智慧旅游的建设规划得到了国家政策的支持,如《国家中长期科技发展规划纲要》和国务院的《关于加快发展旅游业的意见》,这些政策强调了旅游信息服务平台的建设和信息化服务的重要性。随着技术的成熟和政策环境的优化,智慧旅游的时机已经到来。 智慧旅游平台采用SaaS、PaaS和IaaS等云服务模式,提供简化的软件开发、测试和部署环境,实现资源的按需配置和快速部署。这些服务模式支持旅游企业、消费者和管理部门开发高性能、高可扩展的应用服务。平台还整合了旅游信息资源,提供了丰富的旅游产品创意平台和统一的旅游综合信息库。 智慧旅游融合应用面向游客和景区景点主管机构,提供无线城市门户、智能导游、智能门票及优惠券、景区综合安防、车辆及停车场管理等服务。这些应用通过物联网和云计算技术,实现了旅游服务的智能化、个性化和协同化,提高了旅游服务的自由度和信息共享的动态性。 智慧旅游的发展标志着旅游信息化建设的智能化和应用多样化趋势,多种技术和应用交叉渗透至旅游行业的各个方面,预示着全面的智慧旅游时代已经到来。智慧旅游不仅提升了游客的旅游体验,也为旅游管理和服务提供了高效的技术支持。
智慧旅游解决方案利用云计算、物联网和移动互联网技术,通过便携终端设备,实现对旅游资源、经济、活动和旅游者信息的智能感知和发布。这种技术的应用旨在提升游客在旅游各个环节的体验,使他们能够轻松获取信息、规划行程、预订票务和安排食宿。智慧旅游平台为旅游管理部门、企业和游客提供服务,包括政策发布、行政管理、景区安全、游客流量统计分析、投诉反馈等。此外,平台还提供广告促销、库存信息、景点介绍、电子门票、社交互动等功能。 智慧旅游的建设规划得到了国家政策的支持,如《国家中长期科技发展规划纲要》和国务院的《关于加快发展旅游业的意见》,这些政策强调了旅游信息服务平台的建设和信息化服务的重要性。随着技术的成熟和政策环境的优化,智慧旅游的时机已经到来。 智慧旅游平台采用SaaS、PaaS和IaaS等云服务模式,提供简化的软件开发、测试和部署环境,实现资源的按需配置和快速部署。这些服务模式支持旅游企业、消费者和管理部门开发高性能、高可扩展的应用服务。平台还整合了旅游信息资源,提供了丰富的旅游产品创意平台和统一的旅游综合信息库。 智慧旅游融合应用面向游客和景区景点主管机构,提供无线城市门户、智能导游、智能门票及优惠券、景区综合安防、车辆及停车场管理等服务。这些应用通过物联网和云计算技术,实现了旅游服务的智能化、个性化和协同化,提高了旅游服务的自由度和信息共享的动态性。 智慧旅游的发展标志着旅游信息化建设的智能化和应用多样化趋势,多种技术和应用交叉渗透至旅游行业的各个方面,预示着全面的智慧旅游时代已经到来。智慧旅游不仅提升了游客的旅游体验,也为旅游管理和服务提供了高效的技术支持。
深度学习是机器学习的一个子领域,它基于人工神经网络的研究,特别是利用多层次的神经网络来进行学习和模式识别。深度学习模型能够学习数据的高层次特征,这些特征对于图像和语音识别、自然语言处理、医学图像分析等应用至关重要。以下是深度学习的一些关键概念和组成部分: 1. **神经网络(Neural Networks)**:深度学习的基础是人工神经网络,它是由多个层组成的网络结构,包括输入层、隐藏层和输出层。每个层由多个神经元组成,神经元之间通过权重连接。 2. **前馈神经网络(Feedforward Neural Networks)**:这是最常见的神经网络类型,信息从输入层流向隐藏层,最终到达输出层。 3. **卷积神经网络(Convolutional Neural Networks, CNNs)**:这种网络特别适合处理具有网格结构的数据,如图像。它们使用卷积层来提取图像的特征。 4. **循环神经网络(Recurrent Neural Networks, RNNs)**:这种网络能够处理序列数据,如时间序列或自然语言,因为它们具有记忆功能,能够捕捉数据中的时间依赖性。 5. **长短期记忆网络(Long Short-Term Memory, LSTM)**:LSTM 是一种特殊的 RNN,它能够学习长期依赖关系,非常适合复杂的序列预测任务。 6. **生成对抗网络(Generative Adversarial Networks, GANs)**:由两个网络组成,一个生成器和一个判别器,它们相互竞争,生成器生成数据,判别器评估数据的真实性。 7. **深度学习框架**:如 TensorFlow、Keras、PyTorch 等,这些框架提供了构建、训练和部署深度学习模型的工具和库。 8. **激活函数(Activation Functions)**:如 ReLU、Sigmoid、Tanh 等,它们在神经网络中用于添加非线性,使得网络能够学习复杂的函数。 9. **损失函数(Loss Functions)**:用于评估模型的预测与真实值之间的差异,常见的损失函数包括均方误差(MSE)、交叉熵(Cross-Entropy)等。 10. **优化算法(Optimization Algorithms)**:如梯度下降(Gradient Descent)、随机梯度下降(SGD)、Adam 等,用于更新网络权重,以最小化损失函数。 11. **正则化(Regularization)**:技术如 Dropout、L1/L2 正则化等,用于防止模型过拟合。 12. **迁移学习(Transfer Learning)**:利用在一个任务上训练好的模型来提高另一个相关任务的性能。 深度学习在许多领域都取得了显著的成就,但它也面临着一些挑战,如对大量数据的依赖、模型的解释性差、计算资源消耗大等。研究人员正在不断探索新的方法来解决这些问题。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值