{"id":15622475,"url":"https://github.com/ajb413/crowdsalable-eth-token","last_synced_at":"2026-03-16T17:31:53.046Z","repository":{"id":78009909,"uuid":"120385138","full_name":"ajb413/crowdsalable-eth-token","owner":"ajb413","description":"A crowdsalable Ethereum token based on ERC-20 specification.","archived":false,"fork":false,"pushed_at":"2018-04-09T16:07:53.000Z","size":38,"stargazers_count":25,"open_issues_count":0,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-28T16:58:54.697Z","etag":null,"topics":["blockchain","crowdsale","crypto","cryptocurrency","dapp","development-blockchain","ether","ethereum","ethereum-network","solidity","test-ether","token","truffle","truffle-cli","truffle-development-kit"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajb413.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-06T01:32:58.000Z","updated_at":"2024-01-29T17:47:28.000Z","dependencies_parsed_at":"2023-08-27T13:46:57.164Z","dependency_job_id":null,"html_url":"https://github.com/ajb413/crowdsalable-eth-token","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ajb413/crowdsalable-eth-token","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajb413%2Fcrowdsalable-eth-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajb413%2Fcrowdsalable-eth-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajb413%2Fcrowdsalable-eth-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajb413%2Fcrowdsalable-eth-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajb413","download_url":"https://codeload.github.com/ajb413/crowdsalable-eth-token/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajb413%2Fcrowdsalable-eth-token/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264456020,"owners_count":23611068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","crowdsale","crypto","cryptocurrency","dapp","development-blockchain","ether","ethereum","ethereum-network","solidity","test-ether","token","truffle","truffle-cli","truffle-development-kit"],"created_at":"2024-10-03T09:54:08.166Z","updated_at":"2026-03-16T17:31:48.025Z","avatar_url":"https://github.com/ajb413.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crowdsalable Ethereum Token\n\nLaunch an ERC-20 Ethereum token with crowdsale capability using the Truffle development kit.\n\n**Step-by-step tutorial for building this is available on the PubNub Blog, click here:**\n\n[![pubnub blog](https://i.imgur.com/VHbsEnd.png)](https://www.pubnub.com/blog/how-to-launch-your-own-crowdsalable-cryptocurrency-part-3/?devrel_gh=erc20-ethereum-token)\n\nBased on:\n- [ERC-20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md)\n- [Truffle](http://truffleframework.com/docs/)\n- [OpenZepplin](https://openzeppelin.org/)\n- [Web3.js](https://github.com/ethereum/web3.js/)\n\n## Quick Start\n```\ngit clone git@github.com:ajb413/crowdsalable-eth-token.git\ncd crowdsalable-eth-token\nnpm i\ntruffle develop\n\n## Truffle development blockchain and console are booted\ntruffle(develop)\u003e compile\ntruffle(develop)\u003e migrate\ntruffle(develop)\u003e test\n```\n\nIn a second command line window, navigate to the project directory.\n```\nnpm run dev\nProject is running at http://localhost:8080/\n```\n\nGo to http://localhost:8080/ in a web browser and use the sample UI to check wallet balances and send sample tokens to wallets within your local machine's test network.\n\n## Quick Start Explained\n\nFirst, the repository was pulled from GitHub to your local machine. Next, all of the npm packages in `package.json` were installed on your machine. Make sure you have Node.js 5.0 or later.\n\nNext we used the Truffle CLI to launch the Truffle development environment. That includes a `testrpc` instance. [Test RPC](https://github.com/trufflesuite/ganache-cli) is an instance of the Ethereum network that runs on your local machine. It starts with 10 random wallet key pairs that each have sufficient test ether. The instance that is started in the Truffle development console has the same 10 wallet addresses every time, which makes integration tests easier to write. Truffle develop hosts the instance at http://127.0.0.1:9545 by default.\n\nNext we compiled our [Solidity](http://solidity.readthedocs.io/en/develop/) code into ABI objects. Then we migrated, which means we deployed our smart contracts to the development blockchain. The contract we deployed is the crowdsalable token.\n\nWhen deployed, the entire balance of the tokens are issued to the first wallet in the list of 10 that Truffle boots with. This list can be found in `test/truffle-keys.js`. To edit the token properties like name, number, and symbol, check out the constructor in `contracts/Token.sol`.\n\n```\nfunction Token() public {\n    symbol = 'TOK';\n    name = 'Token';\n    decimals = 18;\n    totalSupply = 1000000000 * 10**uint(decimals);\n    balances[msg.sender] = totalSupply;\n    Transfer(address(0), msg.sender, totalSupply);\n}\n```\n\nNext we ran the JavaScript and Solidity tests, which are explained below.\n\nNext we opened another command line window, navigated to the project directory, and booted the test UI.\n\nThe test UI can be accessed in a web browser. The test UI uses Web3.js, a JavaScript framework that communicates requests made from a web or node.js application to the Ethereum network. In this case, the `Web3.providers.HttpProvider` is your local machine.\n\nRequests can be made to the development blockchain to get balances of wallets and transfer token. The way Ethereum works is that you must spend ether if you are doing a blockchain altering operation, like transferring token. Reading data that is already written to the blockchain is free. So the `transfer` method costs some ether, and the `balanceOf` method is always free.\n\nAn unrealistic circumstance of the test instance is that you can `transfer` to and from any wallet. On the real network this does not work because each `transfer` request must be signed by a user's private key in order to succeed.\n\n## Testing\nIf you are familiar with Javascript testing and Mocha, you will hit the ground running with [Truffle tests](http://truffleframework.com/docs/getting_started/testing). The Truffle development kit allows a developer to use [Javascript](http://truffleframework.com/docs/getting_started/javascript-tests) or [Solidity](http://truffleframework.com/docs/getting_started/solidity-tests) to run tests on your contracts.\n\nMy tests demonstrate using both, but mostly JavaScript, because it is easier to define different senders using the development key pairs.\n\nThe file `test/integration.test.js` demonstrates many scenarios for the Token methods and the crowdsale methods. There are examples for `.call()` and `web3.eth.sendRawTransaction()` using Web3.js. The raw transactions are very useful for sending a signed request from any wallet in which the user has the private and public key.\n\nThe integration test file imports the sample key pairs booted by `truffle develop` from `test/truffle-keys.js`. Note that `truffle develop` has these keys hard coded somewhere in the npm package, not in this repo's test folder.\n\nThe tests are run in the truffle console using just `test`, or from the command line using `truffle test` with an instance of `truffle develop` already running.\n\n## Deploying\n\nTruffle can be used to deploy to any Ethereum network. There are several public test networks and of course the Main Ethereum Network. In the `truffle.js` config file, we can define connections to any network, and use them to deploy our contract using the Truffle CLI.\n\nThe example uses an Ethereum wallet which has its unique mnemonic stored in the machine's environment variables as `ethereum_mnemonic`. The `ropsten` connection will deploy our contracts to the [Ropsten Test Network](https://ropsten.etherscan.io/) using a specified wallet. The Ropsten test network is consistently mined and test ether can be issued to your wallet instantly from a faucet.\n\n```javascript\nconst mnemonic = process.env.ethereum_mnemonic;\nconst HDWalletProvider = require(\"truffle-hdwallet-provider\");\n\nrequire('babel-register');\nrequire('babel-polyfill');\n\nmodule.exports = {\n  build: \"npm run dev\",\n  networks: {\n    development: {\n      host: \"127.0.0.1\",\n      port: 9545,\n      network_id: \"*\" // Match any network id\n    },\n    ropsten: {\n      provider: new HDWalletProvider(mnemonic, \"https://ropsten.infura.io/\"),\n      network_id: 3\n    }\n  }\n};\n```\n\n**Deploying to the Main Ethereum Network is costly and should only be done after you have extensively tested your contracts on test networks.**\n\nTo deploy to Ropsten we can use the following command. Keep in mind that deploying costs ether on the network you are deploying to.\n```\ntruffle migrate --network ropsten\n```\nYou can easily write a connection to the main network in your config using the Ropsten example and the [Truffle docs](http://truffleframework.com/docs/advanced/configuration).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajb413%2Fcrowdsalable-eth-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajb413%2Fcrowdsalable-eth-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajb413%2Fcrowdsalable-eth-token/lists"}