Sharding technology is widely regarded as an effective way to solve blockchain scalability limitations, such as lower throughput and longer delay time. However, sharding encounters challenges related to high cross-shard transactions proportion and complex cross-shard transaction verification. Therefore, a transaction sharding algorithm based on account-weighted graph is proposed. Firstly, an account-based transaction sharding model is established from the viewpoint of data sharding. Secondly, based on this model, an account-weighted graph is constructed with accounts as nodes and transaction frequency between accounts as weights for the long-term accumulated transaction data of blockchain. The community discovery algorithm is adopted, and the accounts with the largest modularity gain are selected and merged according to the association relationship between the accounts, so multi-shards blockchain is formed initially. Finally, multishards blockchain are adjusted and rebuilt by splitting and merging. The proposed algorithm is compared with modular sharding algorithm and random sharding algorithm under the sharding size of 10. The crossshard transaction proportion is reduced by 78%, the average cross-shard transaction delay of accounts is reduced by 36.1% and 44.5%, and the transaction throughput is increased by 93% and 122%. Under the other granularities, the proposed algorithm also outperforms the two algorithms in terms of cross-shard transaction proportion and account transaction delay. In conclusion, the method effectively reduces the cross-shard transaction proportion and minimizes cross-shard transaction delay.